1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | (() => {
|
10 | var __webpack_modules__ = ({
|
11 |
|
12 | 557:
|
13 | ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
14 |
|
15 | "use strict";
|
16 |
|
17 |
|
18 |
|
19 | ;
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==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=o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new n("string"==typeof t?t:t+"",void 0,s),i=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>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[o+1]),t[0]);return new n(o,t,s)},S=(s,o)=>{if(e)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o)}},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;
|
26 |
|
27 |
|
28 | ;
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | const{is:reactive_element_i,defineProperty:reactive_element_e,getOwnPropertyDescriptor:reactive_element_r,getOwnPropertyNames:h,getOwnPropertySymbols:reactive_element_o,getPrototypeOf:reactive_element_n}=Object,a=globalThis,reactive_element_c=a.trustedTypes,l=reactive_element_c?reactive_element_c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!reactive_element_i(t,s),y={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&reactive_element_e(this.prototype,t,r)}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=reactive_element_r(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=reactive_element_n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...h(t),...reactive_element_o(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c(s))}else void 0!==s&&i.push(c(s));return i}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f)(this[t],s))return;this.P(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i)}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d("elementProperties")]=new Map,b[d("finalized")]=new Map,p?.({ReactiveElement:b}),(a.reactiveElementVersions??=[]).push("2.0.4");
|
35 |
|
36 |
|
37 | ;
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | const lit_html_n=globalThis,lit_html_c=lit_html_n.trustedTypes,lit_html_h=lit_html_c?lit_html_c.createPolicy("lit-html",{createHTML:t=>t}):void 0,lit_html_f="$lit$",v=`lit$${Math.random().toFixed(9).slice(2)}$`,m="?"+v,_=`<${m}>`,w=document,lt=()=>w.createComment(""),st=t=>null===t||"object"!=typeof t&&"function"!=typeof t,g=Array.isArray,$=t=>g(t)||"function"==typeof t?.[Symbol.iterator],x="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,E=/-->/g,k=/>/g,O=RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),lit_html_S=/'/g,j=/"/g,M=/^(?:script|style|textarea|title)$/i,P=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),ke=P(1),Oe=P(2),Se=P(3),R=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),V=new WeakMap,I=w.createTreeWalker(w,129);function N(t,i){if(!g(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==lit_html_h?lit_html_h.createHTML(i):i}const U=(t,i)=>{const s=t.length-1,e=[];let h,o=2===i?"<svg>":3===i?"<math>":"",n=T;for(let i=0;i<s;i++){const s=t[i];let r,l,c=-1,a=0;for(;a<s.length&&(n.lastIndex=a,l=n.exec(s),null!==l);)a=n.lastIndex,n===T?"!--"===l[1]?n=E:void 0!==l[1]?n=k:void 0!==l[2]?(M.test(l[2])&&(h=RegExp("</"+l[2],"g")),n=O):void 0!==l[3]&&(n=O):n===O?">"===l[0]?(n=h??T,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,r=l[1],n=void 0===l[3]?O:'"'===l[3]?j:lit_html_S):n===j||n===lit_html_S?n=O:n===E||n===k?n=T:(n=O,h=void 0);const u=n===O&&t[i+1].startsWith("/>")?" ":"";o+=n===T?s+_:c>=0?(e.push(r),s.slice(0,c)+lit_html_f+s.slice(c)+v+u):s+v+(-2===c?i:u)}return[N(t,o+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class B{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let h=0,o=0;const n=t.length-1,r=this.parts,[l,a]=U(t,i);if(this.el=B.createElement(l,s),I.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(e=I.nextNode())&&r.length<n;){if(1===e.nodeType){if(e.hasAttributes())for(const t of e.getAttributeNames())if(t.endsWith(lit_html_f)){const i=a[o++],s=e.getAttribute(t).split(v),n=/([.?@])?(.*)/.exec(i);r.push({type:1,index:h,name:n[2],strings:s,ctor:"."===n[1]?Y:"?"===n[1]?Z:"@"===n[1]?q:G}),e.removeAttribute(t)}else t.startsWith(v)&&(r.push({type:6,index:h}),e.removeAttribute(t));if(M.test(e.tagName)){const t=e.textContent.split(v),i=t.length-1;if(i>0){e.textContent=lit_html_c?lit_html_c.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],lt()),I.nextNode(),r.push({type:2,index:++h});e.append(t[i],lt())}}}else if(8===e.nodeType)if(e.data===m)r.push({type:2,index:h});else{let t=-1;for(;-1!==(t=e.data.indexOf(v,t+1));)r.push({type:7,index:h}),t+=v.length-1}h++}}static createElement(t,i){const s=w.createElement("template");return s.innerHTML=t,s}}function z(t,i,s=t,e){if(i===R)return i;let h=void 0!==e?s.o?.[e]:s.l;const o=st(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s.o??=[])[e]=h:s.l=h),void 0!==h&&(i=z(t,h._$AS(t,i.values),h,e)),i}class F{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??w).importNode(i,!0);I.currentNode=e;let h=I.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new et(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new K(h,this,t)),this._$AV.push(i),r=s[++n]}o!==r?.index&&(h=I.nextNode(),o++)}return I.currentNode=w,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class et{get _$AU(){return this._$AM?._$AU??this.v}constructor(t,i,s,e){this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this.v=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=z(this,t,i),st(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==R&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):$(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==D&&st(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.createTextNode(t)),this._$AH=t}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=B.createElement(N(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else{const t=new F(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t}}_$AC(t){let i=V.get(t.strings);return void 0===i&&V.set(t.strings,i=new B(t)),i}k(t){g(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new et(this.O(lt()),this.O(lt()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){void 0===this._$AM&&(this.v=t,this._$AP?.(t))}}class G{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=D}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=z(this,t,i,0),o=!st(t)||t!==this._$AH&&t!==R,o&&(this._$AH=t);else{const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=z(this,e[s+n],i,n),r===R&&(r=this._$AH[n]),o||=!st(r)||r!==this._$AH[n],r===D?t=D:t!==D&&(t+=(r??"")+h[n+1]),this._$AH[n]=r}o&&!e&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Y extends G{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}class Z extends G{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==D)}}class q extends G{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5}_$AI(t,i=this){if((t=z(this,t,i,0)??D)===R)return;const s=this._$AH,e=t===D&&s!==D||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==D&&(s===D||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class K{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){z(this,t)}}const si={M:lit_html_f,P:v,A:m,C:1,L:U,R:F,D:$,V:z,I:et,H:G,N:Z,U:q,B:Y,F:K},Re=lit_html_n.litHtmlPolyfillSupport;Re?.(B,et),(lit_html_n.litHtmlVersions??=[]).push("3.2.0");const Q=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new et(i.insertBefore(lt(),t),t,void 0,s??{})}return h._$AI(t),h};
|
44 |
|
45 |
|
46 | ;
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | class lit_element_h extends b{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=Q(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return R}}lit_element_h._$litElement$=!0,lit_element_h["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:lit_element_h});const lit_element_f=globalThis.litElementPolyfillSupport;lit_element_f?.({LitElement:lit_element_h});const lit_element_x={_$AK:(t,e,s)=>{t._$AK(e,s)},_$AL:t=>t._$AL};(globalThis.litElementVersions??=[]).push("4.1.0");
|
53 |
|
54 |
|
55 | ;
|
56 |
|
57 |
|
58 |
|
59 | ;
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | function getDefaults() {
|
72 | return {
|
73 | async: false,
|
74 | baseUrl: null,
|
75 | breaks: false,
|
76 | extensions: null,
|
77 | gfm: true,
|
78 | headerIds: true,
|
79 | headerPrefix: '',
|
80 | highlight: null,
|
81 | hooks: null,
|
82 | langPrefix: 'language-',
|
83 | mangle: true,
|
84 | pedantic: false,
|
85 | renderer: null,
|
86 | sanitize: false,
|
87 | sanitizer: null,
|
88 | silent: false,
|
89 | smartypants: false,
|
90 | tokenizer: null,
|
91 | walkTokens: null,
|
92 | xhtml: false
|
93 | };
|
94 | }
|
95 |
|
96 | let defaults = getDefaults();
|
97 |
|
98 | function changeDefaults(newDefaults) {
|
99 | defaults = newDefaults;
|
100 | }
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | const escapeTest = /[&<>"']/;
|
106 | const escapeReplace = new RegExp(escapeTest.source, 'g');
|
107 | const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
|
108 | const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
|
109 | const escapeReplacements = {
|
110 | '&': '&',
|
111 | '<': '<',
|
112 | '>': '>',
|
113 | '"': '"',
|
114 | "'": '''
|
115 | };
|
116 | const getEscapeReplacement = (ch) => escapeReplacements[ch];
|
117 | function marked_esm_escape(html, encode) {
|
118 | if (encode) {
|
119 | if (escapeTest.test(html)) {
|
120 | return html.replace(escapeReplace, getEscapeReplacement);
|
121 | }
|
122 | } else {
|
123 | if (escapeTestNoEncode.test(html)) {
|
124 | return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
125 | }
|
126 | }
|
127 |
|
128 | return html;
|
129 | }
|
130 |
|
131 | const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | function marked_esm_unescape(html) {
|
137 |
|
138 | return html.replace(unescapeTest, (_, n) => {
|
139 | n = n.toLowerCase();
|
140 | if (n === 'colon') return ':';
|
141 | if (n.charAt(0) === '#') {
|
142 | return n.charAt(1) === 'x'
|
143 | ? String.fromCharCode(parseInt(n.substring(2), 16))
|
144 | : String.fromCharCode(+n.substring(1));
|
145 | }
|
146 | return '';
|
147 | });
|
148 | }
|
149 |
|
150 | const caret = /(^|[^\[])\^/g;
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | function edit(regex, opt) {
|
157 | regex = typeof regex === 'string' ? regex : regex.source;
|
158 | opt = opt || '';
|
159 | const obj = {
|
160 | replace: (name, val) => {
|
161 | val = val.source || val;
|
162 | val = val.replace(caret, '$1');
|
163 | regex = regex.replace(name, val);
|
164 | return obj;
|
165 | },
|
166 | getRegex: () => {
|
167 | return new RegExp(regex, opt);
|
168 | }
|
169 | };
|
170 | return obj;
|
171 | }
|
172 |
|
173 | const nonWordAndColonTest = /[^\w:]/g;
|
174 | const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 | function cleanUrl(sanitize, base, href) {
|
182 | if (sanitize) {
|
183 | let prot;
|
184 | try {
|
185 | prot = decodeURIComponent(marked_esm_unescape(href))
|
186 | .replace(nonWordAndColonTest, '')
|
187 | .toLowerCase();
|
188 | } catch (e) {
|
189 | return null;
|
190 | }
|
191 | if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
192 | return null;
|
193 | }
|
194 | }
|
195 | if (base && !originIndependentUrl.test(href)) {
|
196 | href = resolveUrl(base, href);
|
197 | }
|
198 | try {
|
199 | href = encodeURI(href).replace(/%25/g, '%');
|
200 | } catch (e) {
|
201 | return null;
|
202 | }
|
203 | return href;
|
204 | }
|
205 |
|
206 | const baseUrls = {};
|
207 | const justDomain = /^[^:]+:\/*[^/]*$/;
|
208 | const protocol = /^([^:]+:)[\s\S]*$/;
|
209 | const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | function resolveUrl(base, href) {
|
216 | if (!baseUrls[' ' + base]) {
|
217 |
|
218 |
|
219 |
|
220 | if (justDomain.test(base)) {
|
221 | baseUrls[' ' + base] = base + '/';
|
222 | } else {
|
223 | baseUrls[' ' + base] = rtrim(base, '/', true);
|
224 | }
|
225 | }
|
226 | base = baseUrls[' ' + base];
|
227 | const relativeBase = base.indexOf(':') === -1;
|
228 |
|
229 | if (href.substring(0, 2) === '//') {
|
230 | if (relativeBase) {
|
231 | return href;
|
232 | }
|
233 | return base.replace(protocol, '$1') + href;
|
234 | } else if (href.charAt(0) === '/') {
|
235 | if (relativeBase) {
|
236 | return href;
|
237 | }
|
238 | return base.replace(domain, '$1') + href;
|
239 | } else {
|
240 | return base + href;
|
241 | }
|
242 | }
|
243 |
|
244 | const noopTest = { exec: function noopTest() {} };
|
245 |
|
246 | function splitCells(tableRow, count) {
|
247 |
|
248 |
|
249 | const row = tableRow.replace(/\|/g, (match, offset, str) => {
|
250 | let escaped = false,
|
251 | curr = offset;
|
252 | while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
|
253 | if (escaped) {
|
254 |
|
255 |
|
256 | return '|';
|
257 | } else {
|
258 |
|
259 | return ' |';
|
260 | }
|
261 | }),
|
262 | cells = row.split(/ \|/);
|
263 | let i = 0;
|
264 |
|
265 |
|
266 | if (!cells[0].trim()) { cells.shift(); }
|
267 | if (cells.length > 0 && !cells[cells.length - 1].trim()) { cells.pop(); }
|
268 |
|
269 | if (cells.length > count) {
|
270 | cells.splice(count);
|
271 | } else {
|
272 | while (cells.length < count) cells.push('');
|
273 | }
|
274 |
|
275 | for (; i < cells.length; i++) {
|
276 |
|
277 | cells[i] = cells[i].trim().replace(/\\\|/g, '|');
|
278 | }
|
279 | return cells;
|
280 | }
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | function rtrim(str, c, invert) {
|
291 | const l = str.length;
|
292 | if (l === 0) {
|
293 | return '';
|
294 | }
|
295 |
|
296 |
|
297 | let suffLen = 0;
|
298 |
|
299 |
|
300 | while (suffLen < l) {
|
301 | const currChar = str.charAt(l - suffLen - 1);
|
302 | if (currChar === c && !invert) {
|
303 | suffLen++;
|
304 | } else if (currChar !== c && invert) {
|
305 | suffLen++;
|
306 | } else {
|
307 | break;
|
308 | }
|
309 | }
|
310 |
|
311 | return str.slice(0, l - suffLen);
|
312 | }
|
313 |
|
314 | function findClosingBracket(str, b) {
|
315 | if (str.indexOf(b[1]) === -1) {
|
316 | return -1;
|
317 | }
|
318 | const l = str.length;
|
319 | let level = 0,
|
320 | i = 0;
|
321 | for (; i < l; i++) {
|
322 | if (str[i] === '\\') {
|
323 | i++;
|
324 | } else if (str[i] === b[0]) {
|
325 | level++;
|
326 | } else if (str[i] === b[1]) {
|
327 | level--;
|
328 | if (level < 0) {
|
329 | return i;
|
330 | }
|
331 | }
|
332 | }
|
333 | return -1;
|
334 | }
|
335 |
|
336 | function checkSanitizeDeprecation(opt) {
|
337 | if (opt && opt.sanitize && !opt.silent) {
|
338 | 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');
|
339 | }
|
340 | }
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 | function repeatString(pattern, count) {
|
348 | if (count < 1) {
|
349 | return '';
|
350 | }
|
351 | let result = '';
|
352 | while (count > 1) {
|
353 | if (count & 1) {
|
354 | result += pattern;
|
355 | }
|
356 | count >>= 1;
|
357 | pattern += pattern;
|
358 | }
|
359 | return result + pattern;
|
360 | }
|
361 |
|
362 | function outputLink(cap, link, raw, lexer) {
|
363 | const href = link.href;
|
364 | const title = link.title ? marked_esm_escape(link.title) : null;
|
365 | const text = cap[1].replace(/\\([\[\]])/g, '$1');
|
366 |
|
367 | if (cap[0].charAt(0) !== '!') {
|
368 | lexer.state.inLink = true;
|
369 | const token = {
|
370 | type: 'link',
|
371 | raw,
|
372 | href,
|
373 | title,
|
374 | text,
|
375 | tokens: lexer.inlineTokens(text)
|
376 | };
|
377 | lexer.state.inLink = false;
|
378 | return token;
|
379 | }
|
380 | return {
|
381 | type: 'image',
|
382 | raw,
|
383 | href,
|
384 | title,
|
385 | text: marked_esm_escape(text)
|
386 | };
|
387 | }
|
388 |
|
389 | function indentCodeCompensation(raw, text) {
|
390 | const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
391 |
|
392 | if (matchIndentToCode === null) {
|
393 | return text;
|
394 | }
|
395 |
|
396 | const indentToCode = matchIndentToCode[1];
|
397 |
|
398 | return text
|
399 | .split('\n')
|
400 | .map(node => {
|
401 | const matchIndentInNode = node.match(/^\s+/);
|
402 | if (matchIndentInNode === null) {
|
403 | return node;
|
404 | }
|
405 |
|
406 | const [indentInNode] = matchIndentInNode;
|
407 |
|
408 | if (indentInNode.length >= indentToCode.length) {
|
409 | return node.slice(indentToCode.length);
|
410 | }
|
411 |
|
412 | return node;
|
413 | })
|
414 | .join('\n');
|
415 | }
|
416 |
|
417 |
|
418 |
|
419 |
|
420 | class Tokenizer {
|
421 | constructor(options) {
|
422 | this.options = options || defaults;
|
423 | }
|
424 |
|
425 | space(src) {
|
426 | const cap = this.rules.block.newline.exec(src);
|
427 | if (cap && cap[0].length > 0) {
|
428 | return {
|
429 | type: 'space',
|
430 | raw: cap[0]
|
431 | };
|
432 | }
|
433 | }
|
434 |
|
435 | code(src) {
|
436 | const cap = this.rules.block.code.exec(src);
|
437 | if (cap) {
|
438 | const text = cap[0].replace(/^ {1,4}/gm, '');
|
439 | return {
|
440 | type: 'code',
|
441 | raw: cap[0],
|
442 | codeBlockStyle: 'indented',
|
443 | text: !this.options.pedantic
|
444 | ? rtrim(text, '\n')
|
445 | : text
|
446 | };
|
447 | }
|
448 | }
|
449 |
|
450 | fences(src) {
|
451 | const cap = this.rules.block.fences.exec(src);
|
452 | if (cap) {
|
453 | const raw = cap[0];
|
454 | const text = indentCodeCompensation(raw, cap[3] || '');
|
455 |
|
456 | return {
|
457 | type: 'code',
|
458 | raw,
|
459 | lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
|
460 | text
|
461 | };
|
462 | }
|
463 | }
|
464 |
|
465 | heading(src) {
|
466 | const cap = this.rules.block.heading.exec(src);
|
467 | if (cap) {
|
468 | let text = cap[2].trim();
|
469 |
|
470 |
|
471 | if (/#$/.test(text)) {
|
472 | const trimmed = rtrim(text, '#');
|
473 | if (this.options.pedantic) {
|
474 | text = trimmed.trim();
|
475 | } else if (!trimmed || / $/.test(trimmed)) {
|
476 |
|
477 | text = trimmed.trim();
|
478 | }
|
479 | }
|
480 |
|
481 | return {
|
482 | type: 'heading',
|
483 | raw: cap[0],
|
484 | depth: cap[1].length,
|
485 | text,
|
486 | tokens: this.lexer.inline(text)
|
487 | };
|
488 | }
|
489 | }
|
490 |
|
491 | hr(src) {
|
492 | const cap = this.rules.block.hr.exec(src);
|
493 | if (cap) {
|
494 | return {
|
495 | type: 'hr',
|
496 | raw: cap[0]
|
497 | };
|
498 | }
|
499 | }
|
500 |
|
501 | blockquote(src) {
|
502 | const cap = this.rules.block.blockquote.exec(src);
|
503 | if (cap) {
|
504 | const text = cap[0].replace(/^ *>[ \t]?/gm, '');
|
505 | const top = this.lexer.state.top;
|
506 | this.lexer.state.top = true;
|
507 | const tokens = this.lexer.blockTokens(text);
|
508 | this.lexer.state.top = top;
|
509 | return {
|
510 | type: 'blockquote',
|
511 | raw: cap[0],
|
512 | tokens,
|
513 | text
|
514 | };
|
515 | }
|
516 | }
|
517 |
|
518 | list(src) {
|
519 | let cap = this.rules.block.list.exec(src);
|
520 | if (cap) {
|
521 | let raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine,
|
522 | line, nextLine, rawLine, itemContents, endEarly;
|
523 |
|
524 | let bull = cap[1].trim();
|
525 | const isordered = bull.length > 1;
|
526 |
|
527 | const list = {
|
528 | type: 'list',
|
529 | raw: '',
|
530 | ordered: isordered,
|
531 | start: isordered ? +bull.slice(0, -1) : '',
|
532 | loose: false,
|
533 | items: []
|
534 | };
|
535 |
|
536 | bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
537 |
|
538 | if (this.options.pedantic) {
|
539 | bull = isordered ? bull : '[*+-]';
|
540 | }
|
541 |
|
542 |
|
543 | const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
|
544 |
|
545 |
|
546 | while (src) {
|
547 | endEarly = false;
|
548 | if (!(cap = itemRegex.exec(src))) {
|
549 | break;
|
550 | }
|
551 |
|
552 | if (this.rules.block.hr.test(src)) {
|
553 | break;
|
554 | }
|
555 |
|
556 | raw = cap[0];
|
557 | src = src.substring(raw.length);
|
558 |
|
559 | line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
560 | nextLine = src.split('\n', 1)[0];
|
561 |
|
562 | if (this.options.pedantic) {
|
563 | indent = 2;
|
564 | itemContents = line.trimLeft();
|
565 | } else {
|
566 | indent = cap[2].search(/[^ ]/);
|
567 | indent = indent > 4 ? 1 : indent;
|
568 | itemContents = line.slice(indent);
|
569 | indent += cap[1].length;
|
570 | }
|
571 |
|
572 | blankLine = false;
|
573 |
|
574 | if (!line && /^ *$/.test(nextLine)) {
|
575 | raw += nextLine + '\n';
|
576 | src = src.substring(nextLine.length + 1);
|
577 | endEarly = true;
|
578 | }
|
579 |
|
580 | if (!endEarly) {
|
581 | const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
|
582 | const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
583 | const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
584 | const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
585 |
|
586 |
|
587 | while (src) {
|
588 | rawLine = src.split('\n', 1)[0];
|
589 | nextLine = rawLine;
|
590 |
|
591 |
|
592 | if (this.options.pedantic) {
|
593 | nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
|
594 | }
|
595 |
|
596 |
|
597 | if (fencesBeginRegex.test(nextLine)) {
|
598 | break;
|
599 | }
|
600 |
|
601 |
|
602 | if (headingBeginRegex.test(nextLine)) {
|
603 | break;
|
604 | }
|
605 |
|
606 |
|
607 | if (nextBulletRegex.test(nextLine)) {
|
608 | break;
|
609 | }
|
610 |
|
611 |
|
612 | if (hrRegex.test(src)) {
|
613 | break;
|
614 | }
|
615 |
|
616 | if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
|
617 | itemContents += '\n' + nextLine.slice(indent);
|
618 | } else {
|
619 |
|
620 | if (blankLine) {
|
621 | break;
|
622 | }
|
623 |
|
624 |
|
625 | if (line.search(/[^ ]/) >= 4) {
|
626 | break;
|
627 | }
|
628 | if (fencesBeginRegex.test(line)) {
|
629 | break;
|
630 | }
|
631 | if (headingBeginRegex.test(line)) {
|
632 | break;
|
633 | }
|
634 | if (hrRegex.test(line)) {
|
635 | break;
|
636 | }
|
637 |
|
638 | itemContents += '\n' + nextLine;
|
639 | }
|
640 |
|
641 | if (!blankLine && !nextLine.trim()) {
|
642 | blankLine = true;
|
643 | }
|
644 |
|
645 | raw += rawLine + '\n';
|
646 | src = src.substring(rawLine.length + 1);
|
647 | line = nextLine.slice(indent);
|
648 | }
|
649 | }
|
650 |
|
651 | if (!list.loose) {
|
652 |
|
653 | if (endsWithBlankLine) {
|
654 | list.loose = true;
|
655 | } else if (/\n *\n *$/.test(raw)) {
|
656 | endsWithBlankLine = true;
|
657 | }
|
658 | }
|
659 |
|
660 |
|
661 | if (this.options.gfm) {
|
662 | istask = /^\[[ xX]\] /.exec(itemContents);
|
663 | if (istask) {
|
664 | ischecked = istask[0] !== '[ ] ';
|
665 | itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
|
666 | }
|
667 | }
|
668 |
|
669 | list.items.push({
|
670 | type: 'list_item',
|
671 | raw,
|
672 | task: !!istask,
|
673 | checked: ischecked,
|
674 | loose: false,
|
675 | text: itemContents
|
676 | });
|
677 |
|
678 | list.raw += raw;
|
679 | }
|
680 |
|
681 |
|
682 | list.items[list.items.length - 1].raw = raw.trimRight();
|
683 | list.items[list.items.length - 1].text = itemContents.trimRight();
|
684 | list.raw = list.raw.trimRight();
|
685 |
|
686 | const l = list.items.length;
|
687 |
|
688 |
|
689 | for (i = 0; i < l; i++) {
|
690 | this.lexer.state.top = false;
|
691 | list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
|
692 |
|
693 | if (!list.loose) {
|
694 |
|
695 | const spacers = list.items[i].tokens.filter(t => t.type === 'space');
|
696 | const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
|
697 |
|
698 | list.loose = hasMultipleLineBreaks;
|
699 | }
|
700 | }
|
701 |
|
702 |
|
703 | if (list.loose) {
|
704 | for (i = 0; i < l; i++) {
|
705 | list.items[i].loose = true;
|
706 | }
|
707 | }
|
708 |
|
709 | return list;
|
710 | }
|
711 | }
|
712 |
|
713 | html(src) {
|
714 | const cap = this.rules.block.html.exec(src);
|
715 | if (cap) {
|
716 | const token = {
|
717 | type: 'html',
|
718 | raw: cap[0],
|
719 | pre: !this.options.sanitizer
|
720 | && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
721 | text: cap[0]
|
722 | };
|
723 | if (this.options.sanitize) {
|
724 | const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : marked_esm_escape(cap[0]);
|
725 | token.type = 'paragraph';
|
726 | token.text = text;
|
727 | token.tokens = this.lexer.inline(text);
|
728 | }
|
729 | return token;
|
730 | }
|
731 | }
|
732 |
|
733 | def(src) {
|
734 | const cap = this.rules.block.def.exec(src);
|
735 | if (cap) {
|
736 | const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
737 | const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
|
738 | const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
|
739 | return {
|
740 | type: 'def',
|
741 | tag,
|
742 | raw: cap[0],
|
743 | href,
|
744 | title
|
745 | };
|
746 | }
|
747 | }
|
748 |
|
749 | table(src) {
|
750 | const cap = this.rules.block.table.exec(src);
|
751 | if (cap) {
|
752 | const item = {
|
753 | type: 'table',
|
754 | header: splitCells(cap[1]).map(c => { return { text: c }; }),
|
755 | align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
756 | rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
757 | };
|
758 |
|
759 | if (item.header.length === item.align.length) {
|
760 | item.raw = cap[0];
|
761 |
|
762 | let l = item.align.length;
|
763 | let i, j, k, row;
|
764 | for (i = 0; i < l; i++) {
|
765 | if (/^ *-+: *$/.test(item.align[i])) {
|
766 | item.align[i] = 'right';
|
767 | } else if (/^ *:-+: *$/.test(item.align[i])) {
|
768 | item.align[i] = 'center';
|
769 | } else if (/^ *:-+ *$/.test(item.align[i])) {
|
770 | item.align[i] = 'left';
|
771 | } else {
|
772 | item.align[i] = null;
|
773 | }
|
774 | }
|
775 |
|
776 | l = item.rows.length;
|
777 | for (i = 0; i < l; i++) {
|
778 | item.rows[i] = splitCells(item.rows[i], item.header.length).map(c => { return { text: c }; });
|
779 | }
|
780 |
|
781 |
|
782 |
|
783 |
|
784 | l = item.header.length;
|
785 | for (j = 0; j < l; j++) {
|
786 | item.header[j].tokens = this.lexer.inline(item.header[j].text);
|
787 | }
|
788 |
|
789 |
|
790 | l = item.rows.length;
|
791 | for (j = 0; j < l; j++) {
|
792 | row = item.rows[j];
|
793 | for (k = 0; k < row.length; k++) {
|
794 | row[k].tokens = this.lexer.inline(row[k].text);
|
795 | }
|
796 | }
|
797 |
|
798 | return item;
|
799 | }
|
800 | }
|
801 | }
|
802 |
|
803 | lheading(src) {
|
804 | const cap = this.rules.block.lheading.exec(src);
|
805 | if (cap) {
|
806 | return {
|
807 | type: 'heading',
|
808 | raw: cap[0],
|
809 | depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
810 | text: cap[1],
|
811 | tokens: this.lexer.inline(cap[1])
|
812 | };
|
813 | }
|
814 | }
|
815 |
|
816 | paragraph(src) {
|
817 | const cap = this.rules.block.paragraph.exec(src);
|
818 | if (cap) {
|
819 | const text = cap[1].charAt(cap[1].length - 1) === '\n'
|
820 | ? cap[1].slice(0, -1)
|
821 | : cap[1];
|
822 | return {
|
823 | type: 'paragraph',
|
824 | raw: cap[0],
|
825 | text,
|
826 | tokens: this.lexer.inline(text)
|
827 | };
|
828 | }
|
829 | }
|
830 |
|
831 | text(src) {
|
832 | const cap = this.rules.block.text.exec(src);
|
833 | if (cap) {
|
834 | return {
|
835 | type: 'text',
|
836 | raw: cap[0],
|
837 | text: cap[0],
|
838 | tokens: this.lexer.inline(cap[0])
|
839 | };
|
840 | }
|
841 | }
|
842 |
|
843 | escape(src) {
|
844 | const cap = this.rules.inline.escape.exec(src);
|
845 | if (cap) {
|
846 | return {
|
847 | type: 'escape',
|
848 | raw: cap[0],
|
849 | text: marked_esm_escape(cap[1])
|
850 | };
|
851 | }
|
852 | }
|
853 |
|
854 | tag(src) {
|
855 | const cap = this.rules.inline.tag.exec(src);
|
856 | if (cap) {
|
857 | if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
|
858 | this.lexer.state.inLink = true;
|
859 | } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
|
860 | this.lexer.state.inLink = false;
|
861 | }
|
862 | if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
863 | this.lexer.state.inRawBlock = true;
|
864 | } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
865 | this.lexer.state.inRawBlock = false;
|
866 | }
|
867 |
|
868 | return {
|
869 | type: this.options.sanitize
|
870 | ? 'text'
|
871 | : 'html',
|
872 | raw: cap[0],
|
873 | inLink: this.lexer.state.inLink,
|
874 | inRawBlock: this.lexer.state.inRawBlock,
|
875 | text: this.options.sanitize
|
876 | ? (this.options.sanitizer
|
877 | ? this.options.sanitizer(cap[0])
|
878 | : marked_esm_escape(cap[0]))
|
879 | : cap[0]
|
880 | };
|
881 | }
|
882 | }
|
883 |
|
884 | link(src) {
|
885 | const cap = this.rules.inline.link.exec(src);
|
886 | if (cap) {
|
887 | const trimmedUrl = cap[2].trim();
|
888 | if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
889 |
|
890 | if (!(/>$/.test(trimmedUrl))) {
|
891 | return;
|
892 | }
|
893 |
|
894 |
|
895 | const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
896 | if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
897 | return;
|
898 | }
|
899 | } else {
|
900 |
|
901 | const lastParenIndex = findClosingBracket(cap[2], '()');
|
902 | if (lastParenIndex > -1) {
|
903 | const start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
904 | const linkLen = start + cap[1].length + lastParenIndex;
|
905 | cap[2] = cap[2].substring(0, lastParenIndex);
|
906 | cap[0] = cap[0].substring(0, linkLen).trim();
|
907 | cap[3] = '';
|
908 | }
|
909 | }
|
910 | let href = cap[2];
|
911 | let title = '';
|
912 | if (this.options.pedantic) {
|
913 |
|
914 | const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
915 |
|
916 | if (link) {
|
917 | href = link[1];
|
918 | title = link[3];
|
919 | }
|
920 | } else {
|
921 | title = cap[3] ? cap[3].slice(1, -1) : '';
|
922 | }
|
923 |
|
924 | href = href.trim();
|
925 | if (/^</.test(href)) {
|
926 | if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {
|
927 |
|
928 | href = href.slice(1);
|
929 | } else {
|
930 | href = href.slice(1, -1);
|
931 | }
|
932 | }
|
933 | return outputLink(cap, {
|
934 | href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
|
935 | title: title ? title.replace(this.rules.inline._escapes, '$1') : title
|
936 | }, cap[0], this.lexer);
|
937 | }
|
938 | }
|
939 |
|
940 | reflink(src, links) {
|
941 | let cap;
|
942 | if ((cap = this.rules.inline.reflink.exec(src))
|
943 | || (cap = this.rules.inline.nolink.exec(src))) {
|
944 | let link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
945 | link = links[link.toLowerCase()];
|
946 | if (!link) {
|
947 | const text = cap[0].charAt(0);
|
948 | return {
|
949 | type: 'text',
|
950 | raw: text,
|
951 | text
|
952 | };
|
953 | }
|
954 | return outputLink(cap, link, cap[0], this.lexer);
|
955 | }
|
956 | }
|
957 |
|
958 | emStrong(src, maskedSrc, prevChar = '') {
|
959 | let match = this.rules.inline.emStrong.lDelim.exec(src);
|
960 | if (!match) return;
|
961 |
|
962 |
|
963 | if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return;
|
964 |
|
965 | const nextChar = match[1] || match[2] || '';
|
966 |
|
967 | if (!nextChar || (nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
|
968 | const lLength = match[0].length - 1;
|
969 | let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
970 |
|
971 | const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
972 | endReg.lastIndex = 0;
|
973 |
|
974 |
|
975 | maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
976 |
|
977 | while ((match = endReg.exec(maskedSrc)) != null) {
|
978 | rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
979 |
|
980 | if (!rDelim) continue;
|
981 |
|
982 | rLength = rDelim.length;
|
983 |
|
984 | if (match[3] || match[4]) {
|
985 | delimTotal += rLength;
|
986 | continue;
|
987 | } else if (match[5] || match[6]) {
|
988 | if (lLength % 3 && !((lLength + rLength) % 3)) {
|
989 | midDelimTotal += rLength;
|
990 | continue;
|
991 | }
|
992 | }
|
993 |
|
994 | delimTotal -= rLength;
|
995 |
|
996 | if (delimTotal > 0) continue;
|
997 |
|
998 |
|
999 | rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
1000 |
|
1001 | const raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength);
|
1002 |
|
1003 |
|
1004 | if (Math.min(lLength, rLength) % 2) {
|
1005 | const text = raw.slice(1, -1);
|
1006 | return {
|
1007 | type: 'em',
|
1008 | raw,
|
1009 | text,
|
1010 | tokens: this.lexer.inlineTokens(text)
|
1011 | };
|
1012 | }
|
1013 |
|
1014 |
|
1015 | const text = raw.slice(2, -2);
|
1016 | return {
|
1017 | type: 'strong',
|
1018 | raw,
|
1019 | text,
|
1020 | tokens: this.lexer.inlineTokens(text)
|
1021 | };
|
1022 | }
|
1023 | }
|
1024 | }
|
1025 |
|
1026 | codespan(src) {
|
1027 | const cap = this.rules.inline.code.exec(src);
|
1028 | if (cap) {
|
1029 | let text = cap[2].replace(/\n/g, ' ');
|
1030 | const hasNonSpaceChars = /[^ ]/.test(text);
|
1031 | const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
|
1032 | if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
1033 | text = text.substring(1, text.length - 1);
|
1034 | }
|
1035 | text = marked_esm_escape(text, true);
|
1036 | return {
|
1037 | type: 'codespan',
|
1038 | raw: cap[0],
|
1039 | text
|
1040 | };
|
1041 | }
|
1042 | }
|
1043 |
|
1044 | br(src) {
|
1045 | const cap = this.rules.inline.br.exec(src);
|
1046 | if (cap) {
|
1047 | return {
|
1048 | type: 'br',
|
1049 | raw: cap[0]
|
1050 | };
|
1051 | }
|
1052 | }
|
1053 |
|
1054 | del(src) {
|
1055 | const cap = this.rules.inline.del.exec(src);
|
1056 | if (cap) {
|
1057 | return {
|
1058 | type: 'del',
|
1059 | raw: cap[0],
|
1060 | text: cap[2],
|
1061 | tokens: this.lexer.inlineTokens(cap[2])
|
1062 | };
|
1063 | }
|
1064 | }
|
1065 |
|
1066 | autolink(src, mangle) {
|
1067 | const cap = this.rules.inline.autolink.exec(src);
|
1068 | if (cap) {
|
1069 | let text, href;
|
1070 | if (cap[2] === '@') {
|
1071 | text = marked_esm_escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
|
1072 | href = 'mailto:' + text;
|
1073 | } else {
|
1074 | text = marked_esm_escape(cap[1]);
|
1075 | href = text;
|
1076 | }
|
1077 |
|
1078 | return {
|
1079 | type: 'link',
|
1080 | raw: cap[0],
|
1081 | text,
|
1082 | href,
|
1083 | tokens: [
|
1084 | {
|
1085 | type: 'text',
|
1086 | raw: text,
|
1087 | text
|
1088 | }
|
1089 | ]
|
1090 | };
|
1091 | }
|
1092 | }
|
1093 |
|
1094 | url(src, mangle) {
|
1095 | let cap;
|
1096 | if (cap = this.rules.inline.url.exec(src)) {
|
1097 | let text, href;
|
1098 | if (cap[2] === '@') {
|
1099 | text = marked_esm_escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
|
1100 | href = 'mailto:' + text;
|
1101 | } else {
|
1102 |
|
1103 | let prevCapZero;
|
1104 | do {
|
1105 | prevCapZero = cap[0];
|
1106 | cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
|
1107 | } while (prevCapZero !== cap[0]);
|
1108 | text = marked_esm_escape(cap[0]);
|
1109 | if (cap[1] === 'www.') {
|
1110 | href = 'http://' + cap[0];
|
1111 | } else {
|
1112 | href = cap[0];
|
1113 | }
|
1114 | }
|
1115 | return {
|
1116 | type: 'link',
|
1117 | raw: cap[0],
|
1118 | text,
|
1119 | href,
|
1120 | tokens: [
|
1121 | {
|
1122 | type: 'text',
|
1123 | raw: text,
|
1124 | text
|
1125 | }
|
1126 | ]
|
1127 | };
|
1128 | }
|
1129 | }
|
1130 |
|
1131 | inlineText(src, smartypants) {
|
1132 | const cap = this.rules.inline.text.exec(src);
|
1133 | if (cap) {
|
1134 | let text;
|
1135 | if (this.lexer.state.inRawBlock) {
|
1136 | text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : marked_esm_escape(cap[0])) : cap[0];
|
1137 | } else {
|
1138 | text = marked_esm_escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
|
1139 | }
|
1140 | return {
|
1141 | type: 'text',
|
1142 | raw: cap[0],
|
1143 | text
|
1144 | };
|
1145 | }
|
1146 | }
|
1147 | }
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 | const block = {
|
1153 | newline: /^(?: *(?:\n|$))+/,
|
1154 | code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
1155 | fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
1156 | hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
1157 | heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
1158 | blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
1159 | list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
|
1160 | html: '^ {0,3}(?:'
|
1161 | + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)'
|
1162 | + '|comment[^\\n]*(\\n+|$)'
|
1163 | + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)'
|
1164 | + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)'
|
1165 | + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)'
|
1166 | + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)'
|
1167 | + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)'
|
1168 | + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)'
|
1169 | + ')',
|
1170 | def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
1171 | table: noopTest,
|
1172 | lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
1173 |
|
1174 |
|
1175 | _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
1176 | text: /^[^\n]+/
|
1177 | };
|
1178 |
|
1179 | block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
1180 | block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
1181 | block.def = edit(block.def)
|
1182 | .replace('label', block._label)
|
1183 | .replace('title', block._title)
|
1184 | .getRegex();
|
1185 |
|
1186 | block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
1187 | block.listItemStart = edit(/^( *)(bull) */)
|
1188 | .replace('bull', block.bullet)
|
1189 | .getRegex();
|
1190 |
|
1191 | block.list = edit(block.list)
|
1192 | .replace(/bull/g, block.bullet)
|
1193 | .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
|
1194 | .replace('def', '\\n+(?=' + block.def.source + ')')
|
1195 | .getRegex();
|
1196 |
|
1197 | block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
1198 | + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
1199 | + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
1200 | + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
1201 | + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
1202 | + '|track|ul';
|
1203 | block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
1204 | block.html = edit(block.html, 'i')
|
1205 | .replace('comment', block._comment)
|
1206 | .replace('tag', block._tag)
|
1207 | .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
1208 | .getRegex();
|
1209 |
|
1210 | block.paragraph = edit(block._paragraph)
|
1211 | .replace('hr', block.hr)
|
1212 | .replace('heading', ' {0,3}#{1,6} ')
|
1213 | .replace('|lheading', '')
|
1214 | .replace('|table', '')
|
1215 | .replace('blockquote', ' {0,3}>')
|
1216 | .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
1217 | .replace('list', ' {0,3}(?:[*+-]|1[.)]) ')
|
1218 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
1219 | .replace('tag', block._tag)
|
1220 | .getRegex();
|
1221 |
|
1222 | block.blockquote = edit(block.blockquote)
|
1223 | .replace('paragraph', block.paragraph)
|
1224 | .getRegex();
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 | block.normal = { ...block };
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 | block.gfm = {
|
1237 | ...block.normal,
|
1238 | table: '^ *([^\\n ].*\\|.*)\\n'
|
1239 | + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?'
|
1240 | + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)'
|
1241 | };
|
1242 |
|
1243 | block.gfm.table = edit(block.gfm.table)
|
1244 | .replace('hr', block.hr)
|
1245 | .replace('heading', ' {0,3}#{1,6} ')
|
1246 | .replace('blockquote', ' {0,3}>')
|
1247 | .replace('code', ' {4}[^\\n]')
|
1248 | .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
1249 | .replace('list', ' {0,3}(?:[*+-]|1[.)]) ')
|
1250 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
1251 | .replace('tag', block._tag)
|
1252 | .getRegex();
|
1253 |
|
1254 | block.gfm.paragraph = edit(block._paragraph)
|
1255 | .replace('hr', block.hr)
|
1256 | .replace('heading', ' {0,3}#{1,6} ')
|
1257 | .replace('|lheading', '')
|
1258 | .replace('table', block.gfm.table)
|
1259 | .replace('blockquote', ' {0,3}>')
|
1260 | .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
1261 | .replace('list', ' {0,3}(?:[*+-]|1[.)]) ')
|
1262 | .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
1263 | .replace('tag', block._tag)
|
1264 | .getRegex();
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 | block.pedantic = {
|
1270 | ...block.normal,
|
1271 | html: edit(
|
1272 | '^ *(?:comment *(?:\\n|\\s*$)'
|
1273 | + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)'
|
1274 | + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
|
1275 | .replace('comment', block._comment)
|
1276 | .replace(/tag/g, '(?!(?:'
|
1277 | + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
|
1278 | + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
|
1279 | + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
|
1280 | .getRegex(),
|
1281 | def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
1282 | heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
1283 | fences: noopTest,
|
1284 | lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
1285 | paragraph: edit(block.normal._paragraph)
|
1286 | .replace('hr', block.hr)
|
1287 | .replace('heading', ' *#{1,6} *[^\n]')
|
1288 | .replace('lheading', block.lheading)
|
1289 | .replace('blockquote', ' {0,3}>')
|
1290 | .replace('|fences', '')
|
1291 | .replace('|list', '')
|
1292 | .replace('|html', '')
|
1293 | .getRegex()
|
1294 | };
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 | const inline = {
|
1300 | escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
1301 | autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
1302 | url: noopTest,
|
1303 | tag: '^comment'
|
1304 | + '|^</[a-zA-Z][\\w:-]*\\s*>'
|
1305 | + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>'
|
1306 | + '|^<\\?[\\s\\S]*?\\?>'
|
1307 | + '|^<![a-zA-Z]+\\s[\\s\\S]*?>'
|
1308 | + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
|
1309 | link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
1310 | reflink: /^!?\[(label)\]\[(ref)\]/,
|
1311 | nolink: /^!?\[(ref)\](?:\[\])?/,
|
1312 | reflinkSearch: 'reflink|nolink(?!\\()',
|
1313 | emStrong: {
|
1314 | lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
|
1315 |
|
1316 |
|
1317 | rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
|
1318 | rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
|
1319 | },
|
1320 | code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
1321 | br: /^( {2,}|\\)\n(?!\s*$)/,
|
1322 | del: noopTest,
|
1323 | text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
1324 | punctuation: /^([\spunctuation])/
|
1325 | };
|
1326 |
|
1327 |
|
1328 |
|
1329 | inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
1330 | inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
|
1331 |
|
1332 |
|
1333 | inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
1334 |
|
1335 |
|
1336 | inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
|
1337 |
|
1338 | inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
1339 |
|
1340 | inline.emStrong.lDelim = edit(inline.emStrong.lDelim)
|
1341 | .replace(/punct/g, inline._punctuation)
|
1342 | .getRegex();
|
1343 |
|
1344 | inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g')
|
1345 | .replace(/punct/g, inline._punctuation)
|
1346 | .getRegex();
|
1347 |
|
1348 | inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g')
|
1349 | .replace(/punct/g, inline._punctuation)
|
1350 | .getRegex();
|
1351 |
|
1352 | inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
1353 |
|
1354 | inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
1355 | 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])?)+(?![-_])/;
|
1356 | inline.autolink = edit(inline.autolink)
|
1357 | .replace('scheme', inline._scheme)
|
1358 | .replace('email', inline._email)
|
1359 | .getRegex();
|
1360 |
|
1361 | inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
1362 |
|
1363 | inline.tag = edit(inline.tag)
|
1364 | .replace('comment', inline._comment)
|
1365 | .replace('attribute', inline._attribute)
|
1366 | .getRegex();
|
1367 |
|
1368 | inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
1369 | inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
1370 | inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
1371 |
|
1372 | inline.link = edit(inline.link)
|
1373 | .replace('label', inline._label)
|
1374 | .replace('href', inline._href)
|
1375 | .replace('title', inline._title)
|
1376 | .getRegex();
|
1377 |
|
1378 | inline.reflink = edit(inline.reflink)
|
1379 | .replace('label', inline._label)
|
1380 | .replace('ref', block._label)
|
1381 | .getRegex();
|
1382 |
|
1383 | inline.nolink = edit(inline.nolink)
|
1384 | .replace('ref', block._label)
|
1385 | .getRegex();
|
1386 |
|
1387 | inline.reflinkSearch = edit(inline.reflinkSearch, 'g')
|
1388 | .replace('reflink', inline.reflink)
|
1389 | .replace('nolink', inline.nolink)
|
1390 | .getRegex();
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 | inline.normal = { ...inline };
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 | inline.pedantic = {
|
1403 | ...inline.normal,
|
1404 | strong: {
|
1405 | start: /^__|\*\*/,
|
1406 | middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
1407 | endAst: /\*\*(?!\*)/g,
|
1408 | endUnd: /__(?!_)/g
|
1409 | },
|
1410 | em: {
|
1411 | start: /^_|\*/,
|
1412 | middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
1413 | endAst: /\*(?!\*)/g,
|
1414 | endUnd: /_(?!_)/g
|
1415 | },
|
1416 | link: edit(/^!?\[(label)\]\((.*?)\)/)
|
1417 | .replace('label', inline._label)
|
1418 | .getRegex(),
|
1419 | reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
1420 | .replace('label', inline._label)
|
1421 | .getRegex()
|
1422 | };
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 | inline.gfm = {
|
1429 | ...inline.normal,
|
1430 | escape: edit(inline.escape).replace('])', '~|])').getRegex(),
|
1431 | _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
1432 | url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
1433 | _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
1434 | del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
1435 | text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
1436 | };
|
1437 |
|
1438 | inline.gfm.url = edit(inline.gfm.url, 'i')
|
1439 | .replace('email', inline.gfm._extended_email)
|
1440 | .getRegex();
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 | inline.breaks = {
|
1446 | ...inline.gfm,
|
1447 | br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
1448 | text: edit(inline.gfm.text)
|
1449 | .replace('\\b_', '\\b_| {2,}\\n')
|
1450 | .replace(/\{2,\}/g, '*')
|
1451 | .getRegex()
|
1452 | };
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 | function smartypants(text) {
|
1459 | return text
|
1460 |
|
1461 | .replace(/---/g, '\u2014')
|
1462 |
|
1463 | .replace(/--/g, '\u2013')
|
1464 |
|
1465 | .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
|
1466 |
|
1467 | .replace(/'/g, '\u2019')
|
1468 |
|
1469 | .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
|
1470 |
|
1471 | .replace(/"/g, '\u201d')
|
1472 |
|
1473 | .replace(/\.{3}/g, '\u2026');
|
1474 | }
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 | function mangle(text) {
|
1481 | let out = '',
|
1482 | i,
|
1483 | ch;
|
1484 |
|
1485 | const l = text.length;
|
1486 | for (i = 0; i < l; i++) {
|
1487 | ch = text.charCodeAt(i);
|
1488 | if (Math.random() > 0.5) {
|
1489 | ch = 'x' + ch.toString(16);
|
1490 | }
|
1491 | out += '&#' + ch + ';';
|
1492 | }
|
1493 |
|
1494 | return out;
|
1495 | }
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 | class Lexer {
|
1501 | constructor(options) {
|
1502 | this.tokens = [];
|
1503 | this.tokens.links = Object.create(null);
|
1504 | this.options = options || defaults;
|
1505 | this.options.tokenizer = this.options.tokenizer || new Tokenizer();
|
1506 | this.tokenizer = this.options.tokenizer;
|
1507 | this.tokenizer.options = this.options;
|
1508 | this.tokenizer.lexer = this;
|
1509 | this.inlineQueue = [];
|
1510 | this.state = {
|
1511 | inLink: false,
|
1512 | inRawBlock: false,
|
1513 | top: true
|
1514 | };
|
1515 |
|
1516 | const rules = {
|
1517 | block: block.normal,
|
1518 | inline: inline.normal
|
1519 | };
|
1520 |
|
1521 | if (this.options.pedantic) {
|
1522 | rules.block = block.pedantic;
|
1523 | rules.inline = inline.pedantic;
|
1524 | } else if (this.options.gfm) {
|
1525 | rules.block = block.gfm;
|
1526 | if (this.options.breaks) {
|
1527 | rules.inline = inline.breaks;
|
1528 | } else {
|
1529 | rules.inline = inline.gfm;
|
1530 | }
|
1531 | }
|
1532 | this.tokenizer.rules = rules;
|
1533 | }
|
1534 |
|
1535 | |
1536 |
|
1537 |
|
1538 | static get rules() {
|
1539 | return {
|
1540 | block,
|
1541 | inline
|
1542 | };
|
1543 | }
|
1544 |
|
1545 | |
1546 |
|
1547 |
|
1548 | static lex(src, options) {
|
1549 | const lexer = new Lexer(options);
|
1550 | return lexer.lex(src);
|
1551 | }
|
1552 |
|
1553 | |
1554 |
|
1555 |
|
1556 | static lexInline(src, options) {
|
1557 | const lexer = new Lexer(options);
|
1558 | return lexer.inlineTokens(src);
|
1559 | }
|
1560 |
|
1561 | |
1562 |
|
1563 |
|
1564 | lex(src) {
|
1565 | src = src
|
1566 | .replace(/\r\n|\r/g, '\n');
|
1567 |
|
1568 | this.blockTokens(src, this.tokens);
|
1569 |
|
1570 | let next;
|
1571 | while (next = this.inlineQueue.shift()) {
|
1572 | this.inlineTokens(next.src, next.tokens);
|
1573 | }
|
1574 |
|
1575 | return this.tokens;
|
1576 | }
|
1577 |
|
1578 | |
1579 |
|
1580 |
|
1581 | blockTokens(src, tokens = []) {
|
1582 | if (this.options.pedantic) {
|
1583 | src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
|
1584 | } else {
|
1585 | src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
1586 | return leading + ' '.repeat(tabs.length);
|
1587 | });
|
1588 | }
|
1589 |
|
1590 | let token, lastToken, cutSrc, lastParagraphClipped;
|
1591 |
|
1592 | while (src) {
|
1593 | if (this.options.extensions
|
1594 | && this.options.extensions.block
|
1595 | && this.options.extensions.block.some((extTokenizer) => {
|
1596 | if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
1597 | src = src.substring(token.raw.length);
|
1598 | tokens.push(token);
|
1599 | return true;
|
1600 | }
|
1601 | return false;
|
1602 | })) {
|
1603 | continue;
|
1604 | }
|
1605 |
|
1606 |
|
1607 | if (token = this.tokenizer.space(src)) {
|
1608 | src = src.substring(token.raw.length);
|
1609 | if (token.raw.length === 1 && tokens.length > 0) {
|
1610 |
|
1611 |
|
1612 | tokens[tokens.length - 1].raw += '\n';
|
1613 | } else {
|
1614 | tokens.push(token);
|
1615 | }
|
1616 | continue;
|
1617 | }
|
1618 |
|
1619 |
|
1620 | if (token = this.tokenizer.code(src)) {
|
1621 | src = src.substring(token.raw.length);
|
1622 | lastToken = tokens[tokens.length - 1];
|
1623 |
|
1624 | if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
1625 | lastToken.raw += '\n' + token.raw;
|
1626 | lastToken.text += '\n' + token.text;
|
1627 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1628 | } else {
|
1629 | tokens.push(token);
|
1630 | }
|
1631 | continue;
|
1632 | }
|
1633 |
|
1634 |
|
1635 | if (token = this.tokenizer.fences(src)) {
|
1636 | src = src.substring(token.raw.length);
|
1637 | tokens.push(token);
|
1638 | continue;
|
1639 | }
|
1640 |
|
1641 |
|
1642 | if (token = this.tokenizer.heading(src)) {
|
1643 | src = src.substring(token.raw.length);
|
1644 | tokens.push(token);
|
1645 | continue;
|
1646 | }
|
1647 |
|
1648 |
|
1649 | if (token = this.tokenizer.hr(src)) {
|
1650 | src = src.substring(token.raw.length);
|
1651 | tokens.push(token);
|
1652 | continue;
|
1653 | }
|
1654 |
|
1655 |
|
1656 | if (token = this.tokenizer.blockquote(src)) {
|
1657 | src = src.substring(token.raw.length);
|
1658 | tokens.push(token);
|
1659 | continue;
|
1660 | }
|
1661 |
|
1662 |
|
1663 | if (token = this.tokenizer.list(src)) {
|
1664 | src = src.substring(token.raw.length);
|
1665 | tokens.push(token);
|
1666 | continue;
|
1667 | }
|
1668 |
|
1669 |
|
1670 | if (token = this.tokenizer.html(src)) {
|
1671 | src = src.substring(token.raw.length);
|
1672 | tokens.push(token);
|
1673 | continue;
|
1674 | }
|
1675 |
|
1676 |
|
1677 | if (token = this.tokenizer.def(src)) {
|
1678 | src = src.substring(token.raw.length);
|
1679 | lastToken = tokens[tokens.length - 1];
|
1680 | if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
1681 | lastToken.raw += '\n' + token.raw;
|
1682 | lastToken.text += '\n' + token.raw;
|
1683 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1684 | } else if (!this.tokens.links[token.tag]) {
|
1685 | this.tokens.links[token.tag] = {
|
1686 | href: token.href,
|
1687 | title: token.title
|
1688 | };
|
1689 | }
|
1690 | continue;
|
1691 | }
|
1692 |
|
1693 |
|
1694 | if (token = this.tokenizer.table(src)) {
|
1695 | src = src.substring(token.raw.length);
|
1696 | tokens.push(token);
|
1697 | continue;
|
1698 | }
|
1699 |
|
1700 |
|
1701 | if (token = this.tokenizer.lheading(src)) {
|
1702 | src = src.substring(token.raw.length);
|
1703 | tokens.push(token);
|
1704 | continue;
|
1705 | }
|
1706 |
|
1707 |
|
1708 |
|
1709 | cutSrc = src;
|
1710 | if (this.options.extensions && this.options.extensions.startBlock) {
|
1711 | let startIndex = Infinity;
|
1712 | const tempSrc = src.slice(1);
|
1713 | let tempStart;
|
1714 | this.options.extensions.startBlock.forEach(function(getStartIndex) {
|
1715 | tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
1716 | if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); }
|
1717 | });
|
1718 | if (startIndex < Infinity && startIndex >= 0) {
|
1719 | cutSrc = src.substring(0, startIndex + 1);
|
1720 | }
|
1721 | }
|
1722 | if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
1723 | lastToken = tokens[tokens.length - 1];
|
1724 | if (lastParagraphClipped && lastToken.type === 'paragraph') {
|
1725 | lastToken.raw += '\n' + token.raw;
|
1726 | lastToken.text += '\n' + token.text;
|
1727 | this.inlineQueue.pop();
|
1728 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1729 | } else {
|
1730 | tokens.push(token);
|
1731 | }
|
1732 | lastParagraphClipped = (cutSrc.length !== src.length);
|
1733 | src = src.substring(token.raw.length);
|
1734 | continue;
|
1735 | }
|
1736 |
|
1737 |
|
1738 | if (token = this.tokenizer.text(src)) {
|
1739 | src = src.substring(token.raw.length);
|
1740 | lastToken = tokens[tokens.length - 1];
|
1741 | if (lastToken && lastToken.type === 'text') {
|
1742 | lastToken.raw += '\n' + token.raw;
|
1743 | lastToken.text += '\n' + token.text;
|
1744 | this.inlineQueue.pop();
|
1745 | this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
1746 | } else {
|
1747 | tokens.push(token);
|
1748 | }
|
1749 | continue;
|
1750 | }
|
1751 |
|
1752 | if (src) {
|
1753 | const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
1754 | if (this.options.silent) {
|
1755 | console.error(errMsg);
|
1756 | break;
|
1757 | } else {
|
1758 | throw new Error(errMsg);
|
1759 | }
|
1760 | }
|
1761 | }
|
1762 |
|
1763 | this.state.top = true;
|
1764 | return tokens;
|
1765 | }
|
1766 |
|
1767 | inline(src, tokens = []) {
|
1768 | this.inlineQueue.push({ src, tokens });
|
1769 | return tokens;
|
1770 | }
|
1771 |
|
1772 | |
1773 |
|
1774 |
|
1775 | inlineTokens(src, tokens = []) {
|
1776 | let token, lastToken, cutSrc;
|
1777 |
|
1778 |
|
1779 | let maskedSrc = src;
|
1780 | let match;
|
1781 | let keepPrevChar, prevChar;
|
1782 |
|
1783 |
|
1784 | if (this.tokens.links) {
|
1785 | const links = Object.keys(this.tokens.links);
|
1786 | if (links.length > 0) {
|
1787 | while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
1788 | if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
1789 | maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
1790 | }
|
1791 | }
|
1792 | }
|
1793 | }
|
1794 |
|
1795 | while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
1796 | maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
1797 | }
|
1798 |
|
1799 |
|
1800 | while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
|
1801 | maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
|
1802 | this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
|
1803 | }
|
1804 |
|
1805 | while (src) {
|
1806 | if (!keepPrevChar) {
|
1807 | prevChar = '';
|
1808 | }
|
1809 | keepPrevChar = false;
|
1810 |
|
1811 |
|
1812 | if (this.options.extensions
|
1813 | && this.options.extensions.inline
|
1814 | && this.options.extensions.inline.some((extTokenizer) => {
|
1815 | if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
1816 | src = src.substring(token.raw.length);
|
1817 | tokens.push(token);
|
1818 | return true;
|
1819 | }
|
1820 | return false;
|
1821 | })) {
|
1822 | continue;
|
1823 | }
|
1824 |
|
1825 |
|
1826 | if (token = this.tokenizer.escape(src)) {
|
1827 | src = src.substring(token.raw.length);
|
1828 | tokens.push(token);
|
1829 | continue;
|
1830 | }
|
1831 |
|
1832 |
|
1833 | if (token = this.tokenizer.tag(src)) {
|
1834 | src = src.substring(token.raw.length);
|
1835 | lastToken = tokens[tokens.length - 1];
|
1836 | if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
1837 | lastToken.raw += token.raw;
|
1838 | lastToken.text += token.text;
|
1839 | } else {
|
1840 | tokens.push(token);
|
1841 | }
|
1842 | continue;
|
1843 | }
|
1844 |
|
1845 |
|
1846 | if (token = this.tokenizer.link(src)) {
|
1847 | src = src.substring(token.raw.length);
|
1848 | tokens.push(token);
|
1849 | continue;
|
1850 | }
|
1851 |
|
1852 |
|
1853 | if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
1854 | src = src.substring(token.raw.length);
|
1855 | lastToken = tokens[tokens.length - 1];
|
1856 | if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
1857 | lastToken.raw += token.raw;
|
1858 | lastToken.text += token.text;
|
1859 | } else {
|
1860 | tokens.push(token);
|
1861 | }
|
1862 | continue;
|
1863 | }
|
1864 |
|
1865 |
|
1866 | if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
1867 | src = src.substring(token.raw.length);
|
1868 | tokens.push(token);
|
1869 | continue;
|
1870 | }
|
1871 |
|
1872 |
|
1873 | if (token = this.tokenizer.codespan(src)) {
|
1874 | src = src.substring(token.raw.length);
|
1875 | tokens.push(token);
|
1876 | continue;
|
1877 | }
|
1878 |
|
1879 |
|
1880 | if (token = this.tokenizer.br(src)) {
|
1881 | src = src.substring(token.raw.length);
|
1882 | tokens.push(token);
|
1883 | continue;
|
1884 | }
|
1885 |
|
1886 |
|
1887 | if (token = this.tokenizer.del(src)) {
|
1888 | src = src.substring(token.raw.length);
|
1889 | tokens.push(token);
|
1890 | continue;
|
1891 | }
|
1892 |
|
1893 |
|
1894 | if (token = this.tokenizer.autolink(src, mangle)) {
|
1895 | src = src.substring(token.raw.length);
|
1896 | tokens.push(token);
|
1897 | continue;
|
1898 | }
|
1899 |
|
1900 |
|
1901 | if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
|
1902 | src = src.substring(token.raw.length);
|
1903 | tokens.push(token);
|
1904 | continue;
|
1905 | }
|
1906 |
|
1907 |
|
1908 |
|
1909 | cutSrc = src;
|
1910 | if (this.options.extensions && this.options.extensions.startInline) {
|
1911 | let startIndex = Infinity;
|
1912 | const tempSrc = src.slice(1);
|
1913 | let tempStart;
|
1914 | this.options.extensions.startInline.forEach(function(getStartIndex) {
|
1915 | tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
1916 | if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); }
|
1917 | });
|
1918 | if (startIndex < Infinity && startIndex >= 0) {
|
1919 | cutSrc = src.substring(0, startIndex + 1);
|
1920 | }
|
1921 | }
|
1922 | if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
|
1923 | src = src.substring(token.raw.length);
|
1924 | if (token.raw.slice(-1) !== '_') {
|
1925 | prevChar = token.raw.slice(-1);
|
1926 | }
|
1927 | keepPrevChar = true;
|
1928 | lastToken = tokens[tokens.length - 1];
|
1929 | if (lastToken && lastToken.type === 'text') {
|
1930 | lastToken.raw += token.raw;
|
1931 | lastToken.text += token.text;
|
1932 | } else {
|
1933 | tokens.push(token);
|
1934 | }
|
1935 | continue;
|
1936 | }
|
1937 |
|
1938 | if (src) {
|
1939 | const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
1940 | if (this.options.silent) {
|
1941 | console.error(errMsg);
|
1942 | break;
|
1943 | } else {
|
1944 | throw new Error(errMsg);
|
1945 | }
|
1946 | }
|
1947 | }
|
1948 |
|
1949 | return tokens;
|
1950 | }
|
1951 | }
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 | class Renderer {
|
1957 | constructor(options) {
|
1958 | this.options = options || defaults;
|
1959 | }
|
1960 |
|
1961 | code(code, infostring, escaped) {
|
1962 | const lang = (infostring || '').match(/\S*/)[0];
|
1963 | if (this.options.highlight) {
|
1964 | const out = this.options.highlight(code, lang);
|
1965 | if (out != null && out !== code) {
|
1966 | escaped = true;
|
1967 | code = out;
|
1968 | }
|
1969 | }
|
1970 |
|
1971 | code = code.replace(/\n$/, '') + '\n';
|
1972 |
|
1973 | if (!lang) {
|
1974 | return '<pre><code>'
|
1975 | + (escaped ? code : marked_esm_escape(code, true))
|
1976 | + '</code></pre>\n';
|
1977 | }
|
1978 |
|
1979 | return '<pre><code class="'
|
1980 | + this.options.langPrefix
|
1981 | + marked_esm_escape(lang)
|
1982 | + '">'
|
1983 | + (escaped ? code : marked_esm_escape(code, true))
|
1984 | + '</code></pre>\n';
|
1985 | }
|
1986 |
|
1987 | |
1988 |
|
1989 |
|
1990 | blockquote(quote) {
|
1991 | return `<blockquote>\n${quote}</blockquote>\n`;
|
1992 | }
|
1993 |
|
1994 | html(html) {
|
1995 | return html;
|
1996 | }
|
1997 |
|
1998 | |
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 | heading(text, level, raw, slugger) {
|
2005 | if (this.options.headerIds) {
|
2006 | const id = this.options.headerPrefix + slugger.slug(raw);
|
2007 | return `<h${level} id="${id}">${text}</h${level}>\n`;
|
2008 | }
|
2009 |
|
2010 |
|
2011 | return `<h${level}>${text}</h${level}>\n`;
|
2012 | }
|
2013 |
|
2014 | hr() {
|
2015 | return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
|
2016 | }
|
2017 |
|
2018 | list(body, ordered, start) {
|
2019 | const type = ordered ? 'ol' : 'ul',
|
2020 | startatt = (ordered && start !== 1) ? (' start="' + start + '"') : '';
|
2021 | return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
|
2022 | }
|
2023 |
|
2024 | |
2025 |
|
2026 |
|
2027 | listitem(text) {
|
2028 | return `<li>${text}</li>\n`;
|
2029 | }
|
2030 |
|
2031 | checkbox(checked) {
|
2032 | return '<input '
|
2033 | + (checked ? 'checked="" ' : '')
|
2034 | + 'disabled="" type="checkbox"'
|
2035 | + (this.options.xhtml ? ' /' : '')
|
2036 | + '> ';
|
2037 | }
|
2038 |
|
2039 | |
2040 |
|
2041 |
|
2042 | paragraph(text) {
|
2043 | return `<p>${text}</p>\n`;
|
2044 | }
|
2045 |
|
2046 | |
2047 |
|
2048 |
|
2049 |
|
2050 | table(header, body) {
|
2051 | if (body) body = `<tbody>${body}</tbody>`;
|
2052 |
|
2053 | return '<table>\n'
|
2054 | + '<thead>\n'
|
2055 | + header
|
2056 | + '</thead>\n'
|
2057 | + body
|
2058 | + '</table>\n';
|
2059 | }
|
2060 |
|
2061 | |
2062 |
|
2063 |
|
2064 | tablerow(content) {
|
2065 | return `<tr>\n${content}</tr>\n`;
|
2066 | }
|
2067 |
|
2068 | tablecell(content, flags) {
|
2069 | const type = flags.header ? 'th' : 'td';
|
2070 | const tag = flags.align
|
2071 | ? `<${type} align="${flags.align}">`
|
2072 | : `<${type}>`;
|
2073 | return tag + content + `</${type}>\n`;
|
2074 | }
|
2075 |
|
2076 | |
2077 |
|
2078 |
|
2079 |
|
2080 | strong(text) {
|
2081 | return `<strong>${text}</strong>`;
|
2082 | }
|
2083 |
|
2084 | |
2085 |
|
2086 |
|
2087 | em(text) {
|
2088 | return `<em>${text}</em>`;
|
2089 | }
|
2090 |
|
2091 | |
2092 |
|
2093 |
|
2094 | codespan(text) {
|
2095 | return `<code>${text}</code>`;
|
2096 | }
|
2097 |
|
2098 | br() {
|
2099 | return this.options.xhtml ? '<br/>' : '<br>';
|
2100 | }
|
2101 |
|
2102 | |
2103 |
|
2104 |
|
2105 | del(text) {
|
2106 | return `<del>${text}</del>`;
|
2107 | }
|
2108 |
|
2109 | |
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 | link(href, title, text) {
|
2115 | href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
2116 | if (href === null) {
|
2117 | return text;
|
2118 | }
|
2119 | let out = '<a href="' + href + '"';
|
2120 | if (title) {
|
2121 | out += ' title="' + title + '"';
|
2122 | }
|
2123 | out += '>' + text + '</a>';
|
2124 | return out;
|
2125 | }
|
2126 |
|
2127 | |
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 | image(href, title, text) {
|
2133 | href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
2134 | if (href === null) {
|
2135 | return text;
|
2136 | }
|
2137 |
|
2138 | let out = `<img src="${href}" alt="${text}"`;
|
2139 | if (title) {
|
2140 | out += ` title="${title}"`;
|
2141 | }
|
2142 | out += this.options.xhtml ? '/>' : '>';
|
2143 | return out;
|
2144 | }
|
2145 |
|
2146 | text(text) {
|
2147 | return text;
|
2148 | }
|
2149 | }
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 | class TextRenderer {
|
2156 |
|
2157 | strong(text) {
|
2158 | return text;
|
2159 | }
|
2160 |
|
2161 | em(text) {
|
2162 | return text;
|
2163 | }
|
2164 |
|
2165 | codespan(text) {
|
2166 | return text;
|
2167 | }
|
2168 |
|
2169 | del(text) {
|
2170 | return text;
|
2171 | }
|
2172 |
|
2173 | html(text) {
|
2174 | return text;
|
2175 | }
|
2176 |
|
2177 | text(text) {
|
2178 | return text;
|
2179 | }
|
2180 |
|
2181 | link(href, title, text) {
|
2182 | return '' + text;
|
2183 | }
|
2184 |
|
2185 | image(href, title, text) {
|
2186 | return '' + text;
|
2187 | }
|
2188 |
|
2189 | br() {
|
2190 | return '';
|
2191 | }
|
2192 | }
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 | class Slugger {
|
2198 | constructor() {
|
2199 | this.seen = {};
|
2200 | }
|
2201 |
|
2202 | |
2203 |
|
2204 |
|
2205 | serialize(value) {
|
2206 | return value
|
2207 | .toLowerCase()
|
2208 | .trim()
|
2209 |
|
2210 | .replace(/<[!\/a-z].*?>/ig, '')
|
2211 |
|
2212 | .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
2213 | .replace(/\s/g, '-');
|
2214 | }
|
2215 |
|
2216 | |
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 | getNextSafeSlug(originalSlug, isDryRun) {
|
2222 | let slug = originalSlug;
|
2223 | let occurenceAccumulator = 0;
|
2224 | if (this.seen.hasOwnProperty(slug)) {
|
2225 | occurenceAccumulator = this.seen[originalSlug];
|
2226 | do {
|
2227 | occurenceAccumulator++;
|
2228 | slug = originalSlug + '-' + occurenceAccumulator;
|
2229 | } while (this.seen.hasOwnProperty(slug));
|
2230 | }
|
2231 | if (!isDryRun) {
|
2232 | this.seen[originalSlug] = occurenceAccumulator;
|
2233 | this.seen[slug] = 0;
|
2234 | }
|
2235 | return slug;
|
2236 | }
|
2237 |
|
2238 | |
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 |
|
2244 | slug(value, options = {}) {
|
2245 | const slug = this.serialize(value);
|
2246 | return this.getNextSafeSlug(slug, options.dryrun);
|
2247 | }
|
2248 | }
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 | class Parser {
|
2254 | constructor(options) {
|
2255 | this.options = options || defaults;
|
2256 | this.options.renderer = this.options.renderer || new Renderer();
|
2257 | this.renderer = this.options.renderer;
|
2258 | this.renderer.options = this.options;
|
2259 | this.textRenderer = new TextRenderer();
|
2260 | this.slugger = new Slugger();
|
2261 | }
|
2262 |
|
2263 | |
2264 |
|
2265 |
|
2266 | static parse(tokens, options) {
|
2267 | const parser = new Parser(options);
|
2268 | return parser.parse(tokens);
|
2269 | }
|
2270 |
|
2271 | |
2272 |
|
2273 |
|
2274 | static parseInline(tokens, options) {
|
2275 | const parser = new Parser(options);
|
2276 | return parser.parseInline(tokens);
|
2277 | }
|
2278 |
|
2279 | |
2280 |
|
2281 |
|
2282 | parse(tokens, top = true) {
|
2283 | let out = '',
|
2284 | i,
|
2285 | j,
|
2286 | k,
|
2287 | l2,
|
2288 | l3,
|
2289 | row,
|
2290 | cell,
|
2291 | header,
|
2292 | body,
|
2293 | token,
|
2294 | ordered,
|
2295 | start,
|
2296 | loose,
|
2297 | itemBody,
|
2298 | item,
|
2299 | checked,
|
2300 | task,
|
2301 | checkbox,
|
2302 | ret;
|
2303 |
|
2304 | const l = tokens.length;
|
2305 | for (i = 0; i < l; i++) {
|
2306 | token = tokens[i];
|
2307 |
|
2308 |
|
2309 | if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
2310 | ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
|
2311 | if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
|
2312 | out += ret || '';
|
2313 | continue;
|
2314 | }
|
2315 | }
|
2316 |
|
2317 | switch (token.type) {
|
2318 | case 'space': {
|
2319 | continue;
|
2320 | }
|
2321 | case 'hr': {
|
2322 | out += this.renderer.hr();
|
2323 | continue;
|
2324 | }
|
2325 | case 'heading': {
|
2326 | out += this.renderer.heading(
|
2327 | this.parseInline(token.tokens),
|
2328 | token.depth,
|
2329 | marked_esm_unescape(this.parseInline(token.tokens, this.textRenderer)),
|
2330 | this.slugger);
|
2331 | continue;
|
2332 | }
|
2333 | case 'code': {
|
2334 | out += this.renderer.code(token.text,
|
2335 | token.lang,
|
2336 | token.escaped);
|
2337 | continue;
|
2338 | }
|
2339 | case 'table': {
|
2340 | header = '';
|
2341 |
|
2342 |
|
2343 | cell = '';
|
2344 | l2 = token.header.length;
|
2345 | for (j = 0; j < l2; j++) {
|
2346 | cell += this.renderer.tablecell(
|
2347 | this.parseInline(token.header[j].tokens),
|
2348 | { header: true, align: token.align[j] }
|
2349 | );
|
2350 | }
|
2351 | header += this.renderer.tablerow(cell);
|
2352 |
|
2353 | body = '';
|
2354 | l2 = token.rows.length;
|
2355 | for (j = 0; j < l2; j++) {
|
2356 | row = token.rows[j];
|
2357 |
|
2358 | cell = '';
|
2359 | l3 = row.length;
|
2360 | for (k = 0; k < l3; k++) {
|
2361 | cell += this.renderer.tablecell(
|
2362 | this.parseInline(row[k].tokens),
|
2363 | { header: false, align: token.align[k] }
|
2364 | );
|
2365 | }
|
2366 |
|
2367 | body += this.renderer.tablerow(cell);
|
2368 | }
|
2369 | out += this.renderer.table(header, body);
|
2370 | continue;
|
2371 | }
|
2372 | case 'blockquote': {
|
2373 | body = this.parse(token.tokens);
|
2374 | out += this.renderer.blockquote(body);
|
2375 | continue;
|
2376 | }
|
2377 | case 'list': {
|
2378 | ordered = token.ordered;
|
2379 | start = token.start;
|
2380 | loose = token.loose;
|
2381 | l2 = token.items.length;
|
2382 |
|
2383 | body = '';
|
2384 | for (j = 0; j < l2; j++) {
|
2385 | item = token.items[j];
|
2386 | checked = item.checked;
|
2387 | task = item.task;
|
2388 |
|
2389 | itemBody = '';
|
2390 | if (item.task) {
|
2391 | checkbox = this.renderer.checkbox(checked);
|
2392 | if (loose) {
|
2393 | if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
|
2394 | item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
2395 | if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
2396 | item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
2397 | }
|
2398 | } else {
|
2399 | item.tokens.unshift({
|
2400 | type: 'text',
|
2401 | text: checkbox
|
2402 | });
|
2403 | }
|
2404 | } else {
|
2405 | itemBody += checkbox;
|
2406 | }
|
2407 | }
|
2408 |
|
2409 | itemBody += this.parse(item.tokens, loose);
|
2410 | body += this.renderer.listitem(itemBody, task, checked);
|
2411 | }
|
2412 |
|
2413 | out += this.renderer.list(body, ordered, start);
|
2414 | continue;
|
2415 | }
|
2416 | case 'html': {
|
2417 |
|
2418 | out += this.renderer.html(token.text);
|
2419 | continue;
|
2420 | }
|
2421 | case 'paragraph': {
|
2422 | out += this.renderer.paragraph(this.parseInline(token.tokens));
|
2423 | continue;
|
2424 | }
|
2425 | case 'text': {
|
2426 | body = token.tokens ? this.parseInline(token.tokens) : token.text;
|
2427 | while (i + 1 < l && tokens[i + 1].type === 'text') {
|
2428 | token = tokens[++i];
|
2429 | body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
|
2430 | }
|
2431 | out += top ? this.renderer.paragraph(body) : body;
|
2432 | continue;
|
2433 | }
|
2434 |
|
2435 | default: {
|
2436 | const errMsg = 'Token with "' + token.type + '" type was not found.';
|
2437 | if (this.options.silent) {
|
2438 | console.error(errMsg);
|
2439 | return;
|
2440 | } else {
|
2441 | throw new Error(errMsg);
|
2442 | }
|
2443 | }
|
2444 | }
|
2445 | }
|
2446 |
|
2447 | return out;
|
2448 | }
|
2449 |
|
2450 | |
2451 |
|
2452 |
|
2453 | parseInline(tokens, renderer) {
|
2454 | renderer = renderer || this.renderer;
|
2455 | let out = '',
|
2456 | i,
|
2457 | token,
|
2458 | ret;
|
2459 |
|
2460 | const l = tokens.length;
|
2461 | for (i = 0; i < l; i++) {
|
2462 | token = tokens[i];
|
2463 |
|
2464 |
|
2465 | if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
2466 | ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
|
2467 | if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
|
2468 | out += ret || '';
|
2469 | continue;
|
2470 | }
|
2471 | }
|
2472 |
|
2473 | switch (token.type) {
|
2474 | case 'escape': {
|
2475 | out += renderer.text(token.text);
|
2476 | break;
|
2477 | }
|
2478 | case 'html': {
|
2479 | out += renderer.html(token.text);
|
2480 | break;
|
2481 | }
|
2482 | case 'link': {
|
2483 | out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
|
2484 | break;
|
2485 | }
|
2486 | case 'image': {
|
2487 | out += renderer.image(token.href, token.title, token.text);
|
2488 | break;
|
2489 | }
|
2490 | case 'strong': {
|
2491 | out += renderer.strong(this.parseInline(token.tokens, renderer));
|
2492 | break;
|
2493 | }
|
2494 | case 'em': {
|
2495 | out += renderer.em(this.parseInline(token.tokens, renderer));
|
2496 | break;
|
2497 | }
|
2498 | case 'codespan': {
|
2499 | out += renderer.codespan(token.text);
|
2500 | break;
|
2501 | }
|
2502 | case 'br': {
|
2503 | out += renderer.br();
|
2504 | break;
|
2505 | }
|
2506 | case 'del': {
|
2507 | out += renderer.del(this.parseInline(token.tokens, renderer));
|
2508 | break;
|
2509 | }
|
2510 | case 'text': {
|
2511 | out += renderer.text(token.text);
|
2512 | break;
|
2513 | }
|
2514 | default: {
|
2515 | const errMsg = 'Token with "' + token.type + '" type was not found.';
|
2516 | if (this.options.silent) {
|
2517 | console.error(errMsg);
|
2518 | return;
|
2519 | } else {
|
2520 | throw new Error(errMsg);
|
2521 | }
|
2522 | }
|
2523 | }
|
2524 | }
|
2525 | return out;
|
2526 | }
|
2527 | }
|
2528 |
|
2529 | class Hooks {
|
2530 | constructor(options) {
|
2531 | this.options = options || defaults;
|
2532 | }
|
2533 |
|
2534 | static passThroughHooks = new Set([
|
2535 | 'preprocess',
|
2536 | 'postprocess'
|
2537 | ]);
|
2538 |
|
2539 | |
2540 |
|
2541 |
|
2542 | preprocess(markdown) {
|
2543 | return markdown;
|
2544 | }
|
2545 |
|
2546 | |
2547 |
|
2548 |
|
2549 | postprocess(html) {
|
2550 | return html;
|
2551 | }
|
2552 | }
|
2553 |
|
2554 | function onError(silent, async, callback) {
|
2555 | return (e) => {
|
2556 | e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
2557 |
|
2558 | if (silent) {
|
2559 | const msg = '<p>An error occurred:</p><pre>'
|
2560 | + marked_esm_escape(e.message + '', true)
|
2561 | + '</pre>';
|
2562 | if (async) {
|
2563 | return Promise.resolve(msg);
|
2564 | }
|
2565 | if (callback) {
|
2566 | callback(null, msg);
|
2567 | return;
|
2568 | }
|
2569 | return msg;
|
2570 | }
|
2571 |
|
2572 | if (async) {
|
2573 | return Promise.reject(e);
|
2574 | }
|
2575 | if (callback) {
|
2576 | callback(e);
|
2577 | return;
|
2578 | }
|
2579 | throw e;
|
2580 | };
|
2581 | }
|
2582 |
|
2583 | function parseMarkdown(lexer, parser) {
|
2584 | return (src, opt, callback) => {
|
2585 | if (typeof opt === 'function') {
|
2586 | callback = opt;
|
2587 | opt = null;
|
2588 | }
|
2589 |
|
2590 | const origOpt = { ...opt };
|
2591 | opt = { ...marked.defaults, ...origOpt };
|
2592 | const throwError = onError(opt.silent, opt.async, callback);
|
2593 |
|
2594 |
|
2595 | if (typeof src === 'undefined' || src === null) {
|
2596 | return throwError(new Error('marked(): input parameter is undefined or null'));
|
2597 | }
|
2598 | if (typeof src !== 'string') {
|
2599 | return throwError(new Error('marked(): input parameter is of type '
|
2600 | + Object.prototype.toString.call(src) + ', string expected'));
|
2601 | }
|
2602 |
|
2603 | checkSanitizeDeprecation(opt);
|
2604 |
|
2605 | if (opt.hooks) {
|
2606 | opt.hooks.options = opt;
|
2607 | }
|
2608 |
|
2609 | if (callback) {
|
2610 | const highlight = opt.highlight;
|
2611 | let tokens;
|
2612 |
|
2613 | try {
|
2614 | if (opt.hooks) {
|
2615 | src = opt.hooks.preprocess(src);
|
2616 | }
|
2617 | tokens = lexer(src, opt);
|
2618 | } catch (e) {
|
2619 | return throwError(e);
|
2620 | }
|
2621 |
|
2622 | const done = function(err) {
|
2623 | let out;
|
2624 |
|
2625 | if (!err) {
|
2626 | try {
|
2627 | if (opt.walkTokens) {
|
2628 | marked.walkTokens(tokens, opt.walkTokens);
|
2629 | }
|
2630 | out = parser(tokens, opt);
|
2631 | if (opt.hooks) {
|
2632 | out = opt.hooks.postprocess(out);
|
2633 | }
|
2634 | } catch (e) {
|
2635 | err = e;
|
2636 | }
|
2637 | }
|
2638 |
|
2639 | opt.highlight = highlight;
|
2640 |
|
2641 | return err
|
2642 | ? throwError(err)
|
2643 | : callback(null, out);
|
2644 | };
|
2645 |
|
2646 | if (!highlight || highlight.length < 3) {
|
2647 | return done();
|
2648 | }
|
2649 |
|
2650 | delete opt.highlight;
|
2651 |
|
2652 | if (!tokens.length) return done();
|
2653 |
|
2654 | let pending = 0;
|
2655 | marked.walkTokens(tokens, function(token) {
|
2656 | if (token.type === 'code') {
|
2657 | pending++;
|
2658 | setTimeout(() => {
|
2659 | highlight(token.text, token.lang, function(err, code) {
|
2660 | if (err) {
|
2661 | return done(err);
|
2662 | }
|
2663 | if (code != null && code !== token.text) {
|
2664 | token.text = code;
|
2665 | token.escaped = true;
|
2666 | }
|
2667 |
|
2668 | pending--;
|
2669 | if (pending === 0) {
|
2670 | done();
|
2671 | }
|
2672 | });
|
2673 | }, 0);
|
2674 | }
|
2675 | });
|
2676 |
|
2677 | if (pending === 0) {
|
2678 | done();
|
2679 | }
|
2680 |
|
2681 | return;
|
2682 | }
|
2683 |
|
2684 | if (opt.async) {
|
2685 | return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)
|
2686 | .then(src => lexer(src, opt))
|
2687 | .then(tokens => opt.walkTokens ? Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens)
|
2688 | .then(tokens => parser(tokens, opt))
|
2689 | .then(html => opt.hooks ? opt.hooks.postprocess(html) : html)
|
2690 | .catch(throwError);
|
2691 | }
|
2692 |
|
2693 | try {
|
2694 | if (opt.hooks) {
|
2695 | src = opt.hooks.preprocess(src);
|
2696 | }
|
2697 | const tokens = lexer(src, opt);
|
2698 | if (opt.walkTokens) {
|
2699 | marked.walkTokens(tokens, opt.walkTokens);
|
2700 | }
|
2701 | let html = parser(tokens, opt);
|
2702 | if (opt.hooks) {
|
2703 | html = opt.hooks.postprocess(html);
|
2704 | }
|
2705 | return html;
|
2706 | } catch (e) {
|
2707 | return throwError(e);
|
2708 | }
|
2709 | };
|
2710 | }
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 | function marked(src, opt, callback) {
|
2716 | return parseMarkdown(Lexer.lex, Parser.parse)(src, opt, callback);
|
2717 | }
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 | marked.options =
|
2724 | marked.setOptions = function(opt) {
|
2725 | marked.defaults = { ...marked.defaults, ...opt };
|
2726 | changeDefaults(marked.defaults);
|
2727 | return marked;
|
2728 | };
|
2729 |
|
2730 | marked.getDefaults = getDefaults;
|
2731 |
|
2732 | marked.defaults = defaults;
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 | marked.use = function(...args) {
|
2739 | const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
|
2740 |
|
2741 | args.forEach((pack) => {
|
2742 |
|
2743 | const opts = { ...pack };
|
2744 |
|
2745 |
|
2746 | opts.async = marked.defaults.async || opts.async || false;
|
2747 |
|
2748 |
|
2749 | if (pack.extensions) {
|
2750 | pack.extensions.forEach((ext) => {
|
2751 | if (!ext.name) {
|
2752 | throw new Error('extension name required');
|
2753 | }
|
2754 | if (ext.renderer) {
|
2755 | const prevRenderer = extensions.renderers[ext.name];
|
2756 | if (prevRenderer) {
|
2757 |
|
2758 | extensions.renderers[ext.name] = function(...args) {
|
2759 | let ret = ext.renderer.apply(this, args);
|
2760 | if (ret === false) {
|
2761 | ret = prevRenderer.apply(this, args);
|
2762 | }
|
2763 | return ret;
|
2764 | };
|
2765 | } else {
|
2766 | extensions.renderers[ext.name] = ext.renderer;
|
2767 | }
|
2768 | }
|
2769 | if (ext.tokenizer) {
|
2770 | if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {
|
2771 | throw new Error("extension level must be 'block' or 'inline'");
|
2772 | }
|
2773 | if (extensions[ext.level]) {
|
2774 | extensions[ext.level].unshift(ext.tokenizer);
|
2775 | } else {
|
2776 | extensions[ext.level] = [ext.tokenizer];
|
2777 | }
|
2778 | if (ext.start) {
|
2779 | if (ext.level === 'block') {
|
2780 | if (extensions.startBlock) {
|
2781 | extensions.startBlock.push(ext.start);
|
2782 | } else {
|
2783 | extensions.startBlock = [ext.start];
|
2784 | }
|
2785 | } else if (ext.level === 'inline') {
|
2786 | if (extensions.startInline) {
|
2787 | extensions.startInline.push(ext.start);
|
2788 | } else {
|
2789 | extensions.startInline = [ext.start];
|
2790 | }
|
2791 | }
|
2792 | }
|
2793 | }
|
2794 | if (ext.childTokens) {
|
2795 | extensions.childTokens[ext.name] = ext.childTokens;
|
2796 | }
|
2797 | });
|
2798 | opts.extensions = extensions;
|
2799 | }
|
2800 |
|
2801 |
|
2802 | if (pack.renderer) {
|
2803 | const renderer = marked.defaults.renderer || new Renderer();
|
2804 | for (const prop in pack.renderer) {
|
2805 | const prevRenderer = renderer[prop];
|
2806 |
|
2807 | renderer[prop] = (...args) => {
|
2808 | let ret = pack.renderer[prop].apply(renderer, args);
|
2809 | if (ret === false) {
|
2810 | ret = prevRenderer.apply(renderer, args);
|
2811 | }
|
2812 | return ret;
|
2813 | };
|
2814 | }
|
2815 | opts.renderer = renderer;
|
2816 | }
|
2817 | if (pack.tokenizer) {
|
2818 | const tokenizer = marked.defaults.tokenizer || new Tokenizer();
|
2819 | for (const prop in pack.tokenizer) {
|
2820 | const prevTokenizer = tokenizer[prop];
|
2821 |
|
2822 | tokenizer[prop] = (...args) => {
|
2823 | let ret = pack.tokenizer[prop].apply(tokenizer, args);
|
2824 | if (ret === false) {
|
2825 | ret = prevTokenizer.apply(tokenizer, args);
|
2826 | }
|
2827 | return ret;
|
2828 | };
|
2829 | }
|
2830 | opts.tokenizer = tokenizer;
|
2831 | }
|
2832 |
|
2833 |
|
2834 | if (pack.hooks) {
|
2835 | const hooks = marked.defaults.hooks || new Hooks();
|
2836 | for (const prop in pack.hooks) {
|
2837 | const prevHook = hooks[prop];
|
2838 | if (Hooks.passThroughHooks.has(prop)) {
|
2839 | hooks[prop] = (arg) => {
|
2840 | if (marked.defaults.async) {
|
2841 | return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then(ret => {
|
2842 | return prevHook.call(hooks, ret);
|
2843 | });
|
2844 | }
|
2845 |
|
2846 | const ret = pack.hooks[prop].call(hooks, arg);
|
2847 | return prevHook.call(hooks, ret);
|
2848 | };
|
2849 | } else {
|
2850 | hooks[prop] = (...args) => {
|
2851 | let ret = pack.hooks[prop].apply(hooks, args);
|
2852 | if (ret === false) {
|
2853 | ret = prevHook.apply(hooks, args);
|
2854 | }
|
2855 | return ret;
|
2856 | };
|
2857 | }
|
2858 | }
|
2859 | opts.hooks = hooks;
|
2860 | }
|
2861 |
|
2862 |
|
2863 | if (pack.walkTokens) {
|
2864 | const walkTokens = marked.defaults.walkTokens;
|
2865 | opts.walkTokens = function(token) {
|
2866 | let values = [];
|
2867 | values.push(pack.walkTokens.call(this, token));
|
2868 | if (walkTokens) {
|
2869 | values = values.concat(walkTokens.call(this, token));
|
2870 | }
|
2871 | return values;
|
2872 | };
|
2873 | }
|
2874 |
|
2875 | marked.setOptions(opts);
|
2876 | });
|
2877 | };
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 | marked.walkTokens = function(tokens, callback) {
|
2884 | let values = [];
|
2885 | for (const token of tokens) {
|
2886 | values = values.concat(callback.call(marked, token));
|
2887 | switch (token.type) {
|
2888 | case 'table': {
|
2889 | for (const cell of token.header) {
|
2890 | values = values.concat(marked.walkTokens(cell.tokens, callback));
|
2891 | }
|
2892 | for (const row of token.rows) {
|
2893 | for (const cell of row) {
|
2894 | values = values.concat(marked.walkTokens(cell.tokens, callback));
|
2895 | }
|
2896 | }
|
2897 | break;
|
2898 | }
|
2899 | case 'list': {
|
2900 | values = values.concat(marked.walkTokens(token.items, callback));
|
2901 | break;
|
2902 | }
|
2903 | default: {
|
2904 | if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
|
2905 | marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
|
2906 | values = values.concat(marked.walkTokens(token[childTokens], callback));
|
2907 | });
|
2908 | } else if (token.tokens) {
|
2909 | values = values.concat(marked.walkTokens(token.tokens, callback));
|
2910 | }
|
2911 | }
|
2912 | }
|
2913 | }
|
2914 | return values;
|
2915 | };
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 | marked.parseInline = parseMarkdown(Lexer.lexInline, Parser.parseInline);
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 | marked.Parser = Parser;
|
2927 | marked.parser = Parser.parse;
|
2928 | marked.Renderer = Renderer;
|
2929 | marked.TextRenderer = TextRenderer;
|
2930 | marked.Lexer = Lexer;
|
2931 | marked.lexer = Lexer.lex;
|
2932 | marked.Tokenizer = Tokenizer;
|
2933 | marked.Slugger = Slugger;
|
2934 | marked.Hooks = Hooks;
|
2935 | marked.parse = marked;
|
2936 |
|
2937 | const options = marked.options;
|
2938 | const setOptions = marked.setOptions;
|
2939 | const use = marked.use;
|
2940 | const walkTokens = marked.walkTokens;
|
2941 | const parseInline = marked.parseInline;
|
2942 | const parse = ( null && (marked));
|
2943 | const parser = Parser.parse;
|
2944 | const lexer = Lexer.lex;
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 | var prism = __webpack_require__(848);
|
2950 | var prism_default = __webpack_require__.n(prism);
|
2951 |
|
2952 | var prism_css = __webpack_require__(113);
|
2953 |
|
2954 | var prism_yaml = __webpack_require__(83);
|
2955 |
|
2956 | var prism_go = __webpack_require__(378);
|
2957 |
|
2958 | var prism_java = __webpack_require__(976);
|
2959 |
|
2960 | var prism_json = __webpack_require__(514);
|
2961 |
|
2962 | var prism_bash = __webpack_require__(22);
|
2963 |
|
2964 | var prism_python = __webpack_require__(342);
|
2965 |
|
2966 | var prism_http = __webpack_require__(784);
|
2967 |
|
2968 | var prism_csharp = __webpack_require__(651);
|
2969 | ;
|
2970 |
|
2971 | const font_styles = (i`
|
2972 | .hover-bg:hover {
|
2973 | background: var(--bg3);
|
2974 | }
|
2975 | ::selection {
|
2976 | background: var(--selection-bg);
|
2977 | color: var(--selection-fg);
|
2978 | }
|
2979 | .regular-font {
|
2980 | font-family:var(--font-regular);
|
2981 | }
|
2982 | .mono-font {
|
2983 | font-family:var(--font-mono);
|
2984 | }
|
2985 | .title {
|
2986 | font-size: calc(var(--font-size-small) + 18px);
|
2987 | font-weight: normal
|
2988 | }
|
2989 | .sub-title{ font-size: 20px; }
|
2990 | .req-res-title {
|
2991 | font-family: var(--font-regular);
|
2992 | font-size: calc(var(--font-size-small) + 4px);
|
2993 | font-weight:bold;
|
2994 | margin-bottom:8px;
|
2995 | text-align:left;
|
2996 | }
|
2997 | .tiny-title {
|
2998 | font-size:calc(var(--font-size-small) + 1px);
|
2999 | font-weight:bold;
|
3000 | }
|
3001 | .regular-font-size { font-size: var(--font-size-regular); }
|
3002 | .small-font-size { font-size: var(--font-size-small); }
|
3003 | .upper { text-transform: uppercase; }
|
3004 | .primary-text { color: var(--primary-color); }
|
3005 | .bold-text { font-weight:bold; }
|
3006 | .gray-text { color: var(--light-fg); }
|
3007 | .red-text { color: var(--red) }
|
3008 | .blue-text { color: var(--blue) }
|
3009 | .multiline {
|
3010 | overflow: scroll;
|
3011 | max-height: var(--resp-area-height, 400px);
|
3012 | color: var(--fg3);
|
3013 | }
|
3014 | .method-fg.put { color: var(--orange); }
|
3015 | .method-fg.post { color: var(--green); }
|
3016 | .method-fg.get { color: var(--blue); }
|
3017 | .method-fg.delete { color: var(--red); }
|
3018 | .method-fg.options,
|
3019 | .method-fg.head,
|
3020 | .method-fg.patch {
|
3021 | color: var(--yellow);
|
3022 | }
|
3023 |
|
3024 | h1 { font-family:var(--font-regular); font-size:28px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
3025 | h2 { font-family:var(--font-regular); font-size:24px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
3026 | h3 { font-family:var(--font-regular); font-size:18px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
3027 | h4 { font-family:var(--font-regular); font-size:16px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
3028 | h5 { font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
3029 | h6 { font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
3030 |
|
3031 | h1,h2,h3,h4,h5,h5 {
|
3032 | margin-block-end: 0.2em;
|
3033 | }
|
3034 | p { margin-block-start: 0.5em; }
|
3035 | a { color: var(--blue); cursor:pointer; }
|
3036 | a.inactive-link {
|
3037 | color:var(--fg);
|
3038 | text-decoration: none;
|
3039 | cursor:text;
|
3040 | }
|
3041 |
|
3042 | code,
|
3043 | pre {
|
3044 | margin: 0px;
|
3045 | font-family: var(--font-mono);
|
3046 | font-size: calc(var(--font-size-mono) - 1px);
|
3047 | }
|
3048 |
|
3049 | .m-markdown,
|
3050 | .m-markdown-small {
|
3051 | display:block;
|
3052 | }
|
3053 |
|
3054 | .m-markdown p,
|
3055 | .m-markdown span {
|
3056 | font-size: var(--font-size-regular);
|
3057 | line-height:calc(var(--font-size-regular) + 8px);
|
3058 | }
|
3059 | .m-markdown li {
|
3060 | font-size: var(--font-size-regular);
|
3061 | line-height:calc(var(--font-size-regular) + 10px);
|
3062 | }
|
3063 |
|
3064 | .m-markdown-small p,
|
3065 | .m-markdown-small span,
|
3066 | .m-markdown-small li {
|
3067 | font-size: var(--font-size-small);
|
3068 | line-height: calc(var(--font-size-small) + 6px);
|
3069 | }
|
3070 | .m-markdown-small li {
|
3071 | line-height: calc(var(--font-size-small) + 8px);
|
3072 | }
|
3073 |
|
3074 | .m-markdown p:not(:first-child) {
|
3075 | margin-block-start: 24px;
|
3076 | }
|
3077 |
|
3078 | .m-markdown-small p:not(:first-child) {
|
3079 | margin-block-start: 12px;
|
3080 | }
|
3081 | .m-markdown-small p:first-child {
|
3082 | margin-block-start: 0;
|
3083 | }
|
3084 |
|
3085 | .m-markdown p,
|
3086 | .m-markdown-small p {
|
3087 | margin-block-end: 0
|
3088 | }
|
3089 |
|
3090 | .m-markdown code span {
|
3091 | font-size:var(--font-size-mono);
|
3092 | }
|
3093 |
|
3094 | .m-markdown-small code,
|
3095 | .m-markdown code {
|
3096 | padding: 1px 6px;
|
3097 | border-radius: 2px;
|
3098 | color: var(--inline-code-fg);
|
3099 | background-color: var(--bg3);
|
3100 | font-size: calc(var(--font-size-mono));
|
3101 | line-height: 1.2;
|
3102 | }
|
3103 |
|
3104 | .m-markdown-small code {
|
3105 | font-size: calc(var(--font-size-mono) - 1px);
|
3106 | }
|
3107 |
|
3108 | .m-markdown-small pre,
|
3109 | .m-markdown pre {
|
3110 | white-space: pre-wrap;
|
3111 | overflow-x: auto;
|
3112 | line-height: normal;
|
3113 | border-radius: 2px;
|
3114 | border: 1px solid var(--code-border-color);
|
3115 | }
|
3116 |
|
3117 | .m-markdown pre {
|
3118 | padding: 12px;
|
3119 | background-color: var(--code-bg);
|
3120 | color:var(--code-fg);
|
3121 | }
|
3122 |
|
3123 | .m-markdown-small pre {
|
3124 | margin-top: 4px;
|
3125 | padding: 2px 4px;
|
3126 | background-color: var(--bg3);
|
3127 | color: var(--fg2);
|
3128 | }
|
3129 |
|
3130 | .m-markdown-small pre code,
|
3131 | .m-markdown pre code {
|
3132 | border:none;
|
3133 | padding:0;
|
3134 | }
|
3135 |
|
3136 | .m-markdown pre code {
|
3137 | color: var(--code-fg);
|
3138 | background-color: var(--code-bg);
|
3139 | background-color: transparent;
|
3140 | }
|
3141 |
|
3142 | .m-markdown-small pre code {
|
3143 | color: var(--fg2);
|
3144 | background-color: var(--bg3);
|
3145 | }
|
3146 |
|
3147 | .m-markdown ul,
|
3148 | .m-markdown ol {
|
3149 | padding-inline-start: 30px;
|
3150 | }
|
3151 |
|
3152 | .m-markdown-small ul,
|
3153 | .m-markdown-small ol {
|
3154 | padding-inline-start: 20px;
|
3155 | }
|
3156 |
|
3157 | .m-markdown-small a,
|
3158 | .m-markdown a {
|
3159 | color:var(--blue);
|
3160 | }
|
3161 |
|
3162 | .m-markdown-small img,
|
3163 | .m-markdown img {
|
3164 | max-width: 100%;
|
3165 | }
|
3166 |
|
3167 | /* Markdown table */
|
3168 |
|
3169 | .m-markdown-small table,
|
3170 | .m-markdown table {
|
3171 | border-spacing: 0;
|
3172 | margin: 10px 0;
|
3173 | border-collapse: separate;
|
3174 | border: 1px solid var(--border-color);
|
3175 | border-radius: var(--border-radius);
|
3176 | font-size: calc(var(--font-size-small) + 1px);
|
3177 | line-height: calc(var(--font-size-small) + 4px);
|
3178 | max-width: 100%;
|
3179 | }
|
3180 |
|
3181 | .m-markdown-small table {
|
3182 | font-size: var(--font-size-small);
|
3183 | line-height: calc(var(--font-size-small) + 2px);
|
3184 | margin: 8px 0;
|
3185 | }
|
3186 |
|
3187 | .m-markdown-small td,
|
3188 | .m-markdown-small th,
|
3189 | .m-markdown td,
|
3190 | .m-markdown th {
|
3191 | vertical-align: top;
|
3192 | border-top: 1px solid var(--border-color);
|
3193 | line-height: calc(var(--font-size-small) + 4px);
|
3194 | }
|
3195 |
|
3196 | .m-markdown-small tr:first-child th,
|
3197 | .m-markdown tr:first-child th {
|
3198 | border-top: 0 none;
|
3199 | }
|
3200 |
|
3201 | .m-markdown th,
|
3202 | .m-markdown td {
|
3203 | padding: 10px 12px;
|
3204 | }
|
3205 |
|
3206 | .m-markdown-small th,
|
3207 | .m-markdown-small td {
|
3208 | padding: 8px 8px;
|
3209 | }
|
3210 |
|
3211 | .m-markdown th,
|
3212 | .m-markdown-small th {
|
3213 | font-weight: 600;
|
3214 | background-color: var(--bg2);
|
3215 | vertical-align: middle;
|
3216 | }
|
3217 |
|
3218 | .m-markdown-small table code {
|
3219 | font-size: calc(var(--font-size-mono) - 2px);
|
3220 | }
|
3221 |
|
3222 | .m-markdown table code {
|
3223 | font-size: calc(var(--font-size-mono) - 1px);
|
3224 | }
|
3225 |
|
3226 | .m-markdown blockquote,
|
3227 | .m-markdown-small blockquote {
|
3228 | margin-inline-start: 0;
|
3229 | margin-inline-end: 0;
|
3230 | border-left: 3px solid var(--border-color);
|
3231 | padding: 6px 0 6px 6px;
|
3232 | }
|
3233 | .m-markdown hr{
|
3234 | border: 1px solid var(--border-color);
|
3235 | }
|
3236 | `);
|
3237 | ;
|
3238 |
|
3239 |
|
3240 |
|
3241 | const input_styles = (i`
|
3242 | /* Button */
|
3243 | .m-btn {
|
3244 | border-radius: var(--border-radius);
|
3245 | font-weight: 600;
|
3246 | display: inline-block;
|
3247 | padding: 6px 16px;
|
3248 | font-size: var(--font-size-small);
|
3249 | outline: 0;
|
3250 | line-height: 1;
|
3251 | text-align: center;
|
3252 | white-space: nowrap;
|
3253 | border: 2px solid var(--primary-color);
|
3254 | background-color:transparent;
|
3255 | user-select: none;
|
3256 | cursor: pointer;
|
3257 | box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
3258 | transition-duration: 0.75s;
|
3259 | }
|
3260 | .m-btn.primary {
|
3261 | background-color: var(--primary-color);
|
3262 | color: var(--primary-color-invert);
|
3263 | }
|
3264 | .m-btn.thin-border { border-width: 1px; }
|
3265 | .m-btn.large { padding:8px 14px; }
|
3266 | .m-btn.small { padding:5px 12px; }
|
3267 | .m-btn.tiny { padding:5px 6px; }
|
3268 | .m-btn.circle { border-radius: 50%; }
|
3269 | .m-btn:hover {
|
3270 | background-color: var(--primary-color);
|
3271 | color: var(--primary-color-invert);
|
3272 | }
|
3273 | .m-btn.nav { border: 2px solid var(--nav-accent-color); }
|
3274 | .m-btn.nav:hover {
|
3275 | background-color: var(--nav-accent-color);
|
3276 | }
|
3277 | .m-btn:disabled {
|
3278 | background-color: var(--bg3);
|
3279 | color: var(--fg3);
|
3280 | border-color: var(--fg3);
|
3281 | cursor: not-allowed;
|
3282 | opacity: 0.4;
|
3283 | }
|
3284 | .m-btn:active {
|
3285 | filter: brightness(75%);
|
3286 | transform: scale(0.95);
|
3287 | transition:scale 0s;
|
3288 | }
|
3289 | .toolbar-btn {
|
3290 | cursor: pointer;
|
3291 | padding: 4px;
|
3292 | margin:0 2px;
|
3293 | font-size: var(--font-size-small);
|
3294 | min-width: 50px;
|
3295 | color: var(--primary-color-invert);
|
3296 | border-radius: 2px;
|
3297 | border: none;
|
3298 | background-color: var(--primary-color);
|
3299 | }
|
3300 |
|
3301 | input, textarea, select, button, pre {
|
3302 | color:var(--fg);
|
3303 | outline: none;
|
3304 | background-color: var(--input-bg);
|
3305 | border: 1px solid var(--border-color);
|
3306 | border-radius: var(--border-radius);
|
3307 | }
|
3308 | button {
|
3309 | font-family: var(--font-regular);
|
3310 | }
|
3311 |
|
3312 | /* Form Inputs */
|
3313 | pre,
|
3314 | select,
|
3315 | textarea,
|
3316 | input[type="file"],
|
3317 | input[type="text"],
|
3318 | input[type="password"] {
|
3319 | font-family: var(--font-mono);
|
3320 | font-weight: 400;
|
3321 | font-size: var(--font-size-small);
|
3322 | transition: border .2s;
|
3323 | padding: 6px 5px;
|
3324 | }
|
3325 |
|
3326 | select {
|
3327 | font-family: var(--font-regular);
|
3328 | padding: 5px 30px 5px 5px;
|
3329 | 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");
|
3330 | background-position: calc(100% - 5px) center;
|
3331 | background-repeat: no-repeat;
|
3332 | background-size: 10px;
|
3333 | -webkit-appearance: none;
|
3334 | -moz-appearance: none;
|
3335 | appearance: none;
|
3336 | cursor: pointer;
|
3337 | }
|
3338 |
|
3339 | select:hover {
|
3340 | border-color: var(--primary-color);
|
3341 | }
|
3342 |
|
3343 | textarea::placeholder,
|
3344 | input[type="text"]::placeholder,
|
3345 | input[type="password"]::placeholder {
|
3346 | color: var(--placeholder-color);
|
3347 | opacity:1;
|
3348 | }
|
3349 |
|
3350 |
|
3351 | input[type="file"]{
|
3352 | font-family: var(--font-regular);
|
3353 | padding:2px;
|
3354 | cursor:pointer;
|
3355 | border: 1px solid var(--primary-color);
|
3356 | min-height: calc(var(--font-size-small) + 18px);
|
3357 | }
|
3358 |
|
3359 | input[type="file"]::-webkit-file-upload-button {
|
3360 | font-family: var(--font-regular);
|
3361 | font-size: var(--font-size-small);
|
3362 | outline: none;
|
3363 | cursor:pointer;
|
3364 | padding: 3px 8px;
|
3365 | border: 1px solid var(--primary-color);
|
3366 | background-color: var(--primary-color);
|
3367 | color: var(--primary-color-invert);
|
3368 | border-radius: var(--border-radius);;
|
3369 | -webkit-appearance: none;
|
3370 | }
|
3371 |
|
3372 | pre,
|
3373 | textarea {
|
3374 | scrollbar-width: thin;
|
3375 | scrollbar-color: var(--border-color) var(--input-bg);
|
3376 | }
|
3377 |
|
3378 | pre::-webkit-scrollbar,
|
3379 | textarea::-webkit-scrollbar {
|
3380 | width: 8px;
|
3381 | height: 8px;
|
3382 | }
|
3383 |
|
3384 | pre::-webkit-scrollbar-track,
|
3385 | textarea::-webkit-scrollbar-track {
|
3386 | background:var(--input-bg);
|
3387 | }
|
3388 |
|
3389 | pre::-webkit-scrollbar-thumb,
|
3390 | textarea::-webkit-scrollbar-thumb {
|
3391 | border-radius: 2px;
|
3392 | background-color: var(--border-color);
|
3393 | }
|
3394 |
|
3395 | .link {
|
3396 | font-size:var(--font-size-small);
|
3397 | text-decoration: underline;
|
3398 | color:var(--blue);
|
3399 | font-family:var(--font-mono);
|
3400 | margin-bottom:2px;
|
3401 | }
|
3402 |
|
3403 | /* Toggle Body */
|
3404 | input[type="checkbox"] {
|
3405 | appearance: none;
|
3406 | display: inline-block;
|
3407 | background-color: var(--light-bg);
|
3408 | border: 1px solid var(--light-bg);
|
3409 | border-radius: 9px;
|
3410 | cursor: pointer;
|
3411 | height: 18px;
|
3412 | position: relative;
|
3413 | transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
|
3414 | min-width: 36px;
|
3415 | width: 36px;
|
3416 | vertical-align: top;
|
3417 | }
|
3418 | /* Toggle Thumb */
|
3419 | input[type="checkbox"]:after {
|
3420 | position: absolute;
|
3421 | background-color: var(--bg);
|
3422 | border: 1px solid var(--light-bg);
|
3423 | border-radius: 8px;
|
3424 | content: '';
|
3425 | top: 0px;
|
3426 | left: 0px;
|
3427 | right: 16px;
|
3428 | display: block;
|
3429 | height: 16px;
|
3430 | transition: border .25s .15s, left .25s .1s, right .15s .175s;
|
3431 | }
|
3432 |
|
3433 | /* Toggle Body - Checked */
|
3434 | input[type="checkbox"]:checked {
|
3435 | background-color: var(--green);
|
3436 | border-color: var(--green);
|
3437 | }
|
3438 | /* Toggle Thumb - Checked*/
|
3439 | input[type="checkbox"]:checked:after {
|
3440 | border: 1px solid var(--green);
|
3441 | left: 16px;
|
3442 | right: 1px;
|
3443 | transition: border .25s, left .15s .25s, right .25s .175s;
|
3444 | }`);
|
3445 | ;
|
3446 |
|
3447 | const flex_styles = (i`
|
3448 | .row, .col {
|
3449 | display:flex;
|
3450 | }
|
3451 | .row {
|
3452 | align-items:center;
|
3453 | flex-direction: row;
|
3454 | }
|
3455 | .col {
|
3456 | align-items:stretch;
|
3457 | flex-direction: column;
|
3458 | }
|
3459 | `);
|
3460 | ;
|
3461 |
|
3462 | const table_styles = (i`
|
3463 | .m-table {
|
3464 | border-spacing: 0;
|
3465 | border-collapse: separate;
|
3466 | border: 1px solid var(--light-border-color);
|
3467 | border-radius: var(--border-radius);
|
3468 | margin: 0;
|
3469 | max-width: 100%;
|
3470 | direction: ltr;
|
3471 | }
|
3472 | .m-table tr:first-child td,
|
3473 | .m-table tr:first-child th {
|
3474 | border-top: 0 none;
|
3475 | }
|
3476 | .m-table td,
|
3477 | .m-table th {
|
3478 | font-size: var(--font-size-small);
|
3479 | line-height: calc(var(--font-size-small) + 4px);
|
3480 | padding: 4px 5px 4px;
|
3481 | vertical-align: top;
|
3482 | }
|
3483 |
|
3484 | .m-table.padded-12 td,
|
3485 | .m-table.padded-12 th {
|
3486 | padding: 12px;
|
3487 | }
|
3488 |
|
3489 | .m-table td:not([align]),
|
3490 | .m-table th:not([align]) {
|
3491 | text-align: left;
|
3492 | }
|
3493 |
|
3494 | .m-table th {
|
3495 | color: var(--fg2);
|
3496 | font-size: var(--font-size-small);
|
3497 | line-height: calc(var(--font-size-small) + 18px);
|
3498 | font-weight: 600;
|
3499 | letter-spacing: normal;
|
3500 | background-color: var(--bg2);
|
3501 | vertical-align: bottom;
|
3502 | border-bottom: 1px solid var(--light-border-color);
|
3503 | }
|
3504 |
|
3505 | .m-table > tbody > tr > td,
|
3506 | .m-table > tr > td {
|
3507 | border-top: 1px solid var(--light-border-color);
|
3508 | text-overflow: ellipsis;
|
3509 | overflow: hidden;
|
3510 | }
|
3511 | .table-title {
|
3512 | font-size:var(--font-size-small);
|
3513 | font-weight:bold;
|
3514 | vertical-align: middle;
|
3515 | margin: 12px 0 4px 0;
|
3516 | }
|
3517 | `);
|
3518 | ;
|
3519 |
|
3520 | const endpoint_styles = (i`
|
3521 | :host {
|
3522 | container-type: inline-size;
|
3523 | }
|
3524 | .only-large-screen { display:none; }
|
3525 | .endpoint-head .path {
|
3526 | display: flex;
|
3527 | font-family:var(--font-mono);
|
3528 | font-size: var(--font-size-small);
|
3529 | align-items: center;
|
3530 | overflow-wrap: break-word;
|
3531 | word-break: break-all;
|
3532 | }
|
3533 |
|
3534 | .endpoint-head .descr {
|
3535 | font-size: var(--font-size-small);
|
3536 | color:var(--light-fg);
|
3537 | font-weight:400;
|
3538 | align-items: center;
|
3539 | overflow-wrap: break-word;
|
3540 | word-break: break-all;
|
3541 | display:none;
|
3542 | }
|
3543 |
|
3544 | .m-endpoint.expanded { margin-bottom:16px; }
|
3545 | .m-endpoint > .endpoint-head{
|
3546 | border-width:1px 1px 1px 5px;
|
3547 | border-style:solid;
|
3548 | border-color:transparent;
|
3549 | border-top-color:var(--light-border-color);
|
3550 | display:flex;
|
3551 | padding:6px 16px;
|
3552 | align-items: center;
|
3553 | cursor: pointer;
|
3554 | }
|
3555 | .m-endpoint > .endpoint-head.put:hover,
|
3556 | .m-endpoint > .endpoint-head.put.expanded {
|
3557 | border-color:var(--orange);
|
3558 | background-color:var(--light-orange);
|
3559 | }
|
3560 | .m-endpoint > .endpoint-head.post:hover,
|
3561 | .m-endpoint > .endpoint-head.post.expanded {
|
3562 | border-color:var(--green);
|
3563 | background-color:var(--light-green);
|
3564 | }
|
3565 | .m-endpoint > .endpoint-head.get:hover,
|
3566 | .m-endpoint > .endpoint-head.get.expanded {
|
3567 | border-color:var(--blue);
|
3568 | background-color:var(--light-blue);
|
3569 | }
|
3570 | .m-endpoint > .endpoint-head.delete:hover,
|
3571 | .m-endpoint > .endpoint-head.delete.expanded {
|
3572 | border-color:var(--red);
|
3573 | background-color:var(--light-red);
|
3574 | }
|
3575 |
|
3576 | .m-endpoint > .endpoint-head.head:hover,
|
3577 | .m-endpoint > .endpoint-head.head.expanded,
|
3578 | .m-endpoint > .endpoint-head.patch:hover,
|
3579 | .m-endpoint > .endpoint-head.patch.expanded,
|
3580 | .m-endpoint > .endpoint-head.options:hover,
|
3581 | .m-endpoint > .endpoint-head.options.expanded {
|
3582 | border-color:var(--yellow);
|
3583 | background-color:var(--light-yellow);
|
3584 | }
|
3585 |
|
3586 | .m-endpoint > .endpoint-head.deprecated:hover,
|
3587 | .m-endpoint > .endpoint-head.deprecated.expanded {
|
3588 | border-color:var(--border-color);
|
3589 | filter:opacity(0.6);
|
3590 | }
|
3591 |
|
3592 | .m-endpoint .endpoint-body {
|
3593 | flex-wrap:wrap;
|
3594 | padding:16px 0px 0 0px;
|
3595 | border-width:0px 1px 1px 5px;
|
3596 | border-style:solid;
|
3597 | box-shadow: 0px 4px 3px -3px rgba(0, 0, 0, 0.15);
|
3598 | }
|
3599 | .m-endpoint .endpoint-body.delete{ border-color:var(--red); }
|
3600 | .m-endpoint .endpoint-body.put{ border-color:var(--orange); }
|
3601 | .m-endpoint .endpoint-body.post { border-color:var(--green); }
|
3602 | .m-endpoint .endpoint-body.get { border-color:var(--blue); }
|
3603 | .m-endpoint .endpoint-body.head,
|
3604 | .m-endpoint .endpoint-body.patch,
|
3605 | .m-endpoint .endpoint-body.options {
|
3606 | border-color:var(--yellow);
|
3607 | }
|
3608 |
|
3609 | .m-endpoint .endpoint-body.deprecated {
|
3610 | border-color:var(--border-color);
|
3611 | filter:opacity(0.6);
|
3612 | }
|
3613 |
|
3614 | .endpoint-head .deprecated {
|
3615 | color: var(--light-fg);
|
3616 | filter:opacity(0.6);
|
3617 | }
|
3618 |
|
3619 | .summary{
|
3620 | padding:8px 8px;
|
3621 | }
|
3622 | .summary .title {
|
3623 | font-size:calc(var(--font-size-regular) + 2px);
|
3624 | margin-bottom: 6px;
|
3625 | word-break: break-all;
|
3626 | }
|
3627 |
|
3628 | .endpoint-head .method {
|
3629 | padding:2px 5px;
|
3630 | vertical-align: middle;
|
3631 | font-size:var(--font-size-small);
|
3632 | height: calc(var(--font-size-small) + 16px);
|
3633 | line-height: calc(var(--font-size-small) + 8px);
|
3634 | width: 60px;
|
3635 | border-radius: 2px;
|
3636 | display:inline-block;
|
3637 | text-align: center;
|
3638 | font-weight: bold;
|
3639 | text-transform:uppercase;
|
3640 | margin-right:5px;
|
3641 | }
|
3642 | .endpoint-head .method.delete{ border: 2px solid var(--red);}
|
3643 | .endpoint-head .method.put{ border: 2px solid var(--orange); }
|
3644 | .endpoint-head .method.post{ border: 2px solid var(--green); }
|
3645 | .endpoint-head .method.get{ border: 2px solid var(--blue); }
|
3646 | .endpoint-head .method.get.deprecated{ border: 2px solid var(--border-color); }
|
3647 | .endpoint-head .method.head,
|
3648 | .endpoint-head .method.patch,
|
3649 | .endpoint-head .method.options {
|
3650 | border: 2px solid var(--yellow);
|
3651 | }
|
3652 |
|
3653 | .req-resp-container {
|
3654 | display: flex;
|
3655 | margin-top:16px;
|
3656 | align-items: stretch;
|
3657 | flex-wrap: wrap;
|
3658 | flex-direction: column;
|
3659 | border-top:1px solid var(--light-border-color);
|
3660 | }
|
3661 |
|
3662 | .view-mode-request,
|
3663 | api-response.view-mode {
|
3664 | flex:1;
|
3665 | min-height:100px;
|
3666 | padding:16px 8px;
|
3667 | overflow:hidden;
|
3668 | }
|
3669 | .view-mode-request {
|
3670 | border-width:0 0 1px 0;
|
3671 | border-style:dashed;
|
3672 | }
|
3673 |
|
3674 | .head .view-mode-request,
|
3675 | .patch .view-mode-request,
|
3676 | .options .view-mode-request {
|
3677 | border-color:var(--yellow);
|
3678 | }
|
3679 | .put .view-mode-request {
|
3680 | border-color:var(--orange);
|
3681 | }
|
3682 | .post .view-mode-request {
|
3683 | border-color:var(--green);
|
3684 | }
|
3685 | .get .view-mode-request {
|
3686 | border-color:var(--blue);
|
3687 | }
|
3688 | .delete .view-mode-request {
|
3689 | border-color:var(--red);
|
3690 | }
|
3691 |
|
3692 | @container (min-width: 1024px) {
|
3693 | .only-large-screen { display:block; }
|
3694 | .endpoint-head .path{
|
3695 | font-size: var(--font-size-regular);
|
3696 | }
|
3697 | .endpoint-head .descr{
|
3698 | display: flex;
|
3699 | }
|
3700 | .endpoint-head .m-markdown-small,
|
3701 | .descr .m-markdown-small{
|
3702 | display:block;
|
3703 | }
|
3704 | .req-resp-container{
|
3705 | flex-direction: var(--layout, row);
|
3706 | flex-wrap: nowrap;
|
3707 | }
|
3708 | api-response.view-mode {
|
3709 | padding:16px;
|
3710 | }
|
3711 | .view-mode-request.row-layout {
|
3712 | border-width:0 1px 0 0;
|
3713 | padding:16px;
|
3714 | }
|
3715 | .summary{
|
3716 | padding:8px 16px;
|
3717 | }
|
3718 | }
|
3719 | `);
|
3720 | ;
|
3721 |
|
3722 | const prism_styles = (i`
|
3723 | code[class*="language-"],
|
3724 | pre[class*="language-"] {
|
3725 | text-align: left;
|
3726 | white-space: pre;
|
3727 | word-spacing: normal;
|
3728 | word-break: normal;
|
3729 | word-wrap: normal;
|
3730 | line-height: 1.5;
|
3731 | tab-size: 2;
|
3732 |
|
3733 | -webkit-hyphens: none;
|
3734 | -moz-hyphens: none;
|
3735 | -ms-hyphens: none;
|
3736 | hyphens: none;
|
3737 | }
|
3738 |
|
3739 | /* Code blocks */
|
3740 | pre[class*="language-"] {
|
3741 | padding: 1em;
|
3742 | margin: .5em 0;
|
3743 | overflow: auto;
|
3744 | }
|
3745 |
|
3746 | /* Inline code */
|
3747 | :not(pre) > code[class*="language-"] {
|
3748 | white-space: normal;
|
3749 | }
|
3750 |
|
3751 | .token.comment,
|
3752 | .token.block-comment,
|
3753 | .token.prolog,
|
3754 | .token.doctype,
|
3755 | .token.cdata {
|
3756 | color: var(--light-fg)
|
3757 | }
|
3758 |
|
3759 | .token.punctuation {
|
3760 | color: var(--fg);
|
3761 | }
|
3762 |
|
3763 | .token.tag,
|
3764 | .token.attr-name,
|
3765 | .token.namespace,
|
3766 | .token.deleted {
|
3767 | color:var(--pink);
|
3768 | }
|
3769 |
|
3770 | .token.function-name {
|
3771 | color: var(--blue);
|
3772 | }
|
3773 |
|
3774 | .token.boolean,
|
3775 | .token.number,
|
3776 | .token.function {
|
3777 | color: var(--red);
|
3778 | }
|
3779 |
|
3780 | .token.property,
|
3781 | .token.class-name,
|
3782 | .token.constant,
|
3783 | .token.symbol {
|
3784 | color: var(--code-property-color);
|
3785 | }
|
3786 |
|
3787 | .token.selector,
|
3788 | .token.important,
|
3789 | .token.atrule,
|
3790 | .token.keyword,
|
3791 | .token.builtin {
|
3792 | color: var(--code-keyword-color);
|
3793 | }
|
3794 |
|
3795 | .token.string,
|
3796 | .token.char,
|
3797 | .token.attr-value,
|
3798 | .token.regex,
|
3799 | .token.variable {
|
3800 | color: var(--green);
|
3801 | }
|
3802 |
|
3803 | .token.operator,
|
3804 | .token.entity,
|
3805 | .token.url {
|
3806 | color: var(--code-operator-color);
|
3807 | }
|
3808 |
|
3809 | .token.important,
|
3810 | .token.bold {
|
3811 | font-weight: bold;
|
3812 | }
|
3813 | .token.italic {
|
3814 | font-style: italic;
|
3815 | }
|
3816 |
|
3817 | .token.entity {
|
3818 | cursor: help;
|
3819 | }
|
3820 |
|
3821 | .token.inserted {
|
3822 | color: green;
|
3823 | }
|
3824 | `);
|
3825 | ;
|
3826 |
|
3827 | const tab_styles = (i`
|
3828 | .tab-panel {
|
3829 | border: none;
|
3830 | }
|
3831 | .tab-buttons {
|
3832 | height:30px;
|
3833 | padding: 4px 4px 0 4px;
|
3834 | border-bottom: 1px solid var(--light-border-color) ;
|
3835 | align-items: stretch;
|
3836 | overflow-y: hidden;
|
3837 | overflow-x: auto;
|
3838 | scrollbar-width: thin;
|
3839 | }
|
3840 | .tab-buttons::-webkit-scrollbar {
|
3841 | height: 1px;
|
3842 | background-color: var(--border-color);
|
3843 | }
|
3844 | .tab-btn {
|
3845 | border: none;
|
3846 | border-bottom: 3px solid transparent;
|
3847 | color: var(--light-fg);
|
3848 | background-color: transparent;
|
3849 | white-space: nowrap;
|
3850 | cursor:pointer;
|
3851 | outline:none;
|
3852 | font-family:var(--font-regular);
|
3853 | font-size:var(--font-size-small);
|
3854 | margin-right:16px;
|
3855 | padding:1px;
|
3856 | }
|
3857 | .tab-btn.active {
|
3858 | border-bottom: 3px solid var(--primary-color);
|
3859 | font-weight:bold;
|
3860 | color:var(--primary-color);
|
3861 | }
|
3862 |
|
3863 | .tab-btn:hover {
|
3864 | color:var(--primary-color);
|
3865 | }
|
3866 | .tab-content {
|
3867 | margin:-1px 0 0 0;
|
3868 | position:relative;
|
3869 | min-height: 50px;
|
3870 | }
|
3871 | `);
|
3872 | ;
|
3873 |
|
3874 | const nav_styles = (i`
|
3875 | .nav-bar-info:focus-visible,
|
3876 | .nav-bar-tag:focus-visible,
|
3877 | .nav-bar-path:focus-visible {
|
3878 | outline: 1px solid;
|
3879 | box-shadow: none;
|
3880 | outline-offset: -4px;
|
3881 | }
|
3882 | .nav-bar-expand-all:focus-visible,
|
3883 | .nav-bar-collapse-all:focus-visible,
|
3884 | .nav-bar-tag-icon:focus-visible {
|
3885 | outline: 1px solid;
|
3886 | box-shadow: none;
|
3887 | outline-offset: 2px;
|
3888 | }
|
3889 | .nav-bar {
|
3890 | width:0;
|
3891 | height:100%;
|
3892 | overflow: hidden;
|
3893 | color:var(--nav-text-color);
|
3894 | background-color: var(--nav-bg-color);
|
3895 | background-blend-mode: multiply;
|
3896 | line-height: calc(var(--font-size-small) + 4px);
|
3897 | display:none;
|
3898 | position:relative;
|
3899 | flex-direction:column;
|
3900 | flex-wrap:nowrap;
|
3901 | word-break:break-word;
|
3902 | }
|
3903 | ::slotted([slot=nav-logo]) {
|
3904 | padding:16px 16px 0 16px;
|
3905 | }
|
3906 | .nav-scroll {
|
3907 | overflow-x: hidden;
|
3908 | overflow-y: auto;
|
3909 | overflow-y: overlay;
|
3910 | scrollbar-width: thin;
|
3911 | scrollbar-color: var(--nav-hover-bg-color) transparent;
|
3912 | }
|
3913 |
|
3914 | .nav-bar-tag {
|
3915 | display: flex;
|
3916 | align-items: center;
|
3917 | justify-content: space-between;
|
3918 | flex-direction: row;
|
3919 | }
|
3920 | .nav-bar.read .nav-bar-tag-icon {
|
3921 | display:none;
|
3922 | }
|
3923 | .nav-bar-paths-under-tag {
|
3924 | overflow:hidden;
|
3925 | transition: max-height .2s ease-out, visibility .3s;
|
3926 | }
|
3927 | .collapsed .nav-bar-paths-under-tag {
|
3928 | visibility: hidden;
|
3929 | }
|
3930 |
|
3931 | .nav-bar-expand-all {
|
3932 | transform: rotate(90deg);
|
3933 | cursor:pointer;
|
3934 | margin-right:10px;
|
3935 | }
|
3936 | .nav-bar-collapse-all {
|
3937 | transform: rotate(270deg);
|
3938 | cursor:pointer;
|
3939 | }
|
3940 | .nav-bar-expand-all:hover, .nav-bar-collapse-all:hover {
|
3941 | color: var(--primary-color);
|
3942 | }
|
3943 |
|
3944 | .nav-bar-tag-icon {
|
3945 | color: var(--nav-text-color);
|
3946 | font-size: 20px;
|
3947 | }
|
3948 | .nav-bar-tag-icon:hover {
|
3949 | color:var(--nav-hover-text-color);
|
3950 | }
|
3951 | .nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-tag-icon::after {
|
3952 | content: '⌵';
|
3953 | width:16px;
|
3954 | height:16px;
|
3955 | text-align: center;
|
3956 | display: inline-block;
|
3957 | transform: rotate(-90deg);
|
3958 | transition: transform 0.2s ease-out 0s;
|
3959 | }
|
3960 | .nav-bar.focused .nav-bar-tag-and-paths.expanded .nav-bar-tag-icon::after {
|
3961 | content: '⌵';
|
3962 | width:16px;
|
3963 | height:16px;
|
3964 | text-align: center;
|
3965 | display: inline-block;
|
3966 | transition: transform 0.2s ease-out 0s;
|
3967 | }
|
3968 | .nav-scroll::-webkit-scrollbar {
|
3969 | width: var(--scroll-bar-width, 8px);
|
3970 | }
|
3971 | .nav-scroll::-webkit-scrollbar-track {
|
3972 | background:transparent;
|
3973 | }
|
3974 | .nav-scroll::-webkit-scrollbar-thumb {
|
3975 | background-color: var(--nav-hover-bg-color);
|
3976 | }
|
3977 |
|
3978 | .nav-bar-tag {
|
3979 | font-size: var(--font-size-regular);
|
3980 | color: var(--nav-accent-color);
|
3981 | border-left:4px solid transparent;
|
3982 | font-weight:bold;
|
3983 | padding: 15px 15px 15px 10px;
|
3984 | text-transform: capitalize;
|
3985 | }
|
3986 |
|
3987 | .nav-bar-components,
|
3988 | .nav-bar-h1,
|
3989 | .nav-bar-h2,
|
3990 | .nav-bar-info,
|
3991 | .nav-bar-tag,
|
3992 | .nav-bar-path {
|
3993 | display:flex;
|
3994 | cursor: pointer;
|
3995 | width: 100%;
|
3996 | border: none;
|
3997 | border-radius:4px;
|
3998 | color: var(--nav-text-color);
|
3999 | background: transparent;
|
4000 | border-left:4px solid transparent;
|
4001 | }
|
4002 |
|
4003 | .nav-bar-h1,
|
4004 | .nav-bar-h2,
|
4005 | .nav-bar-path {
|
4006 | font-size: calc(var(--font-size-small) + 1px);
|
4007 | padding: var(--nav-item-padding);
|
4008 | }
|
4009 | .nav-bar-path.small-font {
|
4010 | font-size: var(--font-size-small);
|
4011 | }
|
4012 |
|
4013 | .nav-bar-info {
|
4014 | font-size: var(--font-size-regular);
|
4015 | padding: 16px 10px;
|
4016 | font-weight:bold;
|
4017 | }
|
4018 | .nav-bar-section {
|
4019 | display: flex;
|
4020 | flex-direction: row;
|
4021 | justify-content: space-between;
|
4022 | font-size: var(--font-size-small);
|
4023 | color: var(--nav-text-color);
|
4024 | padding: var(--nav-item-padding);
|
4025 | font-weight:bold;
|
4026 | }
|
4027 | .nav-bar-section.operations {
|
4028 | cursor:pointer;
|
4029 | }
|
4030 | .nav-bar-section.operations:hover {
|
4031 | color:var(--nav-hover-text-color);
|
4032 | background-color:var(--nav-hover-bg-color);
|
4033 | }
|
4034 |
|
4035 | .nav-bar-section:first-child {
|
4036 | display: none;
|
4037 | }
|
4038 | .nav-bar-h2 {margin-left:12px;}
|
4039 |
|
4040 | .nav-bar-h1.left-bar.active,
|
4041 | .nav-bar-h2.left-bar.active,
|
4042 | .nav-bar-info.left-bar.active,
|
4043 | .nav-bar-tag.left-bar.active,
|
4044 | .nav-bar-path.left-bar.active,
|
4045 | .nav-bar-section.left-bar.operations.active {
|
4046 | border-left:4px solid var(--nav-accent-color);
|
4047 | color:var(--nav-hover-text-color);
|
4048 | }
|
4049 |
|
4050 | .nav-bar-h1.colored-block.active,
|
4051 | .nav-bar-h2.colored-block.active,
|
4052 | .nav-bar-info.colored-block.active,
|
4053 | .nav-bar-tag.colored-block.active,
|
4054 | .nav-bar-path.colored-block.active,
|
4055 | .nav-bar-section.colored-block.operations.active {
|
4056 | background-color: var(--nav-accent-color);
|
4057 | color: var(--nav-accent-text-color);
|
4058 | border-radius: 0;
|
4059 | }
|
4060 |
|
4061 | .nav-bar-h1:hover,
|
4062 | .nav-bar-h2:hover,
|
4063 | .nav-bar-info:hover,
|
4064 | .nav-bar-tag:hover,
|
4065 | .nav-bar-path:hover {
|
4066 | color:var(--nav-hover-text-color);
|
4067 | background-color:var(--nav-hover-bg-color);
|
4068 | }
|
4069 | `);
|
4070 | ;
|
4071 |
|
4072 | const info_styles = (i`
|
4073 | #api-info {
|
4074 | font-size: calc(var(--font-size-regular) - 1px);
|
4075 | margin-top: 8px;
|
4076 | margin-left: -15px;
|
4077 | }
|
4078 |
|
4079 | #api-info span:before {
|
4080 | content: "|";
|
4081 | display: inline-block;
|
4082 | opacity: 0.5;
|
4083 | width: 15px;
|
4084 | text-align: center;
|
4085 | }
|
4086 | #api-info span:first-child:before {
|
4087 | content: "";
|
4088 | width: 0px;
|
4089 | }
|
4090 | `);
|
4091 | ;
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 | const custom_styles = (i`
|
4100 |
|
4101 | `);
|
4102 | ;
|
4103 |
|
4104 | function debounce(fn, delay) {
|
4105 | let timeoutID = null;
|
4106 | return (...args) => {
|
4107 | clearTimeout(timeoutID);
|
4108 | const that = this;
|
4109 | timeoutID = setTimeout(() => {
|
4110 | fn.apply(that, args);
|
4111 | }, delay);
|
4112 | };
|
4113 | }
|
4114 | const invalidCharsRegEx = /[\s#:?&={}]/g;
|
4115 | const rapidocApiKey = '_rapidoc_api_key';
|
4116 | function sleep(ms) {
|
4117 |
|
4118 | return new Promise(resolve => setTimeout(resolve, ms));
|
4119 | }
|
4120 | function copyToClipboard(data, e) {
|
4121 | const btnEl = e.target;
|
4122 | const textArea = document.createElement('textarea');
|
4123 | textArea.value = data;
|
4124 | textArea.style.position = 'fixed';
|
4125 | document.body.appendChild(textArea);
|
4126 | textArea.focus();
|
4127 | textArea.select();
|
4128 | try {
|
4129 | document.execCommand('copy');
|
4130 | btnEl.innerText = 'Copied';
|
4131 | setTimeout(() => {
|
4132 | btnEl.innerText = 'Copy';
|
4133 | }, 5000);
|
4134 | } catch (err) {
|
4135 | console.error('Unable to copy', err);
|
4136 | }
|
4137 | document.body.removeChild(textArea);
|
4138 | }
|
4139 | function getBaseUrlFromUrl(url) {
|
4140 | const pathArray = url.split('/');
|
4141 | return `${pathArray[0]}//${pathArray[2]}`;
|
4142 | }
|
4143 | async function wait(ms) {
|
4144 | return new Promise(resolve => {
|
4145 | setTimeout(resolve, ms);
|
4146 | });
|
4147 | }
|
4148 | function getMatchedComponents(searchVal, component) {
|
4149 | return component.name.toLowerCase().includes(searchVal.toLowerCase());
|
4150 | }
|
4151 | function getMatchedPaths(searchVal, path, tagName = '') {
|
4152 | const stringToSearch = `${path.method} ${path.path} ${path.summary || ''} ${path.description || ''} ${path.operationId || ''} ${tagName}`.toLowerCase();
|
4153 | return stringToSearch.includes(searchVal.toLowerCase());
|
4154 | }
|
4155 | function schemaKeys(schemaProps, result = new Set()) {
|
4156 | if (!schemaProps) {
|
4157 | return result;
|
4158 | }
|
4159 | Object.keys(schemaProps).forEach(key => {
|
4160 | var _schemaProps$key$item;
|
4161 | result.add(key);
|
4162 | if (schemaProps[key].properties) {
|
4163 | schemaKeys(schemaProps[key].properties, result);
|
4164 | } else if ((_schemaProps$key$item = schemaProps[key].items) !== null && _schemaProps$key$item !== void 0 && _schemaProps$key$item.properties) {
|
4165 | var _schemaProps$key$item2;
|
4166 | schemaKeys((_schemaProps$key$item2 = schemaProps[key].items) === null || _schemaProps$key$item2 === void 0 ? void 0 : _schemaProps$key$item2.properties, result);
|
4167 | }
|
4168 | });
|
4169 | return result;
|
4170 | }
|
4171 | function advancedSearch(searchVal, allSpecTags, searchOptions = []) {
|
4172 | if (!searchVal.trim() || searchOptions.length === 0) {
|
4173 | return;
|
4174 | }
|
4175 | const pathsMatched = [];
|
4176 | allSpecTags.forEach(tag => {
|
4177 | tag.paths.forEach(path => {
|
4178 | let stringToSearch = '';
|
4179 | if (searchOptions.includes('search-api-path')) {
|
4180 | stringToSearch = path.path;
|
4181 | }
|
4182 | if (searchOptions.includes('search-api-descr')) {
|
4183 | stringToSearch = `${stringToSearch} ${(path.summary || '') + (path.description || '')}`;
|
4184 | }
|
4185 | if (searchOptions.includes('search-api-params')) {
|
4186 | var _path$parameters;
|
4187 | stringToSearch = `${stringToSearch} ${((_path$parameters = path.parameters) === null || _path$parameters === void 0 ? void 0 : _path$parameters.map(v => v.name).join(' ')) || ''}`;
|
4188 | }
|
4189 | if (searchOptions.includes('search-api-request-body') && path.requestBody) {
|
4190 | let schemaKeySet = new Set();
|
4191 | for (const contentType in (_path$requestBody = path.requestBody) === null || _path$requestBody === void 0 ? void 0 : _path$requestBody.content) {
|
4192 | var _path$requestBody, _path$requestBody$con;
|
4193 | if ((_path$requestBody$con = path.requestBody.content[contentType].schema) !== null && _path$requestBody$con !== void 0 && _path$requestBody$con.properties) {
|
4194 | var _path$requestBody$con2;
|
4195 | schemaKeySet = schemaKeys((_path$requestBody$con2 = path.requestBody.content[contentType].schema) === null || _path$requestBody$con2 === void 0 ? void 0 : _path$requestBody$con2.properties);
|
4196 | }
|
4197 | stringToSearch = `${stringToSearch} ${[...schemaKeySet].join(' ')}`;
|
4198 | }
|
4199 | }
|
4200 | if (searchOptions.includes('search-api-resp-descr')) {
|
4201 | stringToSearch = `${stringToSearch} ${Object.values(path.responses).map(v => v.description || '').join(' ')}`;
|
4202 | }
|
4203 | if (stringToSearch.toLowerCase().includes(searchVal.trim().toLowerCase())) {
|
4204 | pathsMatched.push({
|
4205 | elementId: path.elementId,
|
4206 | method: path.method,
|
4207 | path: path.path,
|
4208 | summary: path.summary || path.description || '',
|
4209 | deprecated: path.deprecated
|
4210 | });
|
4211 | }
|
4212 | });
|
4213 | });
|
4214 | return pathsMatched;
|
4215 | }
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 | function downloadResource(url, fileName) {
|
4241 | if (url) {
|
4242 | const a = document.createElement('a');
|
4243 | document.body.appendChild(a);
|
4244 | a.style = 'display: none';
|
4245 | a.href = url;
|
4246 | a.download = fileName;
|
4247 | a.click();
|
4248 | a.remove();
|
4249 | }
|
4250 | }
|
4251 | function viewResource(url) {
|
4252 | if (url) {
|
4253 | const a = document.createElement('a');
|
4254 | document.body.appendChild(a);
|
4255 | a.style = 'display: none';
|
4256 | a.href = url;
|
4257 | a.target = '_blank';
|
4258 | a.click();
|
4259 | a.remove();
|
4260 | }
|
4261 | }
|
4262 | ;
|
4263 | const openapi_parser_e=Object.freeze({url:"/"}),{fetch:openapi_parser_t,Response:openapi_parser_r,Headers:openapi_parser_n,Request:openapi_parser_s,FormData:openapi_parser_i,File:openapi_parser_o,Blob:openapi_parser_c}=globalThis;function openapi_parser_a(e,t){return t||"undefined"==typeof navigator||(t=navigator),t&&"ReactNative"===t.product?!(!e||"object"!=typeof e||"string"!=typeof e.uri):"undefined"!=typeof File&&e instanceof File||("undefined"!=typeof Blob&&e instanceof Blob||(!!ArrayBuffer.isView(e)||null!==e&&"object"==typeof e&&"function"==typeof e.pipe))}function openapi_parser_u(e,t){return Array.isArray(e)&&e.some((e=>openapi_parser_a(e,t)))}void 0===globalThis.fetch&&(globalThis.fetch=openapi_parser_t),void 0===globalThis.Headers&&(globalThis.Headers=openapi_parser_n),void 0===globalThis.Request&&(globalThis.Request=openapi_parser_s),void 0===globalThis.Response&&(globalThis.Response=openapi_parser_r),void 0===globalThis.FormData&&(globalThis.FormData=openapi_parser_i),void 0===globalThis.File&&(globalThis.File=openapi_parser_o),void 0===globalThis.Blob&&(globalThis.Blob=openapi_parser_c);class openapi_parser_l extends File{constructor(e,t="",r={}){super([e],t,r),this.data=e}valueOf(){return this.data}toString(){return this.valueOf()}}function openapi_parser_h(e,t="reserved"){return[...e].map((e=>{if((e=>/^[a-z0-9\-._~]+$/i.test(e))(e))return e;if((e=>":/?#[]@!$&'()*+,;=".indexOf(e)>-1)(e)&&"unsafe"===t)return e;const r=new TextEncoder;return Array.from(r.encode(e)).map((e=>`0${e.toString(16).toUpperCase()}`.slice(-2))).map((e=>`%${e}`)).join("")})).join("")}function openapi_parser_f(e){const{value:t}=e;return Array.isArray(t)?function({key:e,value:t,style:r,explode:n,escape:s}){if("simple"===r)return t.map((e=>openapi_parser_p(e,s))).join(",");if("label"===r)return`.${t.map((e=>openapi_parser_p(e,s))).join(".")}`;if("matrix"===r)return t.map((e=>openapi_parser_p(e,s))).reduce(((t,r)=>!t||n?`${t||""};${e}=${r}`:`${t},${r}`),"");if("form"===r){const r=n?`&${e}=`:",";return t.map((e=>openapi_parser_p(e,s))).join(r)}if("spaceDelimited"===r){const r=n?`${e}=`:"";return t.map((e=>openapi_parser_p(e,s))).join(` ${r}`)}if("pipeDelimited"===r){const r=n?`${e}=`:"";return t.map((e=>openapi_parser_p(e,s))).join(`|${r}`)}return}(e):"object"==typeof t?function({key:e,value:t,style:r,explode:n,escape:s}){const i=Object.keys(t);if("simple"===r)return i.reduce(((e,r)=>{const i=openapi_parser_p(t[r],s);return`${e?`${e},`:""}${r}${n?"=":","}${i}`}),"");if("label"===r)return i.reduce(((e,r)=>{const i=openapi_parser_p(t[r],s);return`${e?`${e}.`:"."}${r}${n?"=":"."}${i}`}),"");if("matrix"===r&&n)return i.reduce(((e,r)=>`${e?`${e};`:";"}${r}=${openapi_parser_p(t[r],s)}`),"");if("matrix"===r)return i.reduce(((r,n)=>{const i=openapi_parser_p(t[n],s);return`${r?`${r},`:`;${e}=`}${n},${i}`}),"");if("form"===r)return i.reduce(((e,r)=>{const i=openapi_parser_p(t[r],s);return`${e?`${e}${n?"&":","}`:""}${r}${n?"=":","}${i}`}),"");return}(e):function({key:e,value:t,style:r,escape:n}){if("simple"===r)return openapi_parser_p(t,n);if("label"===r)return`.${openapi_parser_p(t,n)}`;if("matrix"===r)return`;${e}=${openapi_parser_p(t,n)}`;if("form"===r)return openapi_parser_p(t,n);if("deepObject"===r)return openapi_parser_p(t,n);return}(e)}function openapi_parser_p(e,t=!1){return Array.isArray(e)||null!==e&&"object"==typeof e?e=JSON.stringify(e):"number"!=typeof e&&"boolean"!=typeof e||(e=String(e)),t&&e.length>0?openapi_parser_h(e,t):e}const openapi_parser_d={form:",",spaceDelimited:"%20",pipeDelimited:"|"},openapi_parser_m={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function openapi_parser_v(e,t,r=!1){const{collectionFormat:n,allowEmptyValue:s,serializationOption:i,encoding:o}=t,c="object"!=typeof t||Array.isArray(t)?t:t.value,h=r?e=>e.toString():e=>encodeURIComponent(e),f=h(e);if(void 0===c&&s)return[[f,""]];if(openapi_parser_a(c)||openapi_parser_u(c))return[[f,c]];if(i)return openapi_parser_y(e,c,r,i);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some((e=>"undefined"!==e))){const{style:t,explode:n,allowReserved:s}=o;return openapi_parser_y(e,c,r,{style:t,explode:n,allowReserved:s})}if("string"==typeof o.contentType){if(o.contentType.startsWith("application/json")){const e=h("string"==typeof c?c:JSON.stringify(c));return[[f,new openapi_parser_l(e,"blob",{type:o.contentType})]]}const e=h(String(c));return[[f,new openapi_parser_l(e,"blob",{type:o.contentType})]]}return"object"!=typeof c?[[f,h(c)]]:Array.isArray(c)&&c.every((e=>"object"!=typeof e))?[[f,c.map(h).join(",")]]:[[f,h(JSON.stringify(c))]]}return"object"!=typeof c?[[f,h(c)]]:Array.isArray(c)?"multi"===n?[[f,c.map(h)]]:[[f,c.map(h).join(openapi_parser_m[n||"csv"])]]:[[f,""]]}function openapi_parser_y(e,t,r,n){const s=n.style||"form",i=void 0===n.explode?"form"===s:n.explode,o=!r&&(n&&n.allowReserved?"unsafe":"reserved"),c=e=>openapi_parser_p(e,o),a=r?e=>e:e=>c(e);return"object"!=typeof t?[[a(e),c(t)]]:Array.isArray(t)?i?[[a(e),t.map(c)]]:[[a(e),t.map(c).join(openapi_parser_d[s])]]:"deepObject"===s?Object.keys(t).map((r=>[a(`${e}[${r}]`),c(t[r])])):i?Object.keys(t).map((e=>[a(e),c(t[e])])):[[a(e),Object.keys(t).map((e=>[`${a(e)},${c(t[e])}`])).join(",")]]}function openapi_parser_b(e){return((e,{encode:t=!0}={})=>{const r=(e,t,n)=>(null==n?e.append(t,""):Array.isArray(n)?n.reduce(((n,s)=>r(e,t,s)),e):n instanceof Date?e.append(t,n.toISOString()):"object"==typeof n?Object.entries(n).reduce(((n,[s,i])=>r(e,`${t}[${s}]`,i)),e):e.append(t,n),e),n=Object.entries(e).reduce(((e,[t,n])=>r(e,t,n)),new URLSearchParams),s=String(n);return t?s:decodeURIComponent(s)})(Object.keys(e).reduce(((t,r)=>{for(const[n,s]of openapi_parser_v(r,e[r]))t[n]=s instanceof openapi_parser_l?s.valueOf():s;return t}),{}),{encode:!1})}function openapi_parser_g(e={}){const{url:t="",query:r,form:n}=e;if(n){const t=Object.keys(n).some((e=>{const{value:t}=n[e];return openapi_parser_a(t)||openapi_parser_u(t)})),r=e.headers["content-type"]||e.headers["Content-Type"];if(t||/multipart\/form-data/i.test(r)){const t=(s=e.form,Object.entries(s).reduce(((e,[t,r])=>{for(const[n,s]of openapi_parser_v(t,r,!0))if(Array.isArray(s))for(const t of s)if(ArrayBuffer.isView(t)){const r=new Blob([t]);e.append(n,r)}else e.append(n,t);else if(ArrayBuffer.isView(s)){const t=new Blob([s]);e.append(n,t)}else e.append(n,s);return e}),new FormData));e.formdata=t,e.body=t}else e.body=openapi_parser_b(n);delete e.form}var s;if(r){const[n,s]=t.split("?");let i="";if(s){const e=new URLSearchParams(s);Object.keys(r).forEach((t=>e.delete(t))),i=String(e)}const o=((...e)=>{const t=e.filter((e=>e)).join("&");return t?`?${t}`:""})(i,openapi_parser_b(r));e.url=n+o,delete e.query}return e}
|
4264 | /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function openapi_parser_w(e){return null==e}var openapi_parser_x=function(e,t){var r,n,s,i;if(t)for(r=0,n=(i=Object.keys(t)).length;r<n;r+=1)e[s=i[r]]=t[s];return e},openapi_parser_j={isNothing:openapi_parser_w,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:openapi_parser_w(e)?[]:[e]},repeat:function(e,t){var r,n="";for(r=0;r<t;r+=1)n+=e;return n},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:openapi_parser_x};function openapi_parser_E(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+="\n\n"+e.mark.snippet),n+" "+r):n}function openapi_parser_$(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=openapi_parser_E(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}openapi_parser_$.prototype=Object.create(Error.prototype),openapi_parser_$.prototype.constructor=openapi_parser_$,openapi_parser_$.prototype.toString=function(e){return this.name+": "+openapi_parser_E(this,e)};var openapi_parser_O=openapi_parser_$;function openapi_parser_S(e,t,r,n,s){var i="",o="",c=Math.floor(s/2)-1;return n-t>c&&(t=n-c+(i=" ... ").length),r-n>c&&(r=n+c-(o=" ...").length),{str:i+e.slice(t,r).replace(/\t/g,"→")+o,pos:n-t+i.length}}function A(e,t){return openapi_parser_j.repeat(" ",t-e.length)+e}var openapi_parser_P=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var r,n=/\r?\n|\r|\0/g,s=[0],i=[],o=-1;r=n.exec(e.buffer);)i.push(r.index),s.push(r.index+r[0].length),e.position<=r.index&&o<0&&(o=s.length-2);o<0&&(o=s.length-1);var c,a,u="",l=Math.min(e.line+t.linesAfter,i.length).toString().length,h=t.maxLength-(t.indent+l+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)a=openapi_parser_S(e.buffer,s[o-c],i[o-c],e.position-(s[o]-s[o-c]),h),u=openapi_parser_j.repeat(" ",t.indent)+A((e.line-c+1).toString(),l)+" | "+a.str+"\n"+u;for(a=openapi_parser_S(e.buffer,s[o],i[o],e.position,h),u+=openapi_parser_j.repeat(" ",t.indent)+A((e.line+1).toString(),l)+" | "+a.str+"\n",u+=openapi_parser_j.repeat("-",t.indent+l+3+a.pos)+"^\n",c=1;c<=t.linesAfter&&!(o+c>=i.length);c++)a=openapi_parser_S(e.buffer,s[o+c],i[o+c],e.position-(s[o]-s[o+c]),h),u+=openapi_parser_j.repeat(" ",t.indent)+A((e.line+c+1).toString(),l)+" | "+a.str+"\n";return u.replace(/\n$/,"")},openapi_parser_T=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],openapi_parser_k=["scalar","sequence","mapping"];var openapi_parser_F=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===openapi_parser_T.indexOf(t))throw new openapi_parser_O('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(r){e[r].forEach((function(e){t[String(e)]=r}))})),t}(t.styleAliases||null),-1===openapi_parser_k.indexOf(this.kind))throw new openapi_parser_O('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function openapi_parser_I(e,t){var r=[];return e[t].forEach((function(e){var t=r.length;r.forEach((function(r,n){r.tag===e.tag&&r.kind===e.kind&&r.multi===e.multi&&(t=n)})),r[t]=e})),r}function openapi_parser_R(e){return this.extend(e)}openapi_parser_R.prototype.extend=function(e){var t=[],r=[];if(e instanceof openapi_parser_F)r.push(e);else if(Array.isArray(e))r=r.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new openapi_parser_O("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof openapi_parser_F))throw new openapi_parser_O("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new openapi_parser_O("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new openapi_parser_O("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),r.forEach((function(e){if(!(e instanceof openapi_parser_F))throw new openapi_parser_O("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var n=Object.create(openapi_parser_R.prototype);return n.implicit=(this.implicit||[]).concat(t),n.explicit=(this.explicit||[]).concat(r),n.compiledImplicit=openapi_parser_I(n,"implicit"),n.compiledExplicit=openapi_parser_I(n,"explicit"),n.compiledTypeMap=function(){var e,t,r={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function n(e){e.multi?(r.multi[e.kind].push(e),r.multi.fallback.push(e)):r[e.kind][e.tag]=r.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}(n.compiledImplicit,n.compiledExplicit),n};var openapi_parser_D=openapi_parser_R,openapi_parser_=new openapi_parser_F("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),C=new openapi_parser_F("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),openapi_parser_M=new openapi_parser_F("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),openapi_parser_N=new openapi_parser_D({explicit:[openapi_parser_,C,openapi_parser_M]});var openapi_parser_q=new openapi_parser_F("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var openapi_parser_B=new openapi_parser_F("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function L(e){return 48<=e&&e<=55}function openapi_parser_U(e){return 48<=e&&e<=57}var J=new openapi_parser_F("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=e.length,s=0,i=!1;if(!n)return!1;if("-"!==(t=e[s])&&"+"!==t||(t=e[++s]),"0"===t){if(s+1===n)return!0;if("b"===(t=e[++s])){for(s++;s<n;s++)if("_"!==(t=e[s])){if("0"!==t&&"1"!==t)return!1;i=!0}return i&&"_"!==t}if("x"===t){for(s++;s<n;s++)if("_"!==(t=e[s])){if(!(48<=(r=e.charCodeAt(s))&&r<=57||65<=r&&r<=70||97<=r&&r<=102))return!1;i=!0}return i&&"_"!==t}if("o"===t){for(s++;s<n;s++)if("_"!==(t=e[s])){if(!L(e.charCodeAt(s)))return!1;i=!0}return i&&"_"!==t}}if("_"===t)return!1;for(;s<n;s++)if("_"!==(t=e[s])){if(!openapi_parser_U(e.charCodeAt(s)))return!1;i=!0}return!(!i||"_"===t)},construct:function(e){var t,r=e,n=1;if(-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(n=-1),t=(r=r.slice(1))[0]),"0"===r)return 0;if("0"===t){if("b"===r[1])return n*parseInt(r.slice(2),2);if("x"===r[1])return n*parseInt(r.slice(2),16);if("o"===r[1])return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!openapi_parser_j.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),openapi_parser_V=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var openapi_parser_G=/^[-+]?[0-9]+e/;var H=new openapi_parser_F("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!openapi_parser_V.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||openapi_parser_j.isNegativeZero(e))},represent:function(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(openapi_parser_j.isNegativeZero(e))return"-0.0";return r=e.toString(10),openapi_parser_G.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),openapi_parser_z=openapi_parser_N.extend({implicit:[openapi_parser_q,openapi_parser_B,J,H]}),X=openapi_parser_z,W=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),openapi_parser_Y=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var openapi_parser_Z=new openapi_parser_F("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==W.exec(e)||null!==openapi_parser_Y.exec(e))},construct:function(e){var t,r,n,s,i,o,c,a,u=0,l=null;if(null===(t=W.exec(e))&&(t=openapi_parser_Y.exec(e)),null===t)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(r,n,s));if(i=+t[4],o=+t[5],c=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(l=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(l=-l)),a=new Date(Date.UTC(r,n,s,i,o,c,u)),l&&a.setTime(a.getTime()-l),a},instanceOf:Date,represent:function(e){return e.toISOString()}});var openapi_parser_K=new openapi_parser_F("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),openapi_parser_Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var ee=new openapi_parser_F("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,s=e.length,i=openapi_parser_Q;for(r=0;r<s;r++)if(!((t=i.indexOf(e.charAt(r)))>64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(e){var t,r,n=e.replace(/[\r\n=]/g,""),s=n.length,i=openapi_parser_Q,o=0,c=[];for(t=0;t<s;t++)t%4==0&&t&&(c.push(o>>16&255),c.push(o>>8&255),c.push(255&o)),o=o<<6|i.indexOf(n.charAt(t));return 0===(r=s%4*6)?(c.push(o>>16&255),c.push(o>>8&255),c.push(255&o)):18===r?(c.push(o>>10&255),c.push(o>>2&255)):12===r&&c.push(o>>4&255),new Uint8Array(c)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,r,n="",s=0,i=e.length,o=openapi_parser_Q;for(t=0;t<i;t++)t%3==0&&t&&(n+=o[s>>18&63],n+=o[s>>12&63],n+=o[s>>6&63],n+=o[63&s]),s=(s<<8)+e[t];return 0===(r=i%3)?(n+=o[s>>18&63],n+=o[s>>12&63],n+=o[s>>6&63],n+=o[63&s]):2===r?(n+=o[s>>10&63],n+=o[s>>4&63],n+=o[s<<2&63],n+=o[64]):1===r&&(n+=o[s>>2&63],n+=o[s<<4&63],n+=o[64],n+=o[64]),n}}),te=Object.prototype.hasOwnProperty,re=Object.prototype.toString;var ne=new openapi_parser_F("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,s,i,o=[],c=e;for(t=0,r=c.length;t<r;t+=1){if(n=c[t],i=!1,"[object Object]"!==re.call(n))return!1;for(s in n)if(te.call(n,s)){if(i)return!1;i=!0}if(!i)return!1;if(-1!==o.indexOf(s))return!1;o.push(s)}return!0},construct:function(e){return null!==e?e:[]}}),se=Object.prototype.toString;var ie=new openapi_parser_F("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,s,i,o=e;for(i=new Array(o.length),t=0,r=o.length;t<r;t+=1){if(n=o[t],"[object Object]"!==se.call(n))return!1;if(1!==(s=Object.keys(n)).length)return!1;i[t]=[s[0],n[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,r,n,s,i,o=e;for(i=new Array(o.length),t=0,r=o.length;t<r;t+=1)n=o[t],s=Object.keys(n),i[t]=[s[0],n[s[0]]];return i}}),oe=Object.prototype.hasOwnProperty;var ce=new openapi_parser_F("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,r=e;for(t in r)if(oe.call(r,t)&&null!==r[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),ae=X.extend({implicit:[openapi_parser_Z,openapi_parser_K],explicit:[ee,ne,ie,ce]}),ue=Object.prototype.hasOwnProperty,le=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,he=/[\x85\u2028\u2029]/,fe=/[,\[\]\{\}]/,pe=/^(?:!|!!|![a-z\-]+!)$/i,de=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function me(e){return Object.prototype.toString.call(e)}function ve(e){return 10===e||13===e}function ye(e){return 9===e||32===e}function be(e){return 9===e||32===e||10===e||13===e}function ge(e){return 44===e||91===e||93===e||123===e||125===e}function we(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function xe(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function je(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var Ee=new Array(256),$e=new Array(256),openapi_parser_Oe=0;openapi_parser_Oe<256;openapi_parser_Oe++)Ee[openapi_parser_Oe]=xe(openapi_parser_Oe)?1:0,$e[openapi_parser_Oe]=xe(openapi_parser_Oe);function openapi_parser_Se(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||ae,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Ae(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=openapi_parser_P(r),new openapi_parser_O(t,r)}function Pe(e,t){throw Ae(e,t)}function Te(e,t){e.onWarning&&e.onWarning.call(null,Ae(e,t))}var openapi_parser_ke={YAML:function(e,t,r){var n,s,i;null!==e.version&&Pe(e,"duplication of %YAML directive"),1!==r.length&&Pe(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&Pe(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),i=parseInt(n[2],10),1!==s&&Pe(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&Te(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,s;2!==r.length&&Pe(e,"TAG directive accepts exactly two arguments"),n=r[0],s=r[1],pe.test(n)||Pe(e,"ill-formed tag handle (first argument) of the TAG directive"),ue.call(e.tagMap,n)&&Pe(e,'there is a previously declared suffix for "'+n+'" tag handle'),de.test(s)||Pe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch(t){Pe(e,"tag prefix is malformed: "+s)}e.tagMap[n]=s}};function Fe(e,t,r,n){var s,i,o,c;if(t<r){if(c=e.input.slice(t,r),n)for(s=0,i=c.length;s<i;s+=1)9===(o=c.charCodeAt(s))||32<=o&&o<=1114111||Pe(e,"expected valid JSON character");else le.test(c)&&Pe(e,"the stream contains non-printable characters");e.result+=c}}function Ie(e,t,r,n){var s,i,o,c;for(openapi_parser_j.isObject(r)||Pe(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,c=(s=Object.keys(r)).length;o<c;o+=1)i=s[o],ue.call(t,i)||(t[i]=r[i],n[i]=!0)}function openapi_parser_Re(e,t,r,n,s,i,o,c,a){var u,l;if(Array.isArray(s))for(u=0,l=(s=Array.prototype.slice.call(s)).length;u<l;u+=1)Array.isArray(s[u])&&Pe(e,"nested arrays are not supported inside keys"),"object"==typeof s&&"[object Object]"===me(s[u])&&(s[u]="[object Object]");if("object"==typeof s&&"[object Object]"===me(s)&&(s="[object Object]"),s=String(s),null===t&&(t={}),"tag:yaml.org,2002:merge"===n)if(Array.isArray(i))for(u=0,l=i.length;u<l;u+=1)Ie(e,t,i[u],r);else Ie(e,t,i,r);else e.json||ue.call(r,s)||!ue.call(t,s)||(e.line=o||e.line,e.lineStart=c||e.lineStart,e.position=a||e.position,Pe(e,"duplicated mapping key")),"__proto__"===s?Object.defineProperty(t,s,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[s]=i,delete r[s];return t}function De(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):Pe(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function _e(e,t,r){for(var n=0,s=e.input.charCodeAt(e.position);0!==s;){for(;ye(s);)9===s&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&35===s)do{s=e.input.charCodeAt(++e.position)}while(10!==s&&13!==s&&0!==s);if(!ve(s))break;for(De(e),s=e.input.charCodeAt(e.position),n++,e.lineIndent=0;32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position)}return-1!==r&&0!==n&&e.lineIndent<r&&Te(e,"deficient indentation"),n}function Ce(e){var t,r=e.position;return!(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,0!==(t=e.input.charCodeAt(r))&&!be(t)))}function Me(e,t){1===t?e.result+=" ":t>1&&(e.result+=openapi_parser_j.repeat("\n",t-1))}function Ne(e,t){var r,n,s=e.tag,i=e.anchor,o=[],c=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),n=e.input.charCodeAt(e.position);0!==n&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,Pe(e,"tab characters must not be used in indentation")),45===n)&&be(e.input.charCodeAt(e.position+1));)if(c=!0,e.position++,_e(e,!0,-1)&&e.lineIndent<=t)o.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,Le(e,t,3,!1,!0),o.push(e.result),_e(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==n)Pe(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!c&&(e.tag=s,e.anchor=i,e.kind="sequence",e.result=o,!0)}function qe(e){var t,r,n,s,i=!1,o=!1;if(33!==(s=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&Pe(e,"duplication of a tag property"),60===(s=e.input.charCodeAt(++e.position))?(i=!0,s=e.input.charCodeAt(++e.position)):33===s?(o=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,i){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&62!==s);e.position<e.length?(n=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):Pe(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==s&&!be(s);)33===s&&(o?Pe(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),pe.test(r)||Pe(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);n=e.input.slice(t,e.position),fe.test(n)&&Pe(e,"tag suffix cannot contain flow indicator characters")}n&&!de.test(n)&&Pe(e,"tag name cannot contain such characters: "+n);try{n=decodeURIComponent(n)}catch(t){Pe(e,"tag name is malformed: "+n)}return i?e.tag=n:ue.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:Pe(e,'undeclared tag handle "'+r+'"'),!0}function Be(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&Pe(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!be(r)&&!ge(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Pe(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Le(e,t,r,n,s){var i,o,c,a,u,l,h,f,p,d=1,m=!1,v=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=o=c=4===r||3===r,n&&_e(e,!0,-1)&&(m=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),1===d)for(;qe(e)||Be(e);)_e(e,!0,-1)?(m=!0,c=i,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):c=!1;if(c&&(c=m||s),1!==d&&4!==r||(f=1===r||2===r?t:t+1,p=e.position-e.lineStart,1===d?c&&(Ne(e,p)||function(e,t,r){var n,s,i,o,c,a,u,l=e.tag,h=e.anchor,f={},p=Object.create(null),d=null,m=null,v=null,y=!1,b=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),u=e.input.charCodeAt(e.position);0!==u;){if(y||-1===e.firstTabInLine||(e.position=e.firstTabInLine,Pe(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),i=e.line,63!==u&&58!==u||!be(n)){if(o=e.line,c=e.lineStart,a=e.position,!Le(e,r,2,!1,!0))break;if(e.line===i){for(u=e.input.charCodeAt(e.position);ye(u);)u=e.input.charCodeAt(++e.position);if(58===u)be(u=e.input.charCodeAt(++e.position))||Pe(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(openapi_parser_Re(e,f,p,d,m,null,o,c,a),d=m=v=null),b=!0,y=!1,s=!1,d=e.tag,m=e.result;else{if(!b)return e.tag=l,e.anchor=h,!0;Pe(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return e.tag=l,e.anchor=h,!0;Pe(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===u?(y&&(openapi_parser_Re(e,f,p,d,m,null,o,c,a),d=m=v=null),b=!0,y=!0,s=!0):y?(y=!1,s=!0):Pe(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,u=n;if((e.line===i||e.lineIndent>t)&&(y&&(o=e.line,c=e.lineStart,a=e.position),Le(e,t,4,!0,s)&&(y?m=e.result:v=e.result),y||(openapi_parser_Re(e,f,p,d,m,v,o,c,a),d=m=v=null),_e(e,!0,-1),u=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==u)Pe(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&openapi_parser_Re(e,f,p,d,m,null,o,c,a),b&&(e.tag=l,e.anchor=h,e.kind="mapping",e.result=f),b}(e,p,f))||function(e,t){var r,n,s,i,o,c,a,u,l,h,f,p,d=!0,m=e.tag,v=e.anchor,y=Object.create(null);if(91===(p=e.input.charCodeAt(e.position)))o=93,u=!1,i=[];else{if(123!==p)return!1;o=125,u=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),p=e.input.charCodeAt(++e.position);0!==p;){if(_e(e,!0,t),(p=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=m,e.anchor=v,e.kind=u?"mapping":"sequence",e.result=i,!0;d?44===p&&Pe(e,"expected the node content, but found ','"):Pe(e,"missed comma between flow collection entries"),f=null,c=a=!1,63===p&&be(e.input.charCodeAt(e.position+1))&&(c=a=!0,e.position++,_e(e,!0,t)),r=e.line,n=e.lineStart,s=e.position,Le(e,t,1,!1,!0),h=e.tag,l=e.result,_e(e,!0,t),p=e.input.charCodeAt(e.position),!a&&e.line!==r||58!==p||(c=!0,p=e.input.charCodeAt(++e.position),_e(e,!0,t),Le(e,t,1,!1,!0),f=e.result),u?openapi_parser_Re(e,i,y,h,l,f,r,n,s):c?i.push(openapi_parser_Re(e,null,y,h,l,f,r,n,s)):i.push(l),_e(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(d=!0,p=e.input.charCodeAt(++e.position)):d=!1}Pe(e,"unexpected end of the stream within a flow collection")}(e,f)?v=!0:(o&&function(e,t){var r,n,s,i,o,c=1,a=!1,u=!1,l=t,h=0,f=!1;if(124===(i=e.input.charCodeAt(e.position)))n=!1;else{if(62!==i)return!1;n=!0}for(e.kind="scalar",e.result="";0!==i;)if(43===(i=e.input.charCodeAt(++e.position))||45===i)1===c?c=43===i?3:2:Pe(e,"repeat of a chomping mode identifier");else{if(!((s=48<=(o=i)&&o<=57?o-48:-1)>=0))break;0===s?Pe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?Pe(e,"repeat of an indentation width identifier"):(l=t+s-1,u=!0)}if(ye(i)){do{i=e.input.charCodeAt(++e.position)}while(ye(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!ve(i)&&0!==i)}for(;0!==i;){for(De(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!u||e.lineIndent<l)&&32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position);if(!u&&e.lineIndent>l&&(l=e.lineIndent),ve(i))h++;else{if(e.lineIndent<l){3===c?e.result+=openapi_parser_j.repeat("\n",a?1+h:h):1===c&&a&&(e.result+="\n");break}for(n?ye(i)?(f=!0,e.result+=openapi_parser_j.repeat("\n",a?1+h:h)):f?(f=!1,e.result+=openapi_parser_j.repeat("\n",h+1)):0===h?a&&(e.result+=" "):e.result+=openapi_parser_j.repeat("\n",h):e.result+=openapi_parser_j.repeat("\n",a?1+h:h),a=!0,u=!0,h=0,r=e.position;!ve(i)&&0!==i;)i=e.input.charCodeAt(++e.position);Fe(e,r,e.position,!1)}}return!0}(e,f)||function(e,t){var r,n,s;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=s=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(Fe(e,n,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;n=e.position,e.position++,s=e.position}else ve(r)?(Fe(e,n,s,!0),Me(e,_e(e,!1,t)),n=s=e.position):e.position===e.lineStart&&Ce(e)?Pe(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);Pe(e,"unexpected end of the stream within a single quoted scalar")}(e,f)||function(e,t){var r,n,s,i,o,c,a;if(34!==(c=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(c=e.input.charCodeAt(e.position));){if(34===c)return Fe(e,r,e.position,!0),e.position++,!0;if(92===c){if(Fe(e,r,e.position,!0),ve(c=e.input.charCodeAt(++e.position)))_e(e,!1,t);else if(c<256&&Ee[c])e.result+=$e[c],e.position++;else if((o=120===(a=c)?2:117===a?4:85===a?8:0)>0){for(s=o,i=0;s>0;s--)(o=we(c=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+o:Pe(e,"expected hexadecimal character");e.result+=je(i),e.position++}else Pe(e,"unknown escape sequence");r=n=e.position}else ve(c)?(Fe(e,r,n,!0),Me(e,_e(e,!1,t)),r=n=e.position):e.position===e.lineStart&&Ce(e)?Pe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Pe(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?v=!0:!function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!be(n)&&!ge(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Pe(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),ue.call(e.anchorMap,r)||Pe(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],_e(e,!0,-1),!0}(e)?function(e,t,r){var n,s,i,o,c,a,u,l,h=e.kind,f=e.result;if(be(l=e.input.charCodeAt(e.position))||ge(l)||35===l||38===l||42===l||33===l||124===l||62===l||39===l||34===l||37===l||64===l||96===l)return!1;if((63===l||45===l)&&(be(n=e.input.charCodeAt(e.position+1))||r&&ge(n)))return!1;for(e.kind="scalar",e.result="",s=i=e.position,o=!1;0!==l;){if(58===l){if(be(n=e.input.charCodeAt(e.position+1))||r&&ge(n))break}else if(35===l){if(be(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Ce(e)||r&&ge(l))break;if(ve(l)){if(c=e.line,a=e.lineStart,u=e.lineIndent,_e(e,!1,-1),e.lineIndent>=t){o=!0,l=e.input.charCodeAt(e.position);continue}e.position=i,e.line=c,e.lineStart=a,e.lineIndent=u;break}}o&&(Fe(e,s,i,!1),Me(e,e.line-c),s=i=e.position,o=!1),ye(l)||(i=e.position+1),l=e.input.charCodeAt(++e.position)}return Fe(e,s,i,!1),!!e.result||(e.kind=h,e.result=f,!1)}(e,f,1===r)&&(v=!0,null===e.tag&&(e.tag="?")):(v=!0,null===e.tag&&null===e.anchor||Pe(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(v=c&&Ne(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&Pe(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),a=0,u=e.implicitTypes.length;a<u;a+=1)if((h=e.implicitTypes[a]).resolve(e.result)){e.result=h.construct(e.result),e.tag=h.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(ue.call(e.typeMap[e.kind||"fallback"],e.tag))h=e.typeMap[e.kind||"fallback"][e.tag];else for(h=null,a=0,u=(l=e.typeMap.multi[e.kind||"fallback"]).length;a<u;a+=1)if(e.tag.slice(0,l[a].tag.length)===l[a].tag){h=l[a];break}h||Pe(e,"unknown tag !<"+e.tag+">"),null!==e.result&&h.kind!==e.kind&&Pe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result,e.tag)?(e.result=h.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):Pe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||v}function Ue(e){var t,r,n,s,i=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(s=e.input.charCodeAt(e.position))&&(_e(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(o=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!be(s);)s=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&Pe(e,"directive name must not be less than one character in length");0!==s;){for(;ye(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!ve(s));break}if(ve(s))break;for(t=e.position;0!==s&&!be(s);)s=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==s&&De(e),ue.call(openapi_parser_ke,r)?openapi_parser_ke[r](e,r,n):Te(e,'unknown document directive "'+r+'"')}_e(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,_e(e,!0,-1)):o&&Pe(e,"directives end mark is expected"),Le(e,e.lineIndent-1,4,!1,!0),_e(e,!0,-1),e.checkLineBreaks&&he.test(e.input.slice(i,e.position))&&Te(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ce(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,_e(e,!0,-1)):e.position<e.length-1&&Pe(e,"end of the stream or a document separator is expected")}function Je(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var r=new openapi_parser_Se(e,t),n=e.indexOf("\0");for(-1!==n&&(r.position=n,Pe(r,"null byte is not allowed in input")),r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Ue(r);return r.documents}var Ve=function(e,t,r){null!==t&&"object"==typeof t&&void 0===r&&(r=t,t=null);var n=Je(e,r);if("function"!=typeof t)return n;for(var s=0,i=n.length;s<i;s+=1)t(n[s])},Ge={loadAll:Ve,load:function(e,t){var r=Je(e,t);if(0!==r.length){if(1===r.length)return r[0];throw new openapi_parser_O("expected a single document in the stream, but found more")}}},He=Object.prototype.toString,ze=Object.prototype.hasOwnProperty,Xe={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},We=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Ye=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ze(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else{if(!(e<=4294967295))throw new openapi_parser_O("code point within a string may not be greater than 0xFFFFFFFF");r="U",n=8}return"\\"+r+openapi_parser_j.repeat("0",n-t.length)+t}function Ke(e){this.schema=e.schema||ae,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=openapi_parser_j.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var r,n,s,i,o,c,a;if(null===t)return{};for(r={},s=0,i=(n=Object.keys(t)).length;s<i;s+=1)o=n[s],c=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(a=e.compiledTypeMap.fallback[o])&&ze.call(a.styleAliases,c)&&(c=a.styleAliases[c]),r[o]=c;return r}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?2:1,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Qe(e,t){for(var r,n=openapi_parser_j.repeat(" ",t),s=0,i=-1,o="",c=e.length;s<c;)-1===(i=e.indexOf("\n",s))?(r=e.slice(s),s=c):(r=e.slice(s,i+1),s=i+1),r.length&&"\n"!==r&&(o+=n),o+=r;return o}function openapi_parser_et(e,t){return"\n"+openapi_parser_j.repeat(" ",e.indent*t)}function tt(e){return 32===e||9===e}function rt(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&65279!==e||65536<=e&&e<=1114111}function nt(e){return rt(e)&&65279!==e&&13!==e&&10!==e}function openapi_parser_st(e,t,r){var n=nt(e),s=n&&!tt(e);return(r?n:n&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!s)||nt(t)&&!tt(t)&&35===e||58===t&&s}function it(e,t){var r,n=e.charCodeAt(t);return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1))>=56320&&r<=57343?1024*(n-55296)+r-56320+65536:n}function ot(e){return/^\n* /.test(e)}function ct(e,t,r,n,s,i,o,c){var a,u,l=0,h=null,f=!1,p=!1,d=-1!==n,m=-1,v=rt(u=it(e,0))&&65279!==u&&!tt(u)&&45!==u&&63!==u&&58!==u&&44!==u&&91!==u&&93!==u&&123!==u&&125!==u&&35!==u&&38!==u&&42!==u&&33!==u&&124!==u&&61!==u&&62!==u&&39!==u&&34!==u&&37!==u&&64!==u&&96!==u&&function(e){return!tt(e)&&58!==e}(it(e,e.length-1));if(t||o)for(a=0;a<e.length;l>=65536?a+=2:a++){if(!rt(l=it(e,a)))return 5;v=v&&openapi_parser_st(l,h,c),h=l}else{for(a=0;a<e.length;l>=65536?a+=2:a++){if(10===(l=it(e,a)))f=!0,d&&(p=p||a-m-1>n&&" "!==e[m+1],m=a);else if(!rt(l))return 5;v=v&&openapi_parser_st(l,h,c),h=l}p=p||d&&a-m-1>n&&" "!==e[m+1]}return f||p?r>9&&ot(e)?5:o?2===i?5:2:p?4:3:!v||o||s(e)?2===i?5:2:1}function at(e,t,r,n,s){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==We.indexOf(t)||Ye.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,r),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),c=n||e.flowLevel>-1&&r>=e.flowLevel;switch(ct(t,c,e.indent,o,(function(t){return function(e,t){var r,n;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(e.implicitTypes[r].resolve(t))return!0;return!1}(e,t)}),e.quotingType,e.forceQuotes&&!n,s)){case 1:return t;case 2:return"'"+t.replace(/'/g,"''")+"'";case 3:return"|"+ut(t,e.indent)+openapi_parser_lt(Qe(t,i));case 4:return">"+ut(t,e.indent)+openapi_parser_lt(Qe(function(e,t){var r,n,s=/(\n+)([^\n]*)/g,i=(c=e.indexOf("\n"),c=-1!==c?c:e.length,s.lastIndex=c,ht(e.slice(0,c),t)),o="\n"===e[0]||" "===e[0];var c;for(;n=s.exec(e);){var a=n[1],u=n[2];r=" "===u[0],i+=a+(o||r||""===u?"":"\n")+ht(u,t),o=r}return i}(t,o),i));case 5:return'"'+function(e){for(var t,r="",n=0,s=0;s<e.length;n>=65536?s+=2:s++)n=it(e,s),!(t=Xe[n])&&rt(n)?(r+=e[s],n>=65536&&(r+=e[s+1])):r+=t||Ze(n);return r}(t)+'"';default:throw new openapi_parser_O("impossible error: invalid scalar style")}}()}function ut(e,t){var r=ot(e)?String(t):"",n="\n"===e[e.length-1];return r+(n&&("\n"===e[e.length-2]||"\n"===e)?"+":n?"":"-")+"\n"}function openapi_parser_lt(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function ht(e,t){if(""===e||" "===e[0])return e;for(var r,n,s=/ [^ ]/g,i=0,o=0,c=0,a="";r=s.exec(e);)(c=r.index)-i>t&&(n=o>i?o:c,a+="\n"+e.slice(i,n),i=n+1),o=c;return a+="\n",e.length-i>t&&o>i?a+=e.slice(i,o)+"\n"+e.slice(o+1):a+=e.slice(i),a.slice(1)}function ft(e,t,r,n){var s,i,o,c="",a=e.tag;for(s=0,i=r.length;s<i;s+=1)o=r[s],e.replacer&&(o=e.replacer.call(r,String(s),o)),(dt(e,t+1,o,!0,!0,!1,!0)||void 0===o&&dt(e,t+1,null,!0,!0,!1,!0))&&(n&&""===c||(c+=openapi_parser_et(e,t)),e.dump&&10===e.dump.charCodeAt(0)?c+="-":c+="- ",c+=e.dump);e.tag=a,e.dump=c||"[]"}function pt(e,t,r){var n,s,i,o,c,a;for(i=0,o=(s=r?e.explicitTypes:e.implicitTypes).length;i<o;i+=1)if(((c=s[i]).instanceOf||c.predicate)&&(!c.instanceOf||"object"==typeof t&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(r?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(a=e.styleMap[c.tag]||c.defaultStyle,"[object Function]"===He.call(c.represent))n=c.represent(t,a);else{if(!ze.call(c.represent,a))throw new openapi_parser_O("!<"+c.tag+'> tag resolver accepts not "'+a+'" style');n=c.represent[a](t,a)}e.dump=n}return!0}return!1}function dt(e,t,r,n,s,i,o){e.tag=null,e.dump=r,pt(e,r,!1)||pt(e,r,!0);var c,a=He.call(e.dump),u=n;n&&(n=e.flowLevel<0||e.flowLevel>t);var l,h,f="[object Object]"===a||"[object Array]"===a;if(f&&(h=-1!==(l=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||h||2!==e.indent&&t>0)&&(s=!1),h&&e.usedDuplicates[l])e.dump="*ref_"+l;else{if(f&&h&&!e.usedDuplicates[l]&&(e.usedDuplicates[l]=!0),"[object Object]"===a)n&&0!==Object.keys(e.dump).length?(!function(e,t,r,n){var s,i,o,c,a,u,l="",h=e.tag,f=Object.keys(r);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new openapi_parser_O("sortKeys must be a boolean or a function");for(s=0,i=f.length;s<i;s+=1)u="",n&&""===l||(u+=openapi_parser_et(e,t)),c=r[o=f[s]],e.replacer&&(c=e.replacer.call(r,o,c)),dt(e,t+1,o,!0,!0,!0)&&((a=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,a&&(u+=openapi_parser_et(e,t)),dt(e,t+1,c,!0,a)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",l+=u+=e.dump));e.tag=h,e.dump=l||"{}"}(e,t,e.dump,s),h&&(e.dump="&ref_"+l+e.dump)):(!function(e,t,r){var n,s,i,o,c,a="",u=e.tag,l=Object.keys(r);for(n=0,s=l.length;n<s;n+=1)c="",""!==a&&(c+=", "),e.condenseFlow&&(c+='"'),o=r[i=l[n]],e.replacer&&(o=e.replacer.call(r,i,o)),dt(e,t,i,!1,!1)&&(e.dump.length>1024&&(c+="? "),c+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),dt(e,t,o,!1,!1)&&(a+=c+=e.dump));e.tag=u,e.dump="{"+a+"}"}(e,t,e.dump),h&&(e.dump="&ref_"+l+" "+e.dump));else if("[object Array]"===a)n&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?ft(e,t-1,e.dump,s):ft(e,t,e.dump,s),h&&(e.dump="&ref_"+l+e.dump)):(!function(e,t,r){var n,s,i,o="",c=e.tag;for(n=0,s=r.length;n<s;n+=1)i=r[n],e.replacer&&(i=e.replacer.call(r,String(n),i)),(dt(e,t,i,!1,!1)||void 0===i&&dt(e,t,null,!1,!1))&&(""!==o&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=c,e.dump="["+o+"]"}(e,t,e.dump),h&&(e.dump="&ref_"+l+" "+e.dump));else{if("[object String]"!==a){if("[object Undefined]"===a)return!1;if(e.skipInvalid)return!1;throw new openapi_parser_O("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&at(e,e.dump,t,i,u)}null!==e.tag&&"?"!==e.tag&&(c=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),c="!"===e.tag[0]?"!"+c:"tag:yaml.org,2002:"===c.slice(0,18)?"!!"+c.slice(18):"!<"+c+">",e.dump=c+" "+e.dump)}return!0}function mt(e,t){var r,n,s=[],i=[];for(vt(e,s,i),r=0,n=i.length;r<n;r+=1)t.duplicates.push(s[i[r]]);t.usedDuplicates=new Array(n)}function vt(e,t,r){var n,s,i;if(null!==e&&"object"==typeof e)if(-1!==(s=t.indexOf(e)))-1===r.indexOf(s)&&r.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)vt(e[s],t,r);else for(s=0,i=(n=Object.keys(e)).length;s<i;s+=1)vt(e[n[s]],t,r)}function yt(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var bt=openapi_parser_F,gt=openapi_parser_D,wt=openapi_parser_N,xt=openapi_parser_z,jt=X,Et=ae,$t=Ge.load,Ot=Ge.loadAll,St={dump:function(e,t){var r=new Ke(t=t||{});r.noRefs||mt(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),dt(r,0,n,!0,!0)?r.dump+"\n":""}}.dump,At=openapi_parser_O,Pt={binary:ee,float:H,map:openapi_parser_M,null:openapi_parser_q,pairs:ie,set:ce,timestamp:openapi_parser_Z,bool:openapi_parser_B,int:J,merge:openapi_parser_K,omap:ne,seq:C,str:openapi_parser_},Tt=yt("safeLoad","load"),kt=yt("safeLoadAll","loadAll"),Ft=yt("safeDump","dump"),It={Type:bt,Schema:gt,FAILSAFE_SCHEMA:wt,JSON_SCHEMA:xt,CORE_SCHEMA:jt,DEFAULT_SCHEMA:Et,load:$t,loadAll:Ot,dump:St,YAMLException:At,types:Pt,safeLoad:Tt,safeLoadAll:kt,safeDump:Ft};function Rt(e={}){return"function"!=typeof e.entries?{}:Array.from(e.entries()).reduce(((e,[t,r])=>(e[t]=function(e){return e.includes(", ")?e.split(", "):e}(r),e)),{})}function Dt(e,t,{loadSpec:r=!1}={}){const n={ok:e.ok,url:e.url||t,status:e.status,statusText:e.statusText,headers:Rt(e.headers)},s=n.headers["content-type"],i=r||((e="")=>/(json|xml|yaml|text)\b/.test(e))(s);return(i?e.text:e.blob||e.buffer).call(e).then((e=>{if(n.text=e,n.data=e,i)try{const t=function(e,t){return t&&(0===t.indexOf("application/json")||t.indexOf("+json")>0)?JSON.parse(e):It.load(e)}(e,s);n.body=t,n.obj=t}catch(e){n.parseError=e}return n}))}async function _t(e,t={}){"object"==typeof e&&(e=(t=e).url),t.headers=t.headers||{},(t=openapi_parser_g(t)).headers&&Object.keys(t.headers).forEach((e=>{const r=t.headers[e];"string"==typeof r&&(t.headers[e]=r.replace(/\n+/g," "))})),t.requestInterceptor&&(t=await t.requestInterceptor(t)||t);const r=t.headers["content-type"]||t.headers["Content-Type"];let n;/multipart\/form-data/i.test(r)&&(delete t.headers["content-type"],delete t.headers["Content-Type"]);try{n=await(t.userFetch||fetch)(t.url,t),n=await Dt(n,e,t),t.responseInterceptor&&(n=await t.responseInterceptor(n)||n)}catch(e){if(!n)throw e;const t=new Error(n.statusText||`response status is ${n.status}`);throw t.status=n.status,t.statusCode=n.status,t.responseError=e,t}if(!n.ok){const e=new Error(n.statusText||`response status is ${n.status}`);throw e.status=n.status,e.statusCode=n.status,e.response=n,e}return n}function Ct(e,t={}){const{requestInterceptor:r,responseInterceptor:n}=t,s=e.withCredentials?"include":"same-origin";return t=>e({url:t,loadSpec:!0,requestInterceptor:r,responseInterceptor:n,headers:{Accept:"application/json, application/yaml"},credentials:s}).then((e=>e.body))}const Mt=e=>{var t,r;const{baseDoc:n,url:s}=e,i=null!==(t=null!=n?n:s)&&void 0!==t?t:"";return"string"==typeof(null===(r=globalThis.document)||void 0===r?void 0:r.baseURI)?String(new URL(i,globalThis.document.baseURI)):i},Nt=e=>{const{fetch:t,http:r}=e;return t||r||_t};
|
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 |
|
4270 | var qt,Bt=(qt=function(e,t){return qt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},qt(e,t)},function(e,t){function r(){this.constructor=e}qt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Lt=Object.prototype.hasOwnProperty;function Ut(e,t){return Lt.call(e,t)}function Jt(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var s in e)Ut(e,s)&&n.push(s);return n}function Vt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Gt(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0}function Ht(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function zt(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Xt(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Xt(e[t]))return!0}else if("object"==typeof e)for(var n=Jt(e),s=n.length,i=0;i<s;i++)if(Xt(e[n[i]]))return!0;return!1}function Wt(e,t){var r=[e];for(var n in t){var s="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==s&&r.push(n+": "+s)}return r.join("\n")}var Yt=function(e){function t(t,r,n,s,i){var o=this.constructor,c=e.call(this,Wt(t,{name:r,index:n,operation:s,tree:i}))||this;return c.name=r,c.index=n,c.operation=s,c.tree=i,Object.setPrototypeOf(c,o.prototype),c.message=Wt(t,{name:r,index:n,operation:s,tree:i}),c}return Bt(t,e),t}(Error),Zt=Yt,Kt=Vt,Qt={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=tr(r,this.path);n&&(n=Vt(n));var s=rr(r,{op:"remove",path:this.from}).removed;return rr(r,{op:"add",path:this.path,value:s}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=tr(r,this.from);return rr(r,{op:"add",path:this.path,value:Vt(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:or(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},er={add:function(e,t,r){return Gt(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Qt.move,copy:Qt.copy,test:Qt.test,_get:Qt._get};function tr(e,t){if(""==t)return e;var r={op:"_get",path:t};return rr(e,r),r.value}function rr(e,t,r,n,s,i){if(void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===s&&(s=!0),void 0===i&&(i=0),r&&("function"==typeof r?r(t,0,e,t.path):sr(t,0)),""===t.path){var o={newDocument:e};if("add"===t.op)return o.newDocument=t.value,o;if("replace"===t.op)return o.newDocument=t.value,o.removed=e,o;if("move"===t.op||"copy"===t.op)return o.newDocument=tr(e,t.from),"move"===t.op&&(o.removed=e),o;if("test"===t.op){if(o.test=or(e,t.value),!1===o.test)throw new Zt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return o.newDocument=e,o}if("remove"===t.op)return o.removed=e,o.newDocument=null,o;if("_get"===t.op)return t.value=e,o;if(r)throw new Zt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return o}n||(e=Vt(e));var c=(t.path||"").split("/"),a=e,u=1,l=c.length,h=void 0,f=void 0,p=void 0;for(p="function"==typeof r?r:sr;;){if((f=c[u])&&-1!=f.indexOf("~")&&(f=zt(f)),s&&("__proto__"==f||"prototype"==f&&u>0&&"constructor"==c[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&void 0===h&&(void 0===a[f]?h=c.slice(0,u).join("/"):u==l-1&&(h=t.path),void 0!==h&&p(t,0,e,h)),u++,Array.isArray(a)){if("-"===f)f=a.length;else{if(r&&!Gt(f))throw new Zt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);Gt(f)&&(f=~~f)}if(u>=l){if(r&&"add"===t.op&&f>a.length)throw new Zt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);if(!1===(o=er[t.op].call(t,a,f,e)).test)throw new Zt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return o}}else if(u>=l){if(!1===(o=Qt[t.op].call(t,a,f,e)).test)throw new Zt("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return o}if(a=a[f],r&&u<l&&(!a||"object"!=typeof a))throw new Zt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}function nr(e,t,r,n,s){if(void 0===n&&(n=!0),void 0===s&&(s=!0),r&&!Array.isArray(t))throw new Zt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Vt(e));for(var i=new Array(t.length),o=0,c=t.length;o<c;o++)i[o]=rr(e,t[o],r,!0,s,o),e=i[o].newDocument;return i.newDocument=e,i}function sr(e,t,r,n){if("object"!=typeof e||null===e||Array.isArray(e))throw new Zt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(!Qt[e.op])throw new Zt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r);if("string"!=typeof e.path)throw new Zt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new Zt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new Zt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new Zt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&Xt(e.value))throw new Zt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r)if("add"==e.op){var s=e.path.split("/").length,i=n.split("/").length;if(s!==i+1&&s!==i)throw new Zt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==n)throw new Zt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if("move"===e.op||"copy"===e.op){var o=ir([{op:"_get",path:e.from,value:void 0}],r);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new Zt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}function ir(e,t,r){try{if(!Array.isArray(e))throw new Zt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)nr(Vt(t),Vt(e),r||!0);else{r=r||sr;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(e){if(e instanceof Zt)return e;throw e}}function or(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,s,i=Array.isArray(e),o=Array.isArray(t);if(i&&o){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!or(e[r],t[r]))return!1;return!0}if(i!=o)return!1;var c=Object.keys(e);if((n=c.length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!t.hasOwnProperty(c[r]))return!1;for(r=n;0!=r--;)if(!or(e[s=c[r]],t[s]))return!1;return!0}return e!=e&&t!=t}const cr=Object.freeze(Object.defineProperty({__proto__:null,JsonPatchError:Zt,_areEquals:or,applyOperation:rr,applyPatch:nr,applyReducer:function(e,t,r){var n=rr(e,t);if(!1===n.test)throw new Zt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument},deepClone:Kt,getValueByPointer:tr,validate:ir,validator:sr},Symbol.toStringTag,{value:"Module"}));
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 | */var ar=new WeakMap,ur=function(e){this.observers=new Map,this.obj=e},lr=function(e,t){this.callback=e,this.observer=t};function hr(e,t){void 0===t&&(t=!1);var r=ar.get(e.object);fr(r.value,e.object,e.patches,"",t),e.patches.length&&nr(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function fr(e,t,r,n,s){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=Jt(t),o=Jt(e),c=!1,a=o.length-1;a>=0;a--){var u=e[h=o[a]];if(!Ut(t,h)||void 0===t[h]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(s&&r.push({op:"test",path:n+"/"+Ht(h),value:Vt(u)}),r.push({op:"remove",path:n+"/"+Ht(h)}),c=!0):(s&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}));else{var l=t[h];"object"==typeof u&&null!=u&&"object"==typeof l&&null!=l&&Array.isArray(u)===Array.isArray(l)?fr(u,l,r,n+"/"+Ht(h),s):u!==l&&(s&&r.push({op:"test",path:n+"/"+Ht(h),value:Vt(u)}),r.push({op:"replace",path:n+"/"+Ht(h),value:Vt(l)}))}}if(c||i.length!=o.length)for(a=0;a<i.length;a++){var h;Ut(e,h=i[a])||void 0===t[h]||r.push({op:"add",path:n+"/"+Ht(h),value:Vt(t[h])})}}}const pr=Object.freeze(Object.defineProperty({__proto__:null,compare:function(e,t,r){void 0===r&&(r=!1);var n=[];return fr(e,t,n,"",r),n},generate:hr,observe:function(e,t){var r,n=function(e){return ar.get(e)}(e);if(n){var s=function(e,t){return e.observers.get(t)}(n,t);r=s&&s.observer}else n=new ur(e),ar.set(e,n);if(r)return r;if(r={},n.value=Vt(e),t){r.callback=t,r.next=null;var i=function(){hr(r)},o=function(){clearTimeout(r.next),r.next=setTimeout(i)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return r.patches=[],r.object=e,r.unobserve=function(){hr(r),clearTimeout(r.next),function(e,t){e.observers.delete(t.callback)}(n,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},n.observers.set(t,new lr(t,r)),r},unobserve:function(e,t){t.unobserve()}},Symbol.toStringTag,{value:"Module"}));function dr(e){return e&&e.t&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}Object.assign({},cr,pr,{JsonPatchError:Yt,deepClone:Vt,escapePathComponent:Ht,unescapePathComponent:zt});var mr=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===vr}(e)}(e)};var vr="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function yr(e,t){return!1!==t.clone&&t.isMergeableObject(e)?jr((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function br(e,t,r){return e.concat(t).map((function(e){return yr(e,r)}))}function gr(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function wr(e,t){try{return t in e}catch(e){return!1}}function xr(e,t,r){var n={};return r.isMergeableObject(e)&&gr(e).forEach((function(t){n[t]=yr(e[t],r)})),gr(t).forEach((function(s){(function(e,t){return wr(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(wr(e,s)&&r.isMergeableObject(t[s])?n[s]=function(e,t){if(!t.customMerge)return jr;var r=t.customMerge(e);return"function"==typeof r?r:jr}(s,r)(e[s],t[s],r):n[s]=yr(t[s],r))})),n}function jr(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||br,r.isMergeableObject=r.isMergeableObject||mr,r.cloneUnlessOtherwiseSpecified=yr;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):xr(e,t,r):yr(t,r)}jr.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return jr(e,r,t)}),{})};const Er=dr(jr),$r={add:function(e,t){return{op:"add",path:e,value:t}},replace:Sr,remove:function(e){return{op:"remove",path:e}},merge:function(e,t){return{type:"mutation",op:"merge",path:e,value:t}},mergeDeep:function(e,t){return{type:"mutation",op:"mergeDeep",path:e,value:t}},context:function(e,t){return{type:"context",path:e,value:t}},getIn:function(e,t){return t.reduce(((e,t)=>void 0!==t&&e?e[t]:e),e)},applyPatch:function(e,t,r){if(r=r||{},"merge"===(t={...t,path:t.path&&Or(t.path)}).op){const r=qr(e,t.path);Object.assign(r,t.value),nr(e,[Sr(t.path,r)])}else if("mergeDeep"===t.op){const r=qr(e,t.path),n=Er(r,t.value);e=nr(e,[Sr(t.path,n)]).newDocument}else if("add"===t.op&&""===t.path&&Rr(t.value)){const r=Object.keys(t.value).reduce(((e,r)=>(e.push({op:"add",path:`/${Or(r)}`,value:t.value[r]}),e)),[]);nr(e,r)}else if("replace"===t.op&&""===t.path){let{value:n}=t;r.allowMetaPatches&&t.meta&&Mr(t)&&(Array.isArray(t.value)||Rr(t.value))&&(n={...n,...t.meta}),e=n}else if(nr(e,[t]),r.allowMetaPatches&&t.meta&&Mr(t)&&(Array.isArray(t.value)||Rr(t.value))){const r={...qr(e,t.path),...t.meta};nr(e,[Sr(t.path,r)])}return e},parentPathMatch:function(e,t){if(!Array.isArray(t))return!1;for(let r=0,n=t.length;r<n;r+=1)if(t[r]!==e[r])return!1;return!0},flatten:Fr,fullyNormalizeArray:function(e){return Ir(Fr(kr(e)))},normalizeArray:kr,isPromise:function(e){return Rr(e)&&Dr(e.then)},forEachNew:function(e,t){try{return Ar(e,Tr,t)}catch(e){return e}},forEachNewPrimitive:function(e,t){try{return Ar(e,Pr,t)}catch(e){return e}},isJsonPatch:_r,isContextPatch:function(e){return Nr(e)&&"context"===e.type},isPatch:Nr,isMutation:Cr,isAdditiveMutation:Mr,isGenerator:function(e){return"[object GeneratorFunction]"===Object.prototype.toString.call(e)},isFunction:Dr,isObject:Rr,isError:function(e){return e instanceof Error}};function Or(e){return Array.isArray(e)?e.length<1?"":`/${e.map((e=>(e+"").replace(/~/g,"~0").replace(/\//g,"~1"))).join("/")}`:e}function Sr(e,t,r){return{op:"replace",path:e,value:t,meta:r}}function Ar(e,t,r){return Ir(Fr(e.filter(Mr).map((e=>t(e.value,r,e.path)))||[]))}function Pr(e,t,r){return r=r||[],Array.isArray(e)?e.map(((e,n)=>Pr(e,t,r.concat(n)))):Rr(e)?Object.keys(e).map((n=>Pr(e[n],t,r.concat(n)))):t(e,r[r.length-1],r)}function Tr(e,t,r){let n=[];if((r=r||[]).length>0){const s=t(e,r[r.length-1],r);s&&(n=n.concat(s))}if(Array.isArray(e)){const s=e.map(((e,n)=>Tr(e,t,r.concat(n))));s&&(n=n.concat(s))}else if(Rr(e)){const s=Object.keys(e).map((n=>Tr(e[n],t,r.concat(n))));s&&(n=n.concat(s))}return n=Fr(n),n}function kr(e){return Array.isArray(e)?e:[e]}function Fr(e){return[].concat(...e.map((e=>Array.isArray(e)?Fr(e):e)))}function Ir(e){return e.filter((e=>void 0!==e))}function Rr(e){return e&&"object"==typeof e}function Dr(e){return e&&"function"==typeof e}function _r(e){if(Nr(e)){const{op:t}=e;return"add"===t||"remove"===t||"replace"===t}return!1}function Cr(e){return _r(e)||Nr(e)&&"mutation"===e.type}function Mr(e){return Cr(e)&&("add"===e.op||"replace"===e.op||"merge"===e.op||"mergeDeep"===e.op)}function Nr(e){return e&&"object"==typeof e}function qr(e,t){try{return tr(e,t)}catch(e){return console.error(e),{}}}var Br=function(e){return e&&e.Math===Math&&e},Lr=Br("object"==typeof globalThis&&globalThis)||Br("object"==typeof window&&window)||Br("object"==typeof self&&self)||Br("object"==typeof global&&global)||Br(!1)||function(){return this}()||Function("return this")(),Ur=function(e){try{return!!e()}catch(e){return!0}},Jr=!Ur((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Vr=Jr,Gr=Function.prototype,Hr=Gr.apply,zr=Gr.call,Xr="object"==typeof Reflect&&Reflect.apply||(Vr?zr.bind(Hr):function(){return zr.apply(Hr,arguments)}),Wr=Jr,Yr=Function.prototype,Zr=Yr.call,Kr=Wr&&Yr.bind.bind(Zr,Zr),Qr=Wr?Kr:function(e){return function(){return Zr.apply(e,arguments)}},en=Qr,tn=en({}.toString),rn=en("".slice),nn=function(e){return rn(tn(e),8,-1)},sn=nn,on=Qr,cn=function(e){if("Function"===sn(e))return on(e)},an="object"==typeof document&&document.all,un=void 0===an&&void 0!==an?function(e){return"function"==typeof e||e===an}:function(e){return"function"==typeof e},ln={},hn=!Ur((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),fn=Jr,pn=Function.prototype.call,dn=fn?pn.bind(pn):function(){return pn.apply(pn,arguments)},mn={},vn={}.propertyIsEnumerable,yn=Object.getOwnPropertyDescriptor,bn=yn&&!vn.call({1:2},1);mn.f=bn?function(e){var t=yn(this,e);return!!t&&t.enumerable}:vn;var gn,wn,xn=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},jn=Ur,En=nn,$n=Object,On=Qr("".split),Sn=jn((function(){return!$n("z").propertyIsEnumerable(0)}))?function(e){return"String"===En(e)?On(e,""):$n(e)}:$n,An=function(e){return null==e},Pn=An,Tn=TypeError,kn=function(e){if(Pn(e))throw new Tn("Can't call method on "+e);return e},Fn=Sn,In=kn,Rn=function(e){return Fn(In(e))},Dn=un,_n=function(e){return"object"==typeof e?null!==e:Dn(e)},Cn={},Mn=Cn,Nn=Lr,qn=un,Bn=function(e){return qn(e)?e:void 0},Ln=function(e,t){return arguments.length<2?Bn(Mn[e])||Bn(Nn[e]):Mn[e]&&Mn[e][t]||Nn[e]&&Nn[e][t]},Un=Qr({}.isPrototypeOf),Jn=Lr.navigator,Vn=Jn&&Jn.userAgent,Gn=Lr,Hn=Vn?String(Vn):"",zn=Gn.process,Xn=Gn.Deno,Wn=zn&&zn.versions||Xn&&Xn.version,Yn=Wn&&Wn.v8;Yn&&(wn=(gn=Yn.split("."))[0]>0&&gn[0]<4?1:+(gn[0]+gn[1])),!wn&&Hn&&(!(gn=Hn.match(/Edge\/(\d+)/))||gn[1]>=74)&&(gn=Hn.match(/Chrome\/(\d+)/))&&(wn=+gn[1]);var Zn=wn,Kn=Ur,Qn=Lr.String,es=!!Object.getOwnPropertySymbols&&!Kn((function(){var e=Symbol("symbol detection");return!Qn(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Zn&&Zn<41})),ts=es&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rs=Ln,ns=un,ss=Un,is=Object,os=ts?function(e){return"symbol"==typeof e}:function(e){var t=rs("Symbol");return ns(t)&&ss(t.prototype,is(e))},cs=String,as=function(e){try{return cs(e)}catch(e){return"Object"}},us=un,ls=as,hs=TypeError,fs=function(e){if(us(e))return e;throw new hs(ls(e)+" is not a function")},ps=fs,ds=An,ms=function(e,t){var r=e[t];return ds(r)?void 0:ps(r)},vs=dn,ys=un,bs=_n,gs=TypeError,ws={exports:{}},xs=Lr,js=Object.defineProperty,Es=Lr,$s=function(e,t){try{js(xs,e,{value:t,configurable:!0,writable:!0})}catch(r){xs[e]=t}return t},Os=ws.exports=Es["o"]||$s("__core-js_shared__",{});(Os.versions||(Os.versions=[])).push({version:"3.38.1",mode:"pure",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ss=ws.exports,As=Ss,Ps=function(e,t){return As[e]||(As[e]=t||{})},Ts=kn,ks=Object,Fs=function(e){return ks(Ts(e))},Is=Fs,Rs=Qr({}.hasOwnProperty),Ds=Object.hasOwn||function(e,t){return Rs(Is(e),t)},_s=Qr,Cs=0,Ms=Math.random(),Ns=_s(1..toString),qs=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ns(++Cs+Ms,36)},Bs=Ps,Ls=Ds,Us=qs,Js=es,Vs=ts,Gs=Lr.Symbol,Hs=Bs("wks"),zs=Vs?Gs.for||Gs:Gs&&Gs.withoutSetter||Us,Xs=function(e){return Ls(Hs,e)||(Hs[e]=Js&&Ls(Gs,e)?Gs[e]:zs("Symbol."+e)),Hs[e]},Ws=dn,Ys=_n,Zs=os,Ks=ms,Qs=function(e,t){var r,n;if("string"===t&&ys(r=e.toString)&&!bs(n=vs(r,e)))return n;if(ys(r=e.valueOf)&&!bs(n=vs(r,e)))return n;if("string"!==t&&ys(r=e.toString)&&!bs(n=vs(r,e)))return n;throw new gs("Can't convert object to primitive value")},ei=TypeError,ti=Xs("toPrimitive"),ri=function(e,t){if(!Ys(e)||Zs(e))return e;var r,n=Ks(e,ti);if(n){if(void 0===t&&(t="default"),r=Ws(n,e,t),!Ys(r)||Zs(r))return r;throw new ei("Can't convert object to primitive value")}return void 0===t&&(t="number"),Qs(e,t)},ni=os,openapi_parser_si=function(e){var t=ri(e,"string");return ni(t)?t:t+""},ii=_n,oi=Lr.document,ci=ii(oi)&&ii(oi.createElement),ai=function(e){return ci?oi.createElement(e):{}},ui=ai,li=!hn&&!Ur((function(){return 7!==Object.defineProperty(ui("div"),"a",{get:function(){return 7}}).a})),hi=hn,fi=dn,pi=mn,di=xn,mi=Rn,vi=openapi_parser_si,yi=Ds,bi=li,gi=Object.getOwnPropertyDescriptor;ln.f=hi?gi:function(e,t){if(e=mi(e),t=vi(t),bi)try{return gi(e,t)}catch(e){}if(yi(e,t))return di(!fi(pi.f,e,t),e[t])};var wi=Ur,xi=un,ji=/#|\.prototype\./,Ei=function(e,t){var r=Oi[$i(e)];return r===Ai||r!==Si&&(xi(t)?wi(t):!!t)},$i=Ei.normalize=function(e){return String(e).replace(ji,".").toLowerCase()},Oi=Ei.data={},Si=Ei.NATIVE="N",Ai=Ei.POLYFILL="P",Pi=Ei,Ti=fs,ki=Jr,Fi=cn(cn.bind),Ii=function(e,t){return Ti(e),void 0===t?e:ki?Fi(e,t):function(){return e.apply(t,arguments)}},Ri={},Di=hn&&Ur((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),_i=_n,Ci=String,Mi=TypeError,Ni=function(e){if(_i(e))return e;throw new Mi(Ci(e)+" is not an object")},qi=hn,Bi=li,Li=Di,Ui=Ni,Ji=openapi_parser_si,Vi=TypeError,Gi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor;Ri.f=qi?Li?function(e,t,r){if(Ui(e),t=Ji(t),Ui(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=Hi(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return Gi(e,t,r)}:Gi:function(e,t,r){if(Ui(e),t=Ji(t),Ui(r),Bi)try{return Gi(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Vi("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var zi=Ri,Xi=xn,Wi=hn?function(e,t,r){return zi.f(e,t,Xi(1,r))}:function(e,t,r){return e[t]=r,e},Yi=Lr,Zi=Xr,Ki=cn,Qi=un,eo=ln.f,to=Pi,ro=Cn,no=Ii,so=Wi,io=Ds,oo=function(e){var t=function(r,n,s){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,s)}return Zi(e,this,arguments)};return t.prototype=e.prototype,t},co=function(e,t){var r,n,s,i,o,c,a,u,l,h=e.target,f=e.global,p=e.stat,d=e.proto,m=f?Yi:p?Yi[h]:Yi[h]&&Yi[h].prototype,v=f?ro:ro[h]||so(ro,h,{})[h],y=v.prototype;for(i in t)n=!(r=to(f?i:h+(p?".":"#")+i,e.forced))&&m&&io(m,i),c=v[i],n&&(a=e.dontCallGetSet?(l=eo(m,i))&&l.value:m[i]),o=n&&a?a:t[i],(r||d||typeof c!=typeof o)&&(u=e.bind&&n?no(o,Yi):e.wrap&&n?oo(o):d&&Qi(o)?Ki(o):o,(e.sham||o&&o.sham||c&&c.sham)&&so(u,"sham",!0),so(v,i,u),d&&(io(ro,s=h+"Prototype")||so(ro,s,{}),so(ro[s],i,o),e.real&&y&&(r||!y[i])&&so(y,i,o)))},ao=qs,uo=Ps("keys"),lo=function(e){return uo[e]||(uo[e]=ao(e))},ho=!Ur((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),fo=Ds,po=un,mo=Fs,vo=ho,yo=lo("IE_PROTO"),bo=Object,go=bo.prototype,wo=vo?bo.getPrototypeOf:function(e){var t=mo(e);if(fo(t,yo))return t[yo];var r=t.constructor;return po(r)&&t instanceof r?r.prototype:t instanceof bo?go:null},xo=Qr,jo=fs,Eo=_n,$o=function(e){return Eo(e)||null===e},Oo=String,So=TypeError,Ao=function(e,t,r){try{return xo(jo(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Po=_n,To=kn,ko=function(e){if($o(e))return e;throw new So("Can't set "+Oo(e)+" as a prototype")},Fo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Ao(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return To(r),ko(n),Po(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0),Io={},Ro=Math.ceil,Do=Math.floor,_o=Math.trunc||function(e){var t=+e;return(t>0?Do:Ro)(t)},Co=function(e){var t=+e;return t!=t||0===t?0:_o(t)},Mo=Co,No=Math.max,qo=Math.min,Bo=Co,Lo=Math.min,Uo=function(e){var t=Bo(e);return t>0?Lo(t,9007199254740991):0},Jo=function(e){return Uo(e.length)},Vo=Rn,Go=function(e,t){var r=Mo(e);return r<0?No(r+t,0):qo(r,t)},Ho=Jo,zo=function(e){return function(t,r,n){var s=Vo(t),i=Ho(s);if(0===i)return!e&&-1;var o,c=Go(n,i);if(e&&r!=r){for(;i>c;)if((o=s[c++])!=o)return!0}else for(;i>c;c++)if((e||c in s)&&s[c]===r)return e||c||0;return!e&&-1}},Xo={includes:zo(!0),indexOf:zo(!1)},Wo={},Yo=Ds,Zo=Rn,Ko=Xo.indexOf,Qo=Wo,ec=Qr([].push),tc=function(e,t){var r,n=Zo(e),s=0,i=[];for(r in n)!Yo(Qo,r)&&Yo(n,r)&&ec(i,r);for(;t.length>s;)Yo(n,r=t[s++])&&(~Ko(i,r)||ec(i,r));return i},rc=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],nc=tc,sc=rc.concat("length","prototype");Io.f=Object.getOwnPropertyNames||function(e){return nc(e,sc)};var ic={};ic.f=Object.getOwnPropertySymbols;var oc=Ln,cc=Io,ac=ic,uc=Ni,lc=Qr([].concat),hc=oc("Reflect","ownKeys")||function(e){var t=cc.f(uc(e)),r=ac.f;return r?lc(t,r(e)):t},fc=Ds,pc=hc,dc=ln,mc=Ri,vc=function(e,t,r){for(var n=pc(t),s=mc.f,i=dc.f,o=0;o<n.length;o++){var c=n[o];fc(e,c)||r&&fc(r,c)||s(e,c,i(t,c))}},yc={},bc=tc,gc=rc,wc=Object.keys||function(e){return bc(e,gc)},xc=hn,jc=Di,Ec=Ri,$c=Ni,Oc=Rn,Sc=wc;yc.f=xc&&!jc?Object.defineProperties:function(e,t){$c(e);for(var r,n=Oc(t),s=Sc(t),i=s.length,o=0;i>o;)Ec.f(e,r=s[o++],n[r]);return e};var Ac,Pc=Ln("document","documentElement"),Tc=Ni,kc=yc,Fc=rc,Ic=Wo,Rc=Pc,Dc=ai,_c=lo("IE_PROTO"),Cc=function(){},Mc=function(e){return"<script>"+e+"<\/script>"},Nc=function(e){e.write(Mc("")),e.close();var t=e.parentWindow.Object;return e=null,t},qc=function(){try{Ac=new ActiveXObject("htmlfile")}catch(e){}var e,t;qc="undefined"!=typeof document?document.domain&&Ac?Nc(Ac):((t=Dc("iframe")).style.display="none",Rc.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Mc("document.F=Object")),e.close(),e.F):Nc(Ac);for(var r=Fc.length;r--;)delete qc.prototype[Fc[r]];return qc()};Ic[_c]=!0;var Bc=Object.create||function(e,t){var r;return null!==e?(Cc.prototype=Tc(e),r=new Cc,Cc.prototype=null,r[_c]=e):r=qc(),void 0===t?r:kc.f(r,t)},Lc=_n,Uc=Wi,Jc=function(e,t){Lc(t)&&"cause"in t&&Uc(e,"cause",t.cause)},Vc=Error,Gc=Qr("".replace),Hc=String(new Vc("zxcasd").stack),zc=/\n\s*at [^:]*:[^\n]*/,Xc=zc.test(Hc),Wc=xn,Yc=!Ur((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Wc(1,7)),7!==e.stack)})),Zc=Wi,Kc=function(e,t){if(Xc&&"string"==typeof e&&!Vc.prepareStackTrace)for(;t--;)e=Gc(e,zc,"");return e},Qc=Yc,ea=Error.captureStackTrace,ta=function(e,t,r,n){Qc&&(ea?ea(e,t):Zc(e,"stack",Kc(r,n)))},ra={},na=ra,sa=Xs("iterator"),ia=Array.prototype,oa={};oa[Xs("toStringTag")]="z";var ca="[object z]"===String(oa),aa=ca,ua=un,la=nn,ha=Xs("toStringTag"),fa=Object,pa="Arguments"===la(function(){return arguments}()),da=aa?la:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=fa(e),ha))?r:pa?la(t):"Object"===(n=la(t))&&ua(t.callee)?"Arguments":n},ma=da,va=ms,ya=An,ba=ra,ga=Xs("iterator"),wa=function(e){if(!ya(e))return va(e,ga)||va(e,"@@iterator")||ba[ma(e)]},xa=dn,ja=fs,Ea=Ni,$a=as,Oa=wa,Sa=TypeError,Aa=dn,Pa=Ni,Ta=ms,ka=Ii,Fa=dn,Ia=Ni,Ra=as,Da=function(e){return void 0!==e&&(na.Array===e||ia[sa]===e)},_a=Jo,Ca=Un,Ma=function(e,t){var r=arguments.length<2?Oa(e):t;if(ja(r))return Ea(xa(r,e));throw new Sa($a(e)+" is not iterable")},Na=wa,qa=function(e,t,r){var n,s;Pa(e);try{if(!(n=Ta(e,"return"))){if("throw"===t)throw r;return r}n=Aa(n,e)}catch(e){s=!0,n=e}if("throw"===t)throw r;if(s)throw n;return Pa(n),r},Ba=TypeError,La=function(e,t){this.stopped=e,this.result=t},Ua=La.prototype,Ja=da,Va=String,Ga=function(e){if("Symbol"===Ja(e))throw new TypeError("Cannot convert a Symbol value to a string");return Va(e)},Ha=Ga,za=function(e,t){return void 0===e?arguments.length<2?"":t:Ha(e)},Xa=co,Wa=Un,Ya=wo,Za=Fo,Ka=vc,Qa=Bc,eu=Wi,tu=xn,ru=Jc,nu=ta,su=function(e,t,r){var n,s,i,o,c,a,u,l=r&&r.that,h=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),d=!(!r||!r.INTERRUPTED),m=ka(t,l),v=function(e){return n&&qa(n,"normal",e),new La(!0,e)},y=function(e){return h?(Ia(e),d?m(e[0],e[1],v):m(e[0],e[1])):d?m(e,v):m(e)};if(f)n=e.iterator;else if(p)n=e;else{if(!(s=Na(e)))throw new Ba(Ra(e)+" is not iterable");if(Da(s)){for(i=0,o=_a(e);o>i;i++)if((c=y(e[i]))&&Ca(Ua,c))return c;return new La(!1)}n=Ma(e,s)}for(a=f?e.next:n.next;!(u=Fa(a,n)).done;){try{c=y(u.value)}catch(e){qa(n,"throw",e)}if("object"==typeof c&&c&&Ca(Ua,c))return c}return new La(!1)},iu=za,ou=Xs("toStringTag"),cu=Error,au=[].push,uu=function(e,t){var r,n=Wa(lu,this);Za?r=Za(new cu,n?Ya(this):lu):(r=n?this:Qa(lu),eu(r,ou,"Error")),void 0!==t&&eu(r,"message",iu(t)),nu(r,uu,r.stack,1),arguments.length>2&&ru(r,arguments[2]);var s=[];return su(e,au,{that:s}),eu(r,"errors",s),r};Za?Za(uu,cu):Ka(uu,cu,{name:!0});var lu=uu.prototype=Qa(cu.prototype,{constructor:tu(1,uu),message:tu(1,""),name:tu(1,"AggregateError")});Xa({global:!0,constructor:!0,arity:2},{AggregateError:uu});var hu=Ri.f,fu=un,pu=_n,du=Fo,mu=Ln,vu=Wi,yu=Un,bu=Fo,gu=vc,wu=function(e,t,r){r in e||hu(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},xu=function(e,t,r){var n,s;return du&&fu(n=t.constructor)&&n!==r&&pu(s=n.prototype)&&s!==r.prototype&&du(e,s),e},ju=za,Eu=Jc,$u=ta,Ou=hn,Su=function(e,t,r,n){var s="stackTraceLimit",i=n?2:1,o=e.split("."),c=o[o.length-1],a=mu.apply(null,o);if(a){var u=a.prototype;if(!r)return a;var l=mu("Error"),h=t((function(e,t){var r=ju(n?t:e,void 0),s=n?new a(e):new a;return void 0!==r&&vu(s,"message",r),$u(s,h,s.stack,2),this&&yu(u,this)&&xu(s,this,h),arguments.length>i&&Eu(s,arguments[i]),s}));return h.prototype=u,"Error"!==c?bu?bu(h,l):gu(h,l,{name:!0}):Ou&&s in a&&(wu(h,a,s),wu(h,a,"prepareStackTrace")),gu(h,a),h}},Au=co,Pu=Xr,Tu=Su,ku=Lr.WebAssembly,Fu=7!==new Error("e",{cause:7}).cause,Iu=function(e,t){var r={};r[e]=Tu(e,t,Fu),Au({global:!0,constructor:!0,arity:1,forced:Fu},r)},Ru=function(e,t){if(ku&&ku[e]){var r={};r[e]=Tu("WebAssembly."+e,t,Fu),Au({target:"WebAssembly",stat:!0,constructor:!0,arity:1,forced:Fu},r)}};Iu("Error",(function(e){return function(t){return Pu(e,this,arguments)}})),Iu("EvalError",(function(e){return function(t){return Pu(e,this,arguments)}})),Iu("RangeError",(function(e){return function(t){return Pu(e,this,arguments)}})),Iu("ReferenceError",(function(e){return function(t){return Pu(e,this,arguments)}})),Iu("SyntaxError",(function(e){return function(t){return Pu(e,this,arguments)}})),Iu("TypeError",(function(e){return function(t){return Pu(e,this,arguments)}})),Iu("URIError",(function(e){return function(t){return Pu(e,this,arguments)}})),Ru("CompileError",(function(e){return function(t){return Pu(e,this,arguments)}})),Ru("LinkError",(function(e){return function(t){return Pu(e,this,arguments)}})),Ru("RuntimeError",(function(e){return function(t){return Pu(e,this,arguments)}}));var Du=co,_u=Xr,Cu=Ur,Mu=Su,Nu=Ln("AggregateError"),qu=!Cu((function(){return 1!==Nu([1]).errors[0]}))&&Cu((function(){return 7!==Nu([1],"AggregateError",{cause:7}).cause}));Du({global:!0,constructor:!0,arity:2,forced:qu},{AggregateError:Mu("AggregateError",(function(e){return function(t,r){return _u(e,this,arguments)}}),qu,!0)});var Bu,Lu,Uu,Ju=un,Vu=Lr.WeakMap,Gu=Ju(Vu)&&/native code/.test(String(Vu)),Hu=Lr,zu=_n,Xu=Wi,Wu=Ds,Yu=Ss,Zu=lo,Ku=Wo,Qu=Hu.TypeError,el=Hu.WeakMap;if(Gu||Yu.state){var tl=Yu.state||(Yu.state=new el);tl.get=tl.get,tl.has=tl.has,tl.set=tl.set,Bu=function(e,t){if(tl.has(e))throw new Qu("Object already initialized");return t.facade=e,tl.set(e,t),t},Lu=function(e){return tl.get(e)||{}},Uu=function(e){return tl.has(e)}}else{var rl=Zu("state");Ku[rl]=!0,Bu=function(e,t){if(Wu(e,rl))throw new Qu("Object already initialized");return t.facade=e,Xu(e,rl,t),t},Lu=function(e){return Wu(e,rl)?e[rl]:{}},Uu=function(e){return Wu(e,rl)}}var nl,sl,il,ol={set:Bu,get:Lu,has:Uu,enforce:function(e){return Uu(e)?Lu(e):Bu(e,{})},getterFor:function(e){return function(t){var r;if(!zu(t)||(r=Lu(t)).type!==e)throw new Qu("Incompatible receiver, "+e+" required");return r}}},cl=hn,al=Ds,ul=Function.prototype,ll=cl&&Object.getOwnPropertyDescriptor,hl=al(ul,"name"),fl={EXISTS:hl,PROPER:hl&&"something"===function(){}.name,CONFIGURABLE:hl&&(!cl||cl&&ll(ul,"name").configurable)},pl=Wi,dl=function(e,t,r,n){return n&&n.enumerable?e[t]=r:pl(e,t,r),e},ml=Ur,vl=un,yl=_n,bl=Bc,gl=wo,wl=dl,xl=Xs("iterator"),jl=!1;[].keys&&("next"in(il=[].keys())?(sl=gl(gl(il)))!==Object.prototype&&(nl=sl):jl=!0);var El=!yl(nl)||ml((function(){var e={};return nl[xl].call(e)!==e}));vl((nl=El?{}:bl(nl))[xl])||wl(nl,xl,(function(){return this}));var $l={IteratorPrototype:nl,BUGGY_SAFARI_ITERATORS:jl},Ol=da,Sl=ca?{}.toString:function(){return"[object "+Ol(this)+"]"},Al=ca,Pl=Ri.f,Tl=Wi,kl=Ds,Fl=Sl,Il=Xs("toStringTag"),Rl=function(e,t,r,n){var s=r?e:e&&e.prototype;s&&(kl(s,Il)||Pl(s,Il,{configurable:!0,value:t}),n&&!Al&&Tl(s,"toString",Fl))},Dl=$l.IteratorPrototype,_l=Bc,Cl=xn,Ml=Rl,Nl=ra,ql=function(){return this},Bl=co,Ll=dn,Ul=fl,Jl=function(e,t,r,n){var s=t+" Iterator";return e.prototype=_l(Dl,{next:Cl(+!n,r)}),Ml(e,s,!1,!0),Nl[s]=ql,e},Vl=wo,Gl=Rl,Hl=dl,zl=ra,Xl=$l,Wl=Ul.PROPER,Yl=Xl.BUGGY_SAFARI_ITERATORS,Zl=Xs("iterator"),Kl=function(){return this},Ql=function(e,t,r,n,s,i,o){Jl(r,t,n);var c,a,u,l=function(e){if(e===s&&m)return m;if(!Yl&&e&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",f=!1,p=e.prototype,d=p[Zl]||p["@@iterator"]||s&&p[s],m=!Yl&&d||l(s),v="Array"===t&&p.entries||d;if(v&&(c=Vl(v.call(new e)))!==Object.prototype&&c.next&&(Gl(c,h,!0,!0),zl[h]=Kl),Wl&&"values"===s&&d&&"values"!==d.name&&(f=!0,m=function(){return Ll(d,this)}),s)if(a={values:l("values"),keys:i?m:l("keys"),entries:l("entries")},o)for(u in a)(Yl||f||!(u in p))&&Hl(p,u,a[u]);else Bl({target:t,proto:!0,forced:Yl||f},a);return o&&p[Zl]!==m&&Hl(p,Zl,m,{name:s}),zl[t]=m,a},eh=function(e,t){return{value:e,done:t}},th=Rn,rh=ra,nh=ol;Ri.f;var sh=Ql,ih=eh,oh=nh.set,ch=nh.getterFor("Array Iterator");sh(Array,"Array",(function(e,t){oh(this,{type:"Array Iterator",target:th(e),index:0,kind:t})}),(function(){var e=ch(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,ih(void 0,!0);switch(e.kind){case"keys":return ih(r,!1);case"values":return ih(t[r],!1)}return ih([r,t[r]],!1)}),"values"),rh.Arguments=rh.Array;var ah=Qr,uh=Co,lh=Ga,hh=kn,fh=ah("".charAt),ph=ah("".charCodeAt),dh=ah("".slice),mh=function(e){return function(t,r){var n,s,i=lh(hh(t)),o=uh(r),c=i.length;return o<0||o>=c?e?"":void 0:(n=ph(i,o))<55296||n>56319||o+1===c||(s=ph(i,o+1))<56320||s>57343?e?fh(i,o):n:e?dh(i,o,o+2):s-56320+(n-55296<<10)+65536}},vh={codeAt:mh(!1),charAt:mh(!0)}.charAt,yh=Ga,bh=ol,gh=Ql,wh=eh,xh=bh.set,jh=bh.getterFor("String Iterator");gh(String,"String",(function(e){xh(this,{type:"String Iterator",string:yh(e),index:0})}),(function(){var e,t=jh(this),r=t.string,n=t.index;return n>=r.length?wh(void 0,!0):(e=vh(r,n),t.index+=e.length,wh(e,!1))}));var Eh=Cn.AggregateError,$h={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Oh=Lr,Sh=Rl,Ah=ra;for(var Ph in $h)Sh(Oh[Ph],Ph),Ah[Ph]=Ah.Array;const Th=dr(Eh);class kh extends Th{constructor(e,t,r){if(super(e,t,r),this.name=this.constructor.name,"string"==typeof t&&(this.message=t),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(t).stack,null!=r&&"object"==typeof r&&Object.hasOwn(r,"cause")&&!("cause"in this)){const{cause:e}=r;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}}}class Fh extends Error{static[Symbol.hasInstance](e){return super[Symbol.hasInstance](e)||Function.prototype[Symbol.hasInstance].call(kh,e)}constructor(e,t){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.hasOwn(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}}}class Ih extends Fh{constructor(e,t){if(super(e,t),null!=t&&"object"==typeof t){const{cause:e,...r}=t;Object.assign(this,r)}}}class Rh extends Fh{}class Dh extends Rh{}var _h=function(){return!1},Ch=function(){return!0};function Mh(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function Nh(e){return function t(r){return 0===arguments.length||Mh(r)?t:e.apply(this,arguments)}}function qh(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return Mh(r)?t:Nh((function(t){return e(r,t)}));default:return Mh(r)&&Mh(n)?t:Mh(r)?Nh((function(t){return e(t,n)})):Mh(n)?Nh((function(t){return e(r,t)})):e(r,n)}}}function Bh(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,n){return t.apply(this,arguments)};case 4:return function(e,r,n,s){return t.apply(this,arguments)};case 5:return function(e,r,n,s,i){return t.apply(this,arguments)};case 6:return function(e,r,n,s,i,o){return t.apply(this,arguments)};case 7:return function(e,r,n,s,i,o,c){return t.apply(this,arguments)};case 8:return function(e,r,n,s,i,o,c,a){return t.apply(this,arguments)};case 9:return function(e,r,n,s,i,o,c,a,u){return t.apply(this,arguments)};case 10:return function(e,r,n,s,i,o,c,a,u,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function Lh(e,t,r){return function(){for(var n=[],s=0,i=e,o=0,c=!1;o<t.length||s<arguments.length;){var a;o<t.length&&(!Mh(t[o])||s>=arguments.length)?a=t[o]:(a=arguments[s],s+=1),n[o]=a,Mh(a)?c=!0:i-=1,o+=1}return!c&&i<=0?r.apply(this,n):Bh(Math.max(0,i),Lh(e,n,r))}}var Uh=qh((function(e,t){return 1===e?Nh(t):Bh(e,Lh(e,[],t))}));function Jh(e){return function t(r,n,s){switch(arguments.length){case 0:return t;case 1:return Mh(r)?t:qh((function(t,n){return e(r,t,n)}));case 2:return Mh(r)&&Mh(n)?t:Mh(r)?qh((function(t,r){return e(t,n,r)})):Mh(n)?qh((function(t,n){return e(r,t,n)})):Nh((function(t){return e(r,n,t)}));default:return Mh(r)&&Mh(n)&&Mh(s)?t:Mh(r)&&Mh(n)?qh((function(t,r){return e(t,r,s)})):Mh(r)&&Mh(s)?qh((function(t,r){return e(t,n,r)})):Mh(n)&&Mh(s)?qh((function(t,n){return e(r,t,n)})):Mh(r)?Nh((function(t){return e(t,n,s)})):Mh(n)?Nh((function(t){return e(r,t,s)})):Mh(s)?Nh((function(t){return e(r,n,t)})):e(r,n,s)}}}const Vh=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)};function Gh(e){return null!=e&&"function"==typeof e["@@transducer/step"]}function Hh(e,t,r){return function(){if(0===arguments.length)return r();var n=arguments[arguments.length-1];if(!Vh(n)){for(var s=0;s<e.length;){if("function"==typeof n[e[s]])return n[e[s]].apply(n,Array.prototype.slice.call(arguments,0,-1));s+=1}if(Gh(n)){var i=t.apply(null,Array.prototype.slice.call(arguments,0,-1));return i(n)}}return r.apply(this,arguments)}}function zh(e){return e&&e["@@transducer/reduced"]?e:{"@@transducer/value":e,"@@transducer/reduced":!0}}const Xh=function(){return this.xf["@@transducer/init"]()},Wh=function(e){return this.xf["@@transducer/result"](e)};var Yh=function(){function e(e,t){this.xf=t,this.f=e,this.all=!0}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)||(this.all=!1,e=zh(this.xf["@@transducer/step"](e,!1))),e},e}();function Zh(e){return function(t){return new Yh(e,t)}}var Kh=qh(Hh(["all"],Zh,(function(e,t){for(var r=0;r<t.length;){if(!e(t[r]))return!1;r+=1}return!0})));function Qh(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function ef(e,t,r){for(var n=0,s=r.length;n<s;){if(e(t,r[n]))return!0;n+=1}return!1}function tf(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const rf="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var nf=Object.prototype.toString,sf=function(){return"[object Arguments]"===nf.call(arguments)?function(e){return"[object Arguments]"===nf.call(e)}:function(e){return tf("callee",e)}}(),of=!{toString:null}.propertyIsEnumerable("toString"),cf=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],af=function(){return arguments.propertyIsEnumerable("length")}(),uf=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1},lf="function"!=typeof Object.keys||af?Nh((function(e){if(Object(e)!==e)return[];var t,r,n=[],s=af&&sf(e);for(t in e)!tf(t,e)||s&&"length"===t||(n[n.length]=t);if(of)for(r=cf.length-1;r>=0;)tf(t=cf[r],e)&&!uf(n,t)&&(n[n.length]=t),r-=1;return n})):Nh((function(e){return Object(e)!==e?[]:Object.keys(e)})),hf=Nh((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function ff(e,t,r,n){var s=Qh(e);function i(e,t){return pf(e,t,r.slice(),n.slice())}return!ef((function(e,t){return!ef(i,t,e)}),Qh(t),s)}function pf(e,t,r,n){if(rf(e,t))return!0;var s=hf(e);if(s!==hf(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(s){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===function(e){var t=String(e).match(/^function (\w*)/);return null==t?"":t[1]}(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!rf(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!rf(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=r.length-1;i>=0;){if(r[i]===e)return n[i]===t;i-=1}switch(s){case"Map":return e.size===t.size&&ff(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&ff(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var o=lf(e);if(o.length!==lf(t).length)return!1;var c=r.concat([e]),a=n.concat([t]);for(i=o.length-1;i>=0;){var u=o[i];if(!tf(u,t)||!pf(t[u],e[u],c,a))return!1;i-=1}return!0}var df=qh((function(e,t){return pf(e,t,[],[])}));function mf(e,t){return function(e,t,r){var n,s;if("function"==typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(n=1/t;r<e.length;){if(0===(s=e[r])&&1/s===n)return r;r+=1}return-1}if(t!=t){for(;r<e.length;){if("number"==typeof(s=e[r])&&s!=s)return r;r+=1}return-1}return e.indexOf(t,r);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,r);case"object":if(null===t)return e.indexOf(t,r)}for(;r<e.length;){if(df(e[r],t))return r;r+=1}return-1}(t,e,0)>=0}function vf(e,t){for(var r=0,n=t.length,s=Array(n);r<n;)s[r]=e(t[r]),r+=1;return s}function yf(e){return'"'+e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var bf=function(e){return(e<10?"0":"")+e},gf="function"==typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+bf(e.getUTCMonth()+1)+"-"+bf(e.getUTCDate())+"T"+bf(e.getUTCHours())+":"+bf(e.getUTCMinutes())+":"+bf(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};function wf(e){return function(){return!e.apply(this,arguments)}}function xf(e,t,r){for(var n=0,s=r.length;n<s;)t=e(t,r[n]),n+=1;return t}function jf(e){return"[object Object]"===Object.prototype.toString.call(e)}var Ef=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=Wh,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}();function $f(e){return function(t){return new Ef(e,t)}}var Of=qh(Hh(["fantasy-land/filter","filter"],$f,(function(e,t){return jf(t)?xf((function(r,n){return e(t[n])&&(r[n]=t[n]),r}),{},lf(t)):function(e,t){for(var r=0,n=t.length,s=[];r<n;)e(t[r])&&(s[s.length]=t[r]),r+=1;return s}(e,t)}))),Sf=qh((function(e,t){return Of(wf(e),t)}));function Af(e,t){var r=function(r){var n=t.concat([e]);return mf(r,n)?"<Circular>":Af(r,n)},n=function(e,t){return vf((function(t){return yf(t)+": "+r(e[t])}),t.slice().sort())};switch(Object.prototype.toString.call(e)){case"[object Arguments]":return"(function() { return arguments; }("+vf(r,e).join(", ")+"))";case"[object Array]":return"["+vf(r,e).concat(n(e,Sf((function(e){return/^\d+$/.test(e)}),lf(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof e?"new Boolean("+r(e.valueOf())+")":e.toString();case"[object Date]":return"new Date("+(isNaN(e.valueOf())?r(NaN):yf(gf(e)))+")";case"[object Map]":return"new Map("+r(Array.from(e))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof e?"new Number("+r(e.valueOf())+")":1/e==-1/0?"-0":e.toString(10);case"[object Set]":return"new Set("+r(Array.from(e).sort())+")";case"[object String]":return"object"==typeof e?"new String("+r(e.valueOf())+")":yf(e);case"[object Undefined]":return"undefined";default:if("function"==typeof e.toString){var s=e.toString();if("[object Object]"!==s)return s}return"{"+n(e,lf(e)).join(", ")+"}"}}var Pf=Nh((function(e){return Af(e,[])})),Tf=qh((function(e,t){if(e===t)return t;function r(e,t){if(e>t!=t>e)return t>e?t:e}var n=r(e,t);if(void 0!==n)return n;var s=r(typeof e,typeof t);if(void 0!==s)return s===typeof e?e:t;var i=Pf(e),o=r(i,Pf(t));return void 0!==o&&o===i?e:t})),kf=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=Wh,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}(),Ff=qh(Hh(["fantasy-land/map","map"],(function(e){return function(t){return new kf(e,t)}}),(function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return Uh(t.length,(function(){return e.call(this,t.apply(this,arguments))}));case"[object Object]":return xf((function(r,n){return r[n]=e(t[n]),r}),{},lf(t));default:return vf(e,t)}})));const If=Number.isInteger||function(e){return e<<0===e};function Rf(e){return"[object String]"===Object.prototype.toString.call(e)}function Df(e,t){var r=e<0?t.length+e:e;return Rf(t)?t.charAt(r):t[r]}var _f=qh((function(e,t){if(null!=t)return If(e)?Df(e,t):t[e]})),Cf=qh((function(e,t){return Ff(_f(e),t)})),Mf=Nh((function(e){return!!Vh(e)||!!e&&("object"==typeof e&&(!Rf(e)&&(0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))})),Nf="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function qf(e,t,r){return function(n,s,i){if(Mf(i))return e(n,s,i);if(null==i)return s;if("function"==typeof i["fantasy-land/reduce"])return t(n,s,i,"fantasy-land/reduce");if(null!=i[Nf])return r(n,s,i[Nf]());if("function"==typeof i.next)return r(n,s,i);if("function"==typeof i.reduce)return t(n,s,i,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function Bf(e,t,r){for(var n=0,s=r.length;n<s;){if((t=e["@@transducer/step"](t,r[n]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n+=1}return e["@@transducer/result"](t)}var Lf=qh((function(e,t){return Bh(e.length,(function(){return e.apply(t,arguments)}))}));function Uf(e,t,r){for(var n=r.next();!n.done;){if((t=e["@@transducer/step"](t,n.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n=r.next()}return e["@@transducer/result"](t)}function Jf(e,t,r,n){return e["@@transducer/result"](r[n](Lf(e["@@transducer/step"],e),t))}var Vf=qf(Bf,Jf,Uf),Gf=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}();function Hf(e){return new Gf(e)}var zf=Jh((function(e,t,r){return Vf("function"==typeof e?Hf(e):e,t,r)})),Xf=Nh((function(e){return Uh(zf(Tf,0,Cf("length",e)),(function(){for(var t=0,r=e.length;t<r;){if(!e[t].apply(this,arguments))return!1;t+=1}return!0}))})),Wf=Nh((function(e){return function(){return e}})),Yf=qh((function(e,t){return e&&t})),Zf=Nh((function(e){return Uh(zf(Tf,0,Cf("length",e)),(function(){for(var t=0,r=e.length;t<r;){if(e[t].apply(this,arguments))return!0;t+=1}return!1}))}));function Kf(e,t,r){for(var n=r.next();!n.done;)t=e(t,n.value),n=r.next();return t}function Qf(e,t,r,n){return r[n](e,t)}var ep=qf(xf,Qf,Kf),tp=qh((function(e,t){return"function"==typeof t["fantasy-land/ap"]?t["fantasy-land/ap"](e):"function"==typeof e.ap?e.ap(t):"function"==typeof e?function(r){return e(r)(t(r))}:ep((function(e,r){return function(e,t){var r;t=t||[];var n=(e=e||[]).length,s=t.length,i=[];for(r=0;r<n;)i[i.length]=e[r],r+=1;for(r=0;r<s;)i[i.length]=t[r],r+=1;return i}(e,Ff(r,t))}),[],e)})),rp=qh((function(e,t){return e.apply(this,t)})),np=Nh((function(e){return Uh(e.length,e)}));var sp=Nh((function(e){return null==e})),ip=Jh((function e(t,r,n){if(0===t.length)return r;var s=t[0];if(t.length>1){var i=!sp(n)&&tf(s,n)&&"object"==typeof n[s]?n[s]:If(t[1])?[]:{};r=e(Array.prototype.slice.call(t,1),r,i)}return function(e,t,r){if(If(e)&&Vh(r)){var n=[].concat(r);return n[e]=t,n}var s={};for(var i in r)s[i]=r[i];return s[e]=t,s}(s,r,n)}));function op(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t}var cp=qh((function(e,t){var r=Uh(e,t);return Uh(e,(function(){return xf(tp,Ff(r,arguments[0]),Array.prototype.slice.call(arguments,1))}))})),ap=Nh((function(e){return cp(e.length,e)})),up=qh((function(e,t){return op(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:ap(Yf)(e,t)}));function lp(e){return new RegExp(e.source,e.flags?e.flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")+(e.dotAll?"s":""))}function hp(e,t,r){if(r||(r=new fp),function(e){var t=typeof e;return null==e||"object"!=t&&"function"!=t}(e))return e;var n=function(t){var n=r.get(e);if(n)return n;for(var s in r.set(e,t),e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t};switch(hf(e)){case"Object":return n(Object.create(Object.getPrototypeOf(e)));case"Array":return n(Array(e.length));case"Date":return new Date(e.valueOf());case"RegExp":return lp(e);case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return e.slice();default:return e}}var fp=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var r=this.hash(e),n=this.map[r];n||(this.map[r]=n=[]),n.push([e,t]),this.length+=1},e.prototype.hash=function(e){var t=[];for(var r in e)t.push(Object.prototype.toString.call(e[r]));return t.join()},e.prototype.get=function(e){if(this.length<=180)for(var t in this.map)for(var r=this.map[t],n=0;n<r.length;n+=1){if((i=r[n])[0]===e)return i[1]}else{var s=this.hash(e);if(r=this.map[s])for(n=0;n<r.length;n+=1){var i;if((i=r[n])[0]===e)return i[1]}}},e}(),pp=Nh((function(e){return function(t,r){return e(t,r)?-1:e(r,t)?1:0}})),dp=ap(Nh((function(e){return!e})));function mp(e,t){return function(){return t.call(this,e.apply(this,arguments))}}function vp(e,t){return function(){var r=arguments.length;if(0===r)return t();var n=arguments[r-1];return Vh(n)||"function"!=typeof n[e]?t.apply(this,arguments):n[e].apply(n,Array.prototype.slice.call(arguments,0,r-1))}}var yp=Jh(vp("slice",(function(e,t,r){return Array.prototype.slice.call(r,e,t)}))),bp=Nh(vp("tail",yp(1,1/0)));function gp(){if(0===arguments.length)throw new Error("pipe requires at least one argument");return Bh(arguments[0].length,zf(mp,arguments[0],bp(arguments)))}var wp=Nh((function(e){return Df(0,e)}));function xp(e){return e}var jp=Nh(xp),Ep=qh((function(e,t){return Uh(zf(Tf,0,Cf("length",t)),(function(){var r=arguments,n=this;return e.apply(n,vf((function(e){return e.apply(n,r)}),t))}))})),$p=function(){function e(e,t,r,n){this.valueFn=e,this.valueAcc=t,this.keyFn=r,this.xf=n,this.inputs={}}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=function(e){var t;for(t in this.inputs)if(tf(t,this.inputs)&&(e=this.xf["@@transducer/step"](e,this.inputs[t]))["@@transducer/reduced"]){e=e["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){var r=this.keyFn(t);return this.inputs[r]=this.inputs[r]||[r,hp(this.valueAcc)],this.inputs[r][1]=this.valueFn(this.inputs[r][1],t),e},e}();function Op(e,t,r){return function(n){return new $p(e,t,r,n)}}var Sp=Lh(4,[],Hh([],Op,(function(e,t,r,n){var s=Hf((function(n,s){var i=r(s),o=e(tf(i,n)?n[i]:hp(t),s);return o&&o["@@transducer/reduced"]?zh(n):(n[i]=o,n)}));return Vf(s,{},n)}))),Ap=qh((function(e,t){return null==t||t!=t?e:t})),Pp=function(){function e(){this._nativeSet="function"==typeof Set?new Set:null,this._items={}}return e.prototype.add=function(e){return!Tp(e,!0,this)},e.prototype.has=function(e){return Tp(e,!1,this)},e}();function Tp(e,t,r){var n,s=typeof e;switch(s){case"string":case"number":return 0===e&&1/e==-1/0?!!r._items["-0"]||(t&&(r._items["-0"]=!0),!1):null!==r._nativeSet?t?(n=r._nativeSet.size,r._nativeSet.add(e),r._nativeSet.size===n):r._nativeSet.has(e):s in r._items?e in r._items[s]||(t&&(r._items[s][e]=!0),!1):(t&&(r._items[s]={},r._items[s][e]=!0),!1);case"boolean":if(s in r._items){var i=e?1:0;return!!r._items[s][i]||(t&&(r._items[s][i]=!0),!1)}return t&&(r._items[s]=e?[!1,!0]:[!0,!1]),!1;case"function":return null!==r._nativeSet?t?(n=r._nativeSet.size,r._nativeSet.add(e),r._nativeSet.size===n):r._nativeSet.has(e):s in r._items?!!mf(e,r._items[s])||(t&&r._items[s].push(e),!1):(t&&(r._items[s]=[e]),!1);case"undefined":return!!r._items[s]||(t&&(r._items[s]=!0),!1);case"object":if(null===e)return!!r._items.null||(t&&(r._items.null=!0),!1);default:return(s=Object.prototype.toString.call(e))in r._items?!!mf(e,r._items[s])||(t&&r._items[s].push(e),!1):(t&&(r._items[s]=[e]),!1)}}var kp=qh((function(e,t){for(var r=[],n=0,s=e.length,i=t.length,o=new Pp,c=0;c<i;c+=1)o.add(t[c]);for(;n<s;)o.add(e[n])&&(r[r.length]=e[n]),n+=1;return r})),Fp=function(){function e(e,t){this.xf=t,this.n=e,this.i=0}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=Wh,e.prototype["@@transducer/step"]=function(e,t){this.i+=1;var r=0===this.n?e:this.xf["@@transducer/step"](e,t);return this.n>=0&&this.i>=this.n?zh(r):r},e}();function Ip(e){return function(t){return new Fp(e,t)}}var Rp=qh(Hh(["take"],Ip,(function(e,t){return yp(0,e<0?1/0:e,t)})));function Dp(e,t){for(var r=t.length-1;r>=0&&e(t[r]);)r-=1;return yp(0,r+1,t)}var _p=function(){function e(e,t){this.f=e,this.retained=[],this.xf=t}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=function(e){return this.retained=null,this.xf["@@transducer/result"](e)},e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.retain(e,t):this.flush(e,t)},e.prototype.flush=function(e,t){return e=Vf(this.xf,e,this.retained),this.retained=[],this.xf["@@transducer/step"](e,t)},e.prototype.retain=function(e,t){return this.retained.push(t),e},e}();function Cp(e){return function(t){return new _p(e,t)}}var Mp=qh(Hh([],Cp,Dp)),Np=Nh((function(e){return Df(-1,e)})),qp=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=Wh,e.prototype["@@transducer/step"]=function(e,t){if(this.f){if(this.f(t))return e;this.f=null}return this.xf["@@transducer/step"](e,t)},e}();function Bp(e){return function(t){return new qp(e,t)}}var Lp=qh(Hh(["dropWhile"],Bp,(function(e,t){for(var r=0,n=t.length;r<n&&e(t[r]);)r+=1;return yp(r,1/0,t)}))),Up=qh((function(e,t){return e||t})),Jp=qh((function(e,t){return op(e)?function(){return e.apply(this,arguments)||t.apply(this,arguments)}:ap(Up)(e,t)}));var Vp=Nh((function(e){return null!=e&&"function"==typeof e["fantasy-land/empty"]?e["fantasy-land/empty"]():null!=e&&null!=e.constructor&&"function"==typeof e.constructor["fantasy-land/empty"]?e.constructor["fantasy-land/empty"]():null!=e&&"function"==typeof e.empty?e.empty():null!=e&&null!=e.constructor&&"function"==typeof e.constructor.empty?e.constructor.empty():Vh(e)?[]:Rf(e)?"":jf(e)?{}:sf(e)?function(){return arguments}():function(e){var t=Object.prototype.toString.call(e);return"[object Uint8ClampedArray]"===t||"[object Int8Array]"===t||"[object Uint8Array]"===t||"[object Int16Array]"===t||"[object Uint16Array]"===t||"[object Int32Array]"===t||"[object Uint32Array]"===t||"[object Float32Array]"===t||"[object Float64Array]"===t||"[object BigInt64Array]"===t||"[object BigUint64Array]"===t}(e)?e.constructor.from(""):void 0})),Gp=Nh((function(e){return Uh(e.length,(function(t,r){var n=Array.prototype.slice.call(arguments,0);return n[0]=r,n[1]=t,e.apply(this,n)}))})),Hp=qh(vp("groupBy",Sp((function(e,t){return e.push(t),e}),[]))),zp=qh((function(e,t){if(0===e.length||sp(t))return!1;for(var r=t,n=0;n<e.length;){if(sp(r)||!tf(e[n],r))return!1;r=r[e[n]],n+=1}return!0})),Xp=qh((function(e,t){return zp([e],t)})),Wp=function(e,t){switch(arguments.length){case 0:return Wp;case 1:return function t(r){return 0===arguments.length?t:rf(e,r)};default:return rf(e,t)}},Yp=Jh((function(e,t,r){return Uh(Math.max(e.length,t.length,r.length),(function(){return e.apply(this,arguments)?t.apply(this,arguments):r.apply(this,arguments)}))})),Zp=qh(mf),Kp=yp(0,-1),Qp=qh((function(e,t){return Uh(e+1,(function(){var r=arguments[e];if(null!=r&&op(r[t]))return r[t].apply(r,Array.prototype.slice.call(arguments,0,e));throw new TypeError(Pf(r)+' does not have a method named "'+t+'"')}))})),ed=Nh((function(e){return null!=e&&df(e,Vp(e))})),td=Nh((function(e){return!ed(e)})),rd=Qp(1,"join");function nd(e){return"[object Number]"===Object.prototype.toString.call(e)}var sd=qh((function(e,t){return function(r){return function(n){return Ff((function(e){return t(e,n)}),r(e(n)))}}}));function id(e,t){for(var r=t,n=0;n<e.length;n+=1){if(null==r)return;var s=e[n];r=If(s)?Df(s,r):r[s]}return r}var od=qh((function(e,t){return xf((function(r,n){return r[n]=e(t[n],n,t),r}),{},lf(t))})),cd=Jh((function(e,t,r){var n,s={};for(n in r=r||{},t=t||{})tf(n,t)&&(s[n]=tf(n,r)?e(n,t[n],r[n]):t[n]);for(n in r)tf(n,r)&&!tf(n,s)&&(s[n]=r[n]);return s})),ad=Jh((function e(t,r,n){return cd((function(r,n,s){return jf(n)&&jf(s)?e(t,n,s):t(r,n,s)}),r,n)})),ud=qh((function(e,t){return ad((function(e,t,r){return r}),e,t)})),ld=qh((function(e,t){return Kh(wf(e),t)})),hd=function(e){return{value:e,map:function(t){return hd(t(e))}}},fd=Jh((function(e,t,r){return e((function(e){return hd(t(e))}))(r).value})),pd=qh(id),dd=Jh((function(e,t,r){return Ap(e,id(t,r))})),md=Jh((function(e,t,r){return e(id(t,r))})),vd=qh((function(e,t){for(var r={},n=0;n<e.length;)e[n]in t&&(r[e[n]]=t[e[n]]),n+=1;return r})),yd=Jh((function(e,t,r){return df(e,_f(t,r))})),bd=Jh((function(e,t,r){return Ap(e,_f(t,r))})),gd=Jh((function(e,t,r){return e(_f(t,r))})),wd=qh((function(e,t){if(!nd(e)||!nd(t))throw new TypeError("Both arguments to range must be numbers");for(var r=Array(e<t?t-e:0),n=e<0?t+Math.abs(e):t-e,s=0;s<n;)r[s]=s+e,s+=1;return r})),xd=Nh(zh),jd=Jh((function(e,t,r){return r.replace(e,t)})),Ed=qh((function(e,t){return Array.prototype.slice.call(t,0).sort(e)})),$d=Qp(1,"split"),Od=qh((function(e,t){return df(Rp(e.length,t),e)}));var Sd=qh((function(e,t){if(r=e,"[object RegExp]"!==Object.prototype.toString.call(r))throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received "+Pf(e));var r;return lp(e).test(t)})),Ad=function(){function e(e,t){this.xf=t,this.pred=e,this.items=[]}return e.prototype["@@transducer/init"]=Xh,e.prototype["@@transducer/result"]=Wh,e.prototype["@@transducer/step"]=function(e,t){return ef(this.pred,t,this.items)?e:(this.items.push(t),this.xf["@@transducer/step"](e,t))},e}();function Pd(e){return function(t){return new Ad(e,t)}}var Td=qh(Hh([],Pd,(function(e,t){for(var r,n=0,s=t.length,i=[];n<s;)ef(e,r=t[n],i)||(i[i.length]=r),n+=1;return i}))),kd=Jh((function(e,t,r){return e(r)?t(r):r})),Fd=Wf(void 0),Id=df(Fd()),Rd=dp(Id),Dd=df(null),_d=dp(Dd),Cd=dp(sp),Md=Uh(1,gp(hf,Wp("GeneratorFunction"))),Nd=Uh(1,gp(hf,Wp("AsyncFunction"))),qd=Zf([gp(hf,Wp("Function")),Md,Nd]),Bd=Uh(1,qd(Array.isArray)?Array.isArray:gp(hf,Wp("Array"))),Ld=up(Bd,ed),Ud=up(Bd,td),Jd=Uh(1,gp(hf,Wp("String"))),Vd=df("");function Gd(e){return Gd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gd(e)}var Hd=function(e){return"object"===Gd(e)},zd=dp(Uh(1,up(_d,Jp(Hd,qd)))),Xd=Xf([Jd,zd,td]),Wd=dp(qd),Yd=Uh(1,up(_d,Hd)),Zd=gp(hf,Wp("Object")),Kd=gp(Pf,df(Pf(Object))),Qd=md(up(qd,Kd),["constructor"]),em=Uh(1,(function(e){if(!Yd(e)||!Zd(e))return!1;var t=Object.getPrototypeOf(e);return!!Dd(t)||Qd(t)})),tm=up(Uh(1,gp(hf,Wp("Number"))),isFinite),rm=Uh(1,tm),nm=up(qd(Number.isFinite)?Uh(1,Lf(Number.isFinite,Number)):rm,Ep(df,[Math.floor,jp])),sm=Uh(1,nm),im=qd(Number.isInteger)?Uh(1,Lf(Number.isInteger,Number)):sm,om=Uh(1,gp(hf,Wp("RegExp")));function cm(e){return function(e){if(Array.isArray(e))return am(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return am(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?am(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function am(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var um,lm,hm=gp(Ed(pp((function(e,t){return e.length>t.length}))),wp,_f("length")),fm=np((function(e,t,r){var n=r.apply(void 0,cm(e));return Cd(n)?xd(n):t})),pm=Yp(Ud,(function(e){var t=hm(e);return Uh(t,(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return zf(fm(r),void 0,e)}))}),Fd),dm=Gp(Zp),mm=Uh(3,(function(e,t,r){var n=pd(e,r),s=pd(Kp(e),r);if(!Wd(n)&&!Ld(e)){var i=Lf(n,s);return rp(i,t)}})),vm=kd(Jd,jd(/[.*+?^${}()|[\]\\-]/g,"\\$&")),ym=function(e,t){if("string"!=typeof e&&!(e instanceof String))throw TypeError("`".concat(t,"` must be a string"))},bm=Uh(3,(function(e,t,r){!function(e,t,r){if(null==r||null==e||null==t)throw TypeError("Input values must not be `null` or `undefined`")}(e,t,r),ym(r,"str"),ym(t,"replaceValue"),function(e){if(!("string"==typeof e||e instanceof String||e instanceof RegExp))throw TypeError("`searchValue` must be a string or an regexp")}(e);var n=new RegExp(om(e)?e:vm(e),"g");return jd(n,t,r)})),gm=Qp(2,"replaceAll"),wm=qd(String.prototype.replaceAll)?gm:bm,xm=np((function(e,t){return gp($d(""),Mp(dm(e)),rd(""))(t)})),jm=np((function(e,t){return gp($d(""),Lp(dm(e)),rd(""))(t)})),Em={exports:{}},$m=Em.exports={};function Om(){throw new Error("setTimeout has not been defined")}function Sm(){throw new Error("clearTimeout has not been defined")}function Am(e){if(um===setTimeout)return setTimeout(e,0);if((um===Om||!um)&&setTimeout)return um=setTimeout,setTimeout(e,0);try{return um(e,0)}catch(t){try{return um.call(null,e,0)}catch(t){return um.call(this,e,0)}}}!function(){try{um="function"==typeof setTimeout?setTimeout:Om}catch(e){um=Om}try{lm="function"==typeof clearTimeout?clearTimeout:Sm}catch(e){lm=Sm}}();var Pm,Tm=[],km=!1,Fm=-1;function Im(){km&&Pm&&(km=!1,Pm.length?Tm=Pm.concat(Tm):Fm=-1,Tm.length&&Rm())}function Rm(){if(!km){var e=Am(Im);km=!0;for(var t=Tm.length;t;){for(Pm=Tm,Tm=[];++Fm<t;)Pm&&Pm[Fm].run();Fm=-1,t=Tm.length}Pm=null,km=!1,function(e){if(lm===clearTimeout)return clearTimeout(e);if((lm===Sm||!lm)&&clearTimeout)return lm=clearTimeout,clearTimeout(e);try{lm(e)}catch(t){try{return lm.call(null,e)}catch(t){return lm.call(this,e)}}}(e)}}function Dm(e,t){this.fun=e,this.array=t}function _m(){}$m.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Tm.push(new Dm(e,t)),1!==Tm.length||km||Am(Rm)},Dm.prototype.run=function(){this.fun.apply(null,this.array)},$m.title="browser",$m.browser=!0,$m.env={},$m.argv=[],$m.version="",$m.versions={},$m.on=_m,$m.addListener=_m,$m.once=_m,$m.off=_m,$m.removeListener=_m,$m.removeAllListeners=_m,$m.emit=_m,$m.prependListener=_m,$m.prependOnceListener=_m,$m.listeners=function(e){return[]},$m.binding=function(e){throw new Error("process.binding is not supported")},$m.cwd=function(){return"/"},$m.chdir=function(e){throw new Error("process.chdir is not supported")},$m.umask=function(){return 0};const Cm=dr(Em.exports),Mm=()=>md(Sd(/^win/),["platform"],Cm),Nm=e=>{try{const t=new URL(e);return xm(":",t.protocol)}catch{return}},qm=gp(Nm,Rd),Bm=e=>{const t=e.lastIndexOf(".");return t>=0?e.substring(t).toLowerCase():""},Lm=e=>{if(Cm.browser)return!1;const t=Nm(e);return Id(t)||"file"===t||/^[a-zA-Z]$/.test(t)},Um=e=>{const t=Nm(e);return"http"===t||"https"===t},Jm=(e,t)=>{const r=[/%23/g,"#",/%24/g,"$",/%26/g,"&",/%2C/g,",",/%40/g,"@"],n=bd(!1,"keepFileProtocol",t),s=bd(Mm,"isWindows",t);let i=decodeURI(e);for(let e=0;e<r.length;e+=2)i=i.replace(r[e],r[e+1]);let o="file://"===i.substring(0,7).toLowerCase();return o&&(i="/"===i[7]?i.substring(8):i.substring(7),s()&&"/"===i[1]&&(i=`${i[0]}:${i.substring(1)}`),n?i=`file:///${i}`:(o=!1,i=s()?i:`/${i}`)),s()&&!o&&(i=wm("/","\\",i),":\\"===i.substring(1,3)&&(i=i[0].toUpperCase()+i.substring(1))),i},Vm=e=>{const t=[/\?/g,"%3F",/#/g,"%23"];let r=e;Mm()&&(r=r.replace(/\\/g,"/")),r=encodeURI(r);for(let e=0;e<t.length;e+=2)r=r.replace(t[e],t[e+1]);return r},Gm=e=>{const t=e.indexOf("#");return-1!==t?e.substring(t):"#"},Hm=e=>{const t=e.indexOf("#");let r=e;return t>=0&&(r=e.substring(0,t)),r},zm=()=>{if(Cm.browser)return Hm(globalThis.location.href);const e=Cm.cwd(),t=Np(e);return["/","\\"].includes(t)?e:e+(Mm()?"\\":"/")},Xm=(e,t)=>{const r=new URL(t,new URL(e,"resolve://"));if("resolve:"===r.protocol){const{pathname:e,search:t,hash:n}=r;return e+t+n}return r.toString()},Wm=e=>{if(Lm(e))return Vm(Jm(e));try{return new URL(e).toString()}catch{return encodeURI(decodeURI(e)).replace(/%5B/g,"[").replace(/%5D/g,"]")}},Ym=e=>Lm(e)?Jm(e):decodeURI(e),Zm=Object.freeze(Object.defineProperty({__proto__:null,cwd:zm,fromFileSystemPath:Vm,getExtension:Bm,getHash:Gm,getProtocol:Nm,hasProtocol:qm,isFileSystemPath:Lm,isHttpUrl:Um,isURI:e=>{try{return new URL(e)&&!0}catch{return!1}},resolve:Xm,sanitize:Wm,stripHash:Hm,toFileSystemPath:Jm,unsanitize:Ym},Symbol.toStringTag,{value:"Module"}));let Km=class{uri;mediaType;data;parseResult;constructor({uri:e,mediaType:t="text/plain",data:r,parseResult:n}){this.uri=e,this.mediaType=t,this.data=r,this.parseResult=n}get extension(){return Jd(this.uri)?Bm(this.uri):""}toString(){if("string"==typeof this.data)return this.data;if(this.data instanceof ArrayBuffer||["ArrayBuffer"].includes(hf(this.data))||ArrayBuffer.isView(this.data)){return new TextDecoder("utf-8").decode(this.data)}return String(this.data)}};class Qm{rootRef;refs;circular;constructor({refs:e=[],circular:t=!1}={}){this.refs=[],this.circular=t,e.forEach(this.add.bind(this))}get size(){return this.refs.length}add(e){return this.has(e)||(this.refs.push(e),this.rootRef=void 0===this.rootRef?e:this.rootRef,e.refSet=this),this}merge(e){for(const t of e.values())this.add(t);return this}has(e){const t=Jd(e)?e:e.uri;return Rd(this.find((e=>e.uri===t)))}find(e){return this.refs.find(e)}*values(){yield*this.refs}clean(){this.refs.forEach((e=>{e.refSet=void 0})),this.rootRef=void 0,this.refs.length=0}}const ev={parse:{mediaType:"text/plain",parsers:[],parserOpts:{}},resolve:{baseURI:"",resolvers:[],resolverOpts:{},strategies:[],strategyOpts:{},internal:!0,external:!0,maxDepth:1/0},dereference:{strategies:[],strategyOpts:{},refSet:null,maxDepth:1/0,circular:"ignore",circularReplacer:jp,immutable:!0},bundle:{strategies:[],refSet:null,maxDepth:1/0}},tv=sd(pd(["resolve","baseURI"]),ip(["resolve","baseURI"])),rv=e=>Vd(e)?zm():e,nv=(e,t)=>{const r=ud(e,t);return fd(tv,rv,r)};class sv extends Fh{plugin;constructor(e,t){super(e,{cause:t.cause}),this.plugin=t.plugin}}const iv=async(e,t,r)=>{const n=await Promise.all(r.map(mm([e],t)));return r.filter(((e,t)=>n[t]))},ov=async(e,t,r)=>{let n;for(const s of r)try{const r=await s[e].call(s,...t);return{plugin:s,result:r}}catch(e){n=new sv("Error while running plugin",{cause:e,plugin:s})}return Promise.reject(n)};class cv extends Fh{}class av extends Fh{}class uv extends av{}class lv extends uv{}const hv=async(e,t)=>{const r=new Km({uri:Wm(Hm(e)),mediaType:t.parse.mediaType}),n=await(async(e,t)=>{const r=t.resolve.resolvers.map((e=>{const r=Object.create(e);return Object.assign(r,t.resolve.resolverOpts)})),n=await iv("canRead",[e,t],r);if(ed(n))throw new lv(e.uri);try{const{result:t}=await ov("read",[e],n);return t}catch(t){throw new av(`Error while reading file "${e.uri}"`,{cause:t})}})(r,t);return(async(e,t)=>{const r=t.parse.parsers.map((e=>{const r=Object.create(e);return Object.assign(r,t.parse.parserOpts)})),n=await iv("canParse",[e,t],r);if(ed(n))throw new lv(e.uri);try{const{plugin:r,result:s}=await ov("parse",[e,t],n);return!r.allowEmpty&&s.isEmpty?Promise.reject(new cv(`Error while parsing file "${e.uri}". File is empty.`)):s}catch(t){throw new cv(`Error while parsing file "${e.uri}"`,{cause:t})}})(new Km({...r,data:n}),t)};var fv=function(e){return null===e},pv="object"==typeof global&&global&&global.Object===Object&&global,dv=pv,mv="object"==typeof self&&self&&self.Object===Object&&self,vv=dv||mv||Function("return this")(),yv=vv.Symbol,bv=yv,gv=Object.prototype,wv=gv.hasOwnProperty,xv=gv.toString,jv=bv?bv.toStringTag:void 0;var Ev=function(e){var t=wv.call(e,jv),r=e[jv];try{e[jv]=void 0;var n=!0}catch(e){}var s=xv.call(e);return n&&(t?e[jv]=r:delete e[jv]),s},$v=Object.prototype.toString;var Ov=Ev,Sv=function(e){return $v.call(e)},Av=yv?yv.toStringTag:void 0;var Pv=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Av&&Av in Object(e)?Ov(e):Sv(e)},Tv=Array.isArray;var kv=function(e){return null!=e&&"object"==typeof e},Fv=Pv,Iv=Tv,Rv=kv;var Dv=function(e){return"string"==typeof e||!Iv(e)&&Rv(e)&&"[object String]"==Fv(e)},_v=Pv,Cv=kv;var Mv=function(e){return"number"==typeof e||Cv(e)&&"[object Number]"==_v(e)},Nv=Pv,qv=kv;var Bv=function(e){return!0===e||!1===e||qv(e)&&"[object Boolean]"==Nv(e)};var Lv=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var Uv=class{constructor(e){this.namespace=e||new this.Namespace}serialise(e){if(!(e instanceof this.namespace.elements.Element))throw new TypeError(`Given element \`${e}\` is not an Element instance`);const t={element:e.element};e._meta&&e._meta.length>0&&(t.meta=this.serialiseObject(e.meta)),e._attributes&&e._attributes.length>0&&(t.attributes=this.serialiseObject(e.attributes));const r=this.serialiseContent(e.content);return void 0!==r&&(t.content=r),t}deserialise(e){if(!e.element)throw new Error("Given value is not an object containing an element name");const t=new(this.namespace.getElementClass(e.element));t.element!==e.element&&(t.element=e.element),e.meta&&this.deserialiseObject(e.meta,t.meta),e.attributes&&this.deserialiseObject(e.attributes,t.attributes);const r=this.deserialiseContent(e.content);return void 0===r&&null!==t.content||(t.content=r),t}serialiseContent(e){if(e instanceof this.namespace.elements.Element)return this.serialise(e);if(e instanceof this.namespace.KeyValuePair){const t={key:this.serialise(e.key)};return e.value&&(t.value=this.serialise(e.value)),t}if(e&&e.map){if(0===e.length)return;return e.map(this.serialise,this)}return e}deserialiseContent(e){if(e){if(e.element)return this.deserialise(e);if(e.key){const t=new this.namespace.KeyValuePair(this.deserialise(e.key));return e.value&&(t.value=this.deserialise(e.value)),t}if(e.map)return e.map(this.deserialise,this)}return e}serialiseObject(e){const t={};if(e.forEach(((e,r)=>{e&&(t[r.toValue()]=this.serialise(e))})),0!==Object.keys(t).length)return t}deserialiseObject(e,t){Object.keys(e).forEach((r=>{t.set(r,this.deserialise(e[r]))}))}};var Jv=function(){this.u=[],this.size=0};var Vv=function(e,t){return e===t||e!=e&&t!=t},Gv=Vv;var Hv=function(e,t){for(var r=e.length;r--;)if(Gv(e[r][0],t))return r;return-1},zv=Hv,Xv=Array.prototype.splice;var Wv=function(e){var t=this.u,r=zv(t,e);return!(r<0)&&(r==t.length-1?t.pop():Xv.call(t,r,1),--this.size,!0)},Yv=Hv;var Zv=function(e){var t=this.u,r=Yv(t,e);return r<0?void 0:t[r][1]},Kv=Hv;var Qv=Hv;var ey=function(e,t){var r=this.u,n=Qv(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},ty=Jv,ry=Wv,ny=Zv,sy=function(e){return Kv(this.u,e)>-1},iy=ey;function oy(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}oy.prototype.clear=ty,oy.prototype.delete=ry,oy.prototype.get=ny,oy.prototype.has=sy,oy.prototype.set=iy;var cy=oy,ay=cy;var uy=function(){this.u=new ay,this.size=0};var ly=function(e){var t=this.u,r=t.delete(e);return this.size=t.size,r};var hy=function(e){return this.u.get(e)};var fy=function(e){return this.u.has(e)},py=Pv,dy=Lv;var my=function(e){if(!dy(e))return!1;var t=py(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},vy=vv["o"],yy=function(){var e=/[^.]+$/.exec(vy&&vy.keys&&vy.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var by=function(e){return!!yy&&yy in e},gy=Function.prototype.toString;var wy=function(e){if(null!=e){try{return gy.call(e)}catch(e){}try{return e+""}catch(e){}}return""},xy=my,jy=by,Ey=Lv,$y=wy,Oy=/^\[object .+?Constructor\]$/,Sy=Function.prototype,Ay=Object.prototype,Py=Sy.toString,Ty=Ay.hasOwnProperty,ky=RegExp("^"+Py.call(Ty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Fy=function(e){return!(!Ey(e)||jy(e))&&(xy(e)?ky:Oy).test($y(e))},Iy=function(e,t){return null==e?void 0:e[t]};var Ry=function(e,t){var r=Iy(e,t);return Fy(r)?r:void 0},Dy=Ry(vv,"Map"),_y=Ry(Object,"create"),Cy=_y;var My=function(){this.u=Cy?Cy(null):{},this.size=0};var Ny=function(e){var t=this.has(e)&&delete this.u[e];return this.size-=t?1:0,t},qy=_y,By=Object.prototype.hasOwnProperty;var Ly=function(e){var t=this.u;if(qy){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return By.call(t,e)?t[e]:void 0},Uy=_y,Jy=Object.prototype.hasOwnProperty;var Vy=function(e){var t=this.u;return Uy?void 0!==t[e]:Jy.call(t,e)},Gy=_y;var Hy=function(e,t){var r=this.u;return this.size+=this.has(e)?0:1,r[e]=Gy&&void 0===t?"__lodash_hash_undefined__":t,this},zy=My,Xy=Ny,Wy=Ly,Yy=Vy,Zy=Hy;function Ky(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ky.prototype.clear=zy,Ky.prototype.delete=Xy,Ky.prototype.get=Wy,Ky.prototype.has=Yy,Ky.prototype.set=Zy;var Qy=Ky,eb=cy,tb=Dy;var rb=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},nb=rb;var sb=function(e,t){var r=e.u;return nb(t)?r["string"==typeof t?"string":"hash"]:r.map},ib=sb;var ob=sb;var cb=sb;var ab=sb;var ub=function(e,t){var r=ab(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},lb=function(){this.size=0,this.u={hash:new Qy,map:new(tb||eb),string:new Qy}},hb=function(e){var t=ib(this,e).delete(e);return this.size-=t?1:0,t},fb=function(e){return ob(this,e).get(e)},pb=function(e){return cb(this,e).has(e)},db=ub;function mb(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}mb.prototype.clear=lb,mb.prototype.delete=hb,mb.prototype.get=fb,mb.prototype.has=pb,mb.prototype.set=db;var vb=mb,yb=cy,bb=Dy,gb=vb;var wb=function(e,t){var r=this.u;if(r instanceof yb){var n=r.u;if(!bb||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.u=new gb(n)}return r.set(e,t),this.size=r.size,this},xb=cy,jb=uy,Eb=ly,$b=hy,Ob=fy,Sb=wb;function Ab(e){var t=this.u=new xb(e);this.size=t.size}Ab.prototype.clear=jb,Ab.prototype.delete=Eb,Ab.prototype.get=$b,Ab.prototype.has=Ob,Ab.prototype.set=Sb;var Pb=Ab;var Tb=vb,kb=function(e){return this.u.set(e,"__lodash_hash_undefined__"),this},Fb=function(e){return this.u.has(e)};function Ib(e){var t=-1,r=null==e?0:e.length;for(this.u=new Tb;++t<r;)this.add(e[t])}Ib.prototype.add=Ib.prototype.push=kb,Ib.prototype.has=Fb;var Rb=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var Db=Ib,_b=Rb,Cb=function(e,t){return e.has(t)};var Mb=function(e,t,r,n,s,i){var o=1&r,c=e.length,a=t.length;if(c!=a&&!(o&&a>c))return!1;var u=i.get(e),l=i.get(t);if(u&&l)return u==t&&l==e;var h=-1,f=!0,p=2&r?new Db:void 0;for(i.set(e,t),i.set(t,e);++h<c;){var d=e[h],m=t[h];if(n)var v=o?n(m,d,h,t,e,i):n(d,m,h,e,t,i);if(void 0!==v){if(v)continue;f=!1;break}if(p){if(!_b(t,(function(e,t){if(!Cb(p,t)&&(d===e||s(d,e,r,n,i)))return p.push(t)}))){f=!1;break}}else if(d!==m&&!s(d,m,r,n,i)){f=!1;break}}return i.delete(e),i.delete(t),f};var Nb=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var qb=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Bb=vv.Uint8Array,Lb=Vv,Ub=Mb,Jb=Nb,Vb=qb,Gb=yv?yv.prototype:void 0,Hb=Gb?Gb.valueOf:void 0;var zb=function(e,t,r,n,s,i,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Bb(e),new Bb(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Lb(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var c=Jb;case"[object Set]":var a=1&n;if(c||(c=Vb),e.size!=t.size&&!a)return!1;var u=o.get(e);if(u)return u==t;n|=2,o.set(e,t);var l=Ub(c(e),c(t),n,s,i,o);return o.delete(e),l;case"[object Symbol]":if(Hb)return Hb.call(e)==Hb.call(t)}return!1};var Xb=function(e,t){for(var r=-1,n=t.length,s=e.length;++r<n;)e[s+r]=t[r];return e},Wb=Xb,Yb=Tv;var Zb=function(e,t,r){var n=t(e);return Yb(e)?n:Wb(n,r(e))};var Kb=function(e,t){for(var r=-1,n=null==e?0:e.length,s=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[s++]=o)}return i};var Qb=Kb,eg=function(){return[]},tg=Object.prototype.propertyIsEnumerable,rg=Object.getOwnPropertySymbols,ng=rg?function(e){return null==e?[]:(e=Object(e),Qb(rg(e),(function(t){return tg.call(e,t)})))}:eg;var sg=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n},ig=Pv,og=kv;var cg=function(e){return og(e)&&"[object Arguments]"==ig(e)},ag=kv,ug=Object.prototype,lg=ug.hasOwnProperty,hg=ug.propertyIsEnumerable,fg=cg(function(){return arguments}())?cg:function(e){return ag(e)&&lg.call(e,"callee")&&!hg.call(e,"callee")},pg={exports:{}};var dg=function(){return!1};!function(e,t){var r=vv,n=dg,s=t&&!t.nodeType&&t,i=s&&e&&!e.nodeType&&e,o=i&&i.exports===s?r.Buffer:void 0,c=(o?o.isBuffer:void 0)||n;e.exports=c}(pg,pg.exports);var mg=pg.exports,vg=/^(?:0|[1-9]\d*)$/;var yg=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&vg.test(e))&&e>-1&&e%1==0&&e<t};var bg=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},gg=Pv,wg=bg,xg=kv,jg={};jg["[object Float32Array]"]=jg["[object Float64Array]"]=jg["[object Int8Array]"]=jg["[object Int16Array]"]=jg["[object Int32Array]"]=jg["[object Uint8Array]"]=jg["[object Uint8ClampedArray]"]=jg["[object Uint16Array]"]=jg["[object Uint32Array]"]=!0,jg["[object Arguments]"]=jg["[object Array]"]=jg["[object ArrayBuffer]"]=jg["[object Boolean]"]=jg["[object DataView]"]=jg["[object Date]"]=jg["[object Error]"]=jg["[object Function]"]=jg["[object Map]"]=jg["[object Number]"]=jg["[object Object]"]=jg["[object RegExp]"]=jg["[object Set]"]=jg["[object String]"]=jg["[object WeakMap]"]=!1;var Eg=function(e){return xg(e)&&wg(e.length)&&!!jg[gg(e)]};var $g=function(e){return function(t){return e(t)}},Og={exports:{}};!function(e,t){var r=pv,n=t&&!t.nodeType&&t,s=n&&e&&!e.nodeType&&e,i=s&&s.exports===n&&r.process,o=function(){try{var e=s&&s.require&&s.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}(Og,Og.exports);var Sg=Og.exports,Ag=Eg,Pg=$g,Tg=Sg&&Sg.isTypedArray,kg=Tg?Pg(Tg):Ag,Fg=sg,Ig=fg,Rg=Tv,Dg=mg,_g=yg,Cg=kg,Mg=Object.prototype.hasOwnProperty;var Ng=function(e,t){var r=Rg(e),n=!r&&Ig(e),s=!r&&!n&&Dg(e),i=!r&&!n&&!s&&Cg(e),o=r||n||s||i,c=o?Fg(e.length,String):[],a=c.length;for(var u in e)!t&&!Mg.call(e,u)||o&&("length"==u||s&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||_g(u,a))||c.push(u);return c},qg=Object.prototype;var Bg=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||qg)};var Lg=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Ug=Bg,Jg=Lg,Vg=Object.prototype.hasOwnProperty;var Gg=my,Hg=bg;var zg=Ng,Xg=function(e){if(!Ug(e))return Jg(e);var t=[];for(var r in Object(e))Vg.call(e,r)&&"constructor"!=r&&t.push(r);return t},Wg=function(e){return null!=e&&Hg(e.length)&&!Gg(e)};var Yg=Zb,Zg=ng,Kg=function(e){return Wg(e)?zg(e):Xg(e)};var Qg=function(e){return Yg(e,Kg,Zg)},ew=Object.prototype.hasOwnProperty;var tw=function(e,t,r,n,s,i){var o=1&r,c=Qg(e),a=c.length;if(a!=Qg(t).length&&!o)return!1;for(var u=a;u--;){var l=c[u];if(!(o?l in t:ew.call(t,l)))return!1}var h=i.get(e),f=i.get(t);if(h&&f)return h==t&&f==e;var p=!0;i.set(e,t),i.set(t,e);for(var d=o;++u<a;){var m=e[l=c[u]],v=t[l];if(n)var y=o?n(v,m,l,t,e,i):n(m,v,l,e,t,i);if(!(void 0===y?m===v||s(m,v,r,n,i):y)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var b=e.constructor,g=t.constructor;b==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g||(p=!1)}return i.delete(e),i.delete(t),p},rw=Ry(vv,"DataView"),nw=Dy,sw=Ry(vv,"Promise"),iw=Ry(vv,"Set"),ow=Ry(vv,"WeakMap"),cw=Pv,aw=wy,uw=aw(rw),lw=aw(nw),hw=aw(sw),fw=aw(iw),pw=aw(ow),dw=cw;(rw&&"[object DataView]"!=dw(new rw(new ArrayBuffer(1)))||nw&&"[object Map]"!=dw(new nw)||sw&&"[object Promise]"!=dw(sw.resolve())||iw&&"[object Set]"!=dw(new iw)||ow&&"[object WeakMap]"!=dw(new ow))&&(dw=function(e){var t=cw(e),r="[object Object]"==t?e.constructor:void 0,n=r?aw(r):"";if(n)switch(n){case uw:return"[object DataView]";case lw:return"[object Map]";case hw:return"[object Promise]";case fw:return"[object Set]";case pw:return"[object WeakMap]"}return t});var mw=Pb,vw=Mb,yw=zb,bw=tw,gw=dw,ww=Tv,xw=mg,jw=kg,Ew="[object Object]",$w=Object.prototype.hasOwnProperty;var Ow=function(e,t,r,n,s,i){var o=ww(e),c=ww(t),a=o?"[object Array]":gw(e),u=c?"[object Array]":gw(t),l=(a="[object Arguments]"==a?Ew:a)==Ew,h=(u="[object Arguments]"==u?Ew:u)==Ew,f=a==u;if(f&&xw(e)){if(!xw(t))return!1;o=!0,l=!1}if(f&&!l)return i||(i=new mw),o||jw(e)?vw(e,t,r,n,s,i):yw(e,t,a,r,n,s,i);if(!(1&r)){var p=l&&$w.call(e,"__wrapped__"),d=h&&$w.call(t,"__wrapped__");if(p||d){var m=p?e.value():e,v=d?t.value():t;return i||(i=new mw),s(m,v,r,n,i)}}return!!f&&(i||(i=new mw),bw(e,t,r,n,s,i))},Sw=kv;var Aw=function e(t,r,n,s,i){return t===r||(null==t||null==r||!Sw(t)&&!Sw(r)?t!=t&&r!=r:Ow(t,r,n,s,e,i))},Pw=Aw;var Tw=function(e,t){return Pw(e,t)};var kw=class e{constructor(e,t){this.key=e,this.value=t}clone(){const t=new e;return this.key&&(t.key=this.key.clone()),this.value&&(t.value=this.value.clone()),t}};var Fw=function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}};const Iw=Fw;function Rw(e){return"string"==typeof e?t=>t.element===e:e.constructor&&e.extend?t=>t instanceof e:e}let Dw=class e{constructor(e){this.elements=e||[]}toValue(){return this.elements.map((e=>e.toValue()))}map(e,t){return this.elements.map(e,t)}flatMap(e,t){return this.map(e,t).reduce(((e,t)=>e.concat(t)),[])}compactMap(e,t){const r=[];return this.forEach((n=>{const s=e.bind(t)(n);s&&r.push(s)})),r}filter(t,r){return t=Rw(t),new e(this.elements.filter(t,r))}reject(t,r){return t=Rw(t),new e(this.elements.filter(Iw(t),r))}find(e,t){return e=Rw(e),this.elements.find(e,t)}forEach(e,t){this.elements.forEach(e,t)}reduce(e,t){return this.elements.reduce(e,t)}includes(e){return this.elements.some((t=>t.equals(e)))}shift(){return this.elements.shift()}unshift(e){this.elements.unshift(this.refract(e))}push(e){return this.elements.push(this.refract(e)),this}add(e){this.push(e)}get(e){return this.elements[e]}getValue(e){const t=this.elements[e];if(t)return t.toValue()}get length(){return this.elements.length}get isEmpty(){return 0===this.elements.length}get first(){return this.elements[0]}};"undefined"!=typeof Symbol&&(Dw.prototype[Symbol.iterator]=function(){return this.elements[Symbol.iterator]()});var _w=Dw;const Cw=Tw,Mw=kw,Nw=_w;var qw=class e{constructor(e,t,r){t&&(this.meta=t),r&&(this.attributes=r),this.content=e}freeze(){Object.isFrozen(this)||(this._meta&&(this.meta.parent=this,this.meta.freeze()),this._attributes&&(this.attributes.parent=this,this.attributes.freeze()),this.children.forEach((e=>{e.parent=this,e.freeze()}),this),this.content&&Array.isArray(this.content)&&Object.freeze(this.content),Object.freeze(this))}primitive(){}clone(){const e=new this.constructor;return e.element=this.element,this.meta.length&&(e._meta=this.meta.clone()),this.attributes.length&&(e._attributes=this.attributes.clone()),this.content?this.content.clone?e.content=this.content.clone():Array.isArray(this.content)?e.content=this.content.map((e=>e.clone())):e.content=this.content:e.content=this.content,e}toValue(){return this.content instanceof e?this.content.toValue():this.content instanceof Mw?{key:this.content.key.toValue(),value:this.content.value?this.content.value.toValue():void 0}:this.content&&this.content.map?this.content.map((e=>e.toValue()),this):this.content}toRef(e){if(""===this.id.toValue())throw Error("Cannot create reference to an element that does not contain an ID");const t=new this.RefElement(this.id.toValue());return e&&(t.path=e),t}findRecursive(...e){if(arguments.length>1&&!this.isFrozen)throw new Error("Cannot find recursive with multiple element names without first freezing the element. Call `element.freeze()`");const t=e.pop();let r=new Nw;const n=(e,t)=>(e.push(t),e),s=(e,r)=>{r.element===t&&e.push(r);const i=r.findRecursive(t);return i&&i.reduce(n,e),r.content instanceof Mw&&(r.content.key&&s(e,r.content.key),r.content.value&&s(e,r.content.value)),e};return this.content&&(this.content.element&&s(r,this.content),Array.isArray(this.content)&&this.content.reduce(s,r)),e.isEmpty||(r=r.filter((t=>{let r=t.parents.map((e=>e.element));for(const t in e){const n=e[t],s=r.indexOf(n);if(-1===s)return!1;r=r.splice(0,s)}return!0}))),r}set(e){return this.content=e,this}equals(e){return Cw(this.toValue(),e)}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}get element(){return this._storedElement||"element"}set element(e){this._storedElement=e}get content(){return this._content}set content(t){if(t instanceof e)this._content=t;else if(t instanceof Nw)this.content=t.elements;else if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"null"===t||null==t)this._content=t;else if(t instanceof Mw)this._content=t;else if(Array.isArray(t))this._content=t.map(this.refract);else{if("object"!=typeof t)throw new Error("Cannot set content to given value");this._content=Object.keys(t).map((e=>new this.MemberElement(e,t[e])))}}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof this.ObjectElement?this._meta=e:this.meta.set(e||{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof this.ObjectElement?this._attributes=e:this.attributes.set(e||{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get title(){return this.getMetaProperty("title","")}set title(e){this.setMetaProperty("title",e)}get description(){return this.getMetaProperty("description","")}set description(e){this.setMetaProperty("description",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get isFrozen(){return Object.isFrozen(this)}get parents(){let{parent:e}=this;const t=new Nw;for(;e;)t.push(e),e=e.parent;return t}get children(){if(Array.isArray(this.content))return new Nw(this.content);if(this.content instanceof Mw){const e=new Nw([this.content.key]);return this.content.value&&e.push(this.content.value),e}return this.content instanceof e?new Nw([this.content]):new Nw}get recursiveChildren(){const e=new Nw;return this.children.forEach((t=>{e.push(t),t.recursiveChildren.forEach((t=>{e.push(t)}))})),e}};const Bw=qw;var Lw=class extends Bw{constructor(e,t,r){super(e||null,t,r),this.element="null"}primitive(){return"null"}set(){return new Error("Cannot set the value of null")}};const Uw=qw;const Jw=qw;const Vw=qw;const Gw=Fw,Hw=qw,zw=_w;let Xw=class extends Hw{constructor(e,t,r){super(e||[],t,r),this.element="array"}primitive(){return"array"}get(e){return this.content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}getIndex(e){return this.content[e]}set(e,t){return this.content[e]=this.refract(t),this}remove(e){const t=this.content.splice(e,1);return t.length?t[0]:null}map(e,t){return this.content.map(e,t)}flatMap(e,t){return this.map(e,t).reduce(((e,t)=>e.concat(t)),[])}compactMap(e,t){const r=[];return this.forEach((n=>{const s=e.bind(t)(n);s&&r.push(s)})),r}filter(e,t){return new zw(this.content.filter(e,t))}reject(e,t){return this.filter(Gw(e),t)}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n="object"===this.primitive()?this.first.value:this.first);for(let t=r;t<this.length;t+=1){const r=this.content[t];n="object"===this.primitive()?this.refract(e(n,r.value,r.key,r,this)):this.refract(e(n,r,t,this))}return n}forEach(e,t){this.content.forEach(((r,n)=>{e.bind(t)(r,this.refract(n))}))}shift(){return this.content.shift()}unshift(e){this.content.unshift(this.refract(e))}push(e){return this.content.push(this.refract(e)),this}add(e){this.push(e)}findElements(e,t){const r=t||{},n=!!r.recursive,s=void 0===r.results?[]:r.results;return this.forEach(((t,r,i)=>{n&&void 0!==t.findElements&&t.findElements(e,{results:s,recursive:n}),e(t,r,i)&&s.push(t)})),s}find(e){return new zw(this.findElements(e,{recursive:!0}))}findByElement(e){return this.find((t=>t.element===e))}findByClass(e){return this.find((t=>t.classes.includes(e)))}getById(e){return this.find((t=>t.id.toValue()===e)).first}includes(e){return this.content.some((t=>t.equals(e)))}contains(e){return this.includes(e)}empty(){return new this.constructor([])}"fantasy-land/empty"(){return this.empty()}concat(e){return new this.constructor(this.content.concat(e.content))}"fantasy-land/concat"(e){return this.concat(e)}"fantasy-land/map"(e){return new this.constructor(this.map(e))}"fantasy-land/chain"(e){return this.map((t=>e(t)),this).reduce(((e,t)=>e.concat(t)),this.empty())}"fantasy-land/filter"(e){return new this.constructor(this.content.filter(e))}"fantasy-land/reduce"(e,t){return this.content.reduce(e,t)}get length(){return this.content.length}get isEmpty(){return 0===this.content.length}get first(){return this.getIndex(0)}get second(){return this.getIndex(1)}get last(){return this.getIndex(this.length-1)}};Xw.empty=function(){return new this},Xw["fantasy-land/empty"]=Xw.empty,"undefined"!=typeof Symbol&&(Xw.prototype[Symbol.iterator]=function(){return this.content[Symbol.iterator]()});var Ww=Xw;const Yw=kw,Zw=qw;var Kw=class extends Zw{constructor(e,t,r,n){super(new Yw,r,n),this.element="member",this.key=e,this.value=t}get key(){return this.content.key}set key(e){this.content.key=this.refract(e)}get value(){return this.content.value}set value(e){this.content.value=this.refract(e)}};const Qw=Fw,ex=_w;var tx=class e extends ex{map(e,t){return this.elements.map((r=>e.bind(t)(r.value,r.key,r)))}filter(t,r){return new e(this.elements.filter((e=>t.bind(r)(e.value,e.key,e))))}reject(e,t){return this.filter(Qw(e.bind(t)))}forEach(e,t){return this.elements.forEach(((r,n)=>{e.bind(t)(r.value,r.key,r,n)}))}keys(){return this.map(((e,t)=>t.toValue()))}values(){return this.map((e=>e.toValue()))}};const rx=Fw,nx=Lv,sx=Ww,ix=Kw,ox=tx;var cx=class extends sx{constructor(e,t,r){super(e||[],t,r),this.element="object"}primitive(){return"object"}toValue(){return this.content.reduce(((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e)),{})}get(e){const t=this.getMember(e);if(t)return t.value}getMember(e){if(void 0!==e)return this.content.find((t=>t.key.toValue()===e))}remove(e){let t=null;return this.content=this.content.filter((r=>r.key.toValue()!==e||(t=r,!1))),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if(nx(e))return Object.keys(e).forEach((t=>{this.set(t,e[t])})),this;const r=e,n=this.getMember(r);return n?n.value=t:this.content.push(new ix(r,t)),this}keys(){return this.content.map((e=>e.key.toValue()))}values(){return this.content.map((e=>e.value.toValue()))}hasKey(e){return this.content.some((t=>t.key.equals(e)))}items(){return this.content.map((e=>[e.key.toValue(),e.value.toValue()]))}map(e,t){return this.content.map((r=>e.bind(t)(r.value,r.key,r)))}compactMap(e,t){const r=[];return this.forEach(((n,s,i)=>{const o=e.bind(t)(n,s,i);o&&r.push(o)})),r}filter(e,t){return new ox(this.content).filter(e,t)}reject(e,t){return this.filter(rx(e),t)}forEach(e,t){return this.content.forEach((r=>e.bind(t)(r.value,r.key,r)))}};const ax=qw;const ux=qw;const lx=qw,hx=Lw,fx=class extends Uw{constructor(e,t,r){super(e,t,r),this.element="string"}primitive(){return"string"}get length(){return this.content.length}},px=class extends Jw{constructor(e,t,r){super(e,t,r),this.element="number"}primitive(){return"number"}},dx=class extends Vw{constructor(e,t,r){super(e,t,r),this.element="boolean"}primitive(){return"boolean"}},mx=Ww,vx=Kw,yx=cx,bx=class extends ax{constructor(e,t,r){super(e||[],t,r),this.element="link"}get relation(){return this.attributes.get("relation")}set relation(e){this.attributes.set("relation",e)}get href(){return this.attributes.get("href")}set href(e){this.attributes.set("href",e)}},gx=class extends ux{constructor(e,t,r){super(e||[],t,r),this.element="ref",this.path||(this.path="element")}get path(){return this.attributes.get("path")}set path(e){this.attributes.set("path",e)}},wx=_w,xx=tx,jx=kw;function Ex(e){if(e instanceof lx)return e;if("string"==typeof e)return new fx(e);if("number"==typeof e)return new px(e);if("boolean"==typeof e)return new dx(e);if(null===e)return new hx;if(Array.isArray(e))return new mx(e.map(Ex));if("object"==typeof e){return new yx(e)}return e}lx.prototype.ObjectElement=yx,lx.prototype.RefElement=gx,lx.prototype.MemberElement=vx,lx.prototype.refract=Ex,wx.prototype.refract=Ex;var $x={Element:lx,NullElement:hx,StringElement:fx,NumberElement:px,BooleanElement:dx,ArrayElement:mx,MemberElement:vx,ObjectElement:yx,LinkElement:bx,RefElement:gx,refract:Ex,ArraySlice:wx,ObjectSlice:xx,KeyValuePair:jx};const Ox=fv,Sx=Dv,Ax=Mv,Px=Bv,Tx=Lv,kx=Uv,Fx=$x;let Ix=class{constructor(e){this.elementMap={},this.elementDetection=[],this.Element=Fx.Element,this.KeyValuePair=Fx.KeyValuePair,e&&e.noDefault||this.useDefault(),this._attributeElementKeys=[],this._attributeElementArrayKeys=[]}use(e){return e.namespace&&e.namespace({base:this}),e.load&&e.load({base:this}),this}useDefault(){return this.register("null",Fx.NullElement).register("string",Fx.StringElement).register("number",Fx.NumberElement).register("boolean",Fx.BooleanElement).register("array",Fx.ArrayElement).register("object",Fx.ObjectElement).register("member",Fx.MemberElement).register("ref",Fx.RefElement).register("link",Fx.LinkElement),this.detect(Ox,Fx.NullElement,!1).detect(Sx,Fx.StringElement,!1).detect(Ax,Fx.NumberElement,!1).detect(Px,Fx.BooleanElement,!1).detect(Array.isArray,Fx.ArrayElement,!1).detect(Tx,Fx.ObjectElement,!1),this}register(e,t){return this._elements=void 0,this.elementMap[e]=t,this}unregister(e){return this._elements=void 0,delete this.elementMap[e],this}detect(e,t,r){return void 0===r||r?this.elementDetection.unshift([e,t]):this.elementDetection.push([e,t]),this}toElement(e){if(e instanceof this.Element)return e;let t;for(let r=0;r<this.elementDetection.length;r+=1){const n=this.elementDetection[r][0],s=this.elementDetection[r][1];if(n(e)){t=new s(e);break}}return t}getElementClass(e){const t=this.elementMap[e];return void 0===t?this.Element:t}fromRefract(e){return this.serialiser.deserialise(e)}toRefract(e){return this.serialiser.serialise(e)}get elements(){return void 0===this._elements&&(this._elements={Element:this.Element},Object.keys(this.elementMap).forEach((e=>{const t=e[0].toUpperCase()+e.substr(1);this._elements[t]=this.elementMap[e]}))),this._elements}get serialiser(){return new kx(this)}};kx.prototype.Namespace=Ix;var Rx=Ix,Dx=kw,_x=$x.ArraySlice,Cx=$x.ObjectSlice,Mx=$x.Element,Nx=$x.StringElement,qx=$x.NumberElement,Bx=$x.BooleanElement,Lx=$x.NullElement,Ux=$x.ArrayElement,Jx=$x.ObjectElement,Vx=$x.MemberElement,Gx=$x.RefElement,Hx=$x.LinkElement,zx=$x.refract;class Xx extends Nx{constructor(e,t,r){super(e,t,r),this.element="annotation"}get code(){return this.attributes.get("code")}set code(e){this.attributes.set("code",e)}}class Wx extends Nx{constructor(e,t,r){super(e,t,r),this.element="comment"}}class Yx extends Ux{constructor(e,t,r){super(e,t,r),this.element="parseResult"}get api(){return this.children.filter((e=>e.classes.contains("api"))).first}get results(){return this.children.filter((e=>e.classes.contains("result")))}get result(){return this.results.first}get annotations(){return this.children.filter((e=>"annotation"===e.element))}get warnings(){return this.children.filter((e=>"annotation"===e.element&&e.classes.contains("warning")))}get errors(){return this.children.filter((e=>"annotation"===e.element&&e.classes.contains("error")))}get isEmpty(){return this.children.reject((e=>"annotation"===e.element)).isEmpty}replaceResult(e){const{result:t}=this;if(Id(t))return!1;const r=this.content.findIndex((e=>e===t));return-1!==r&&(this.content[r]=e,!0)}}class Zx extends Ux{constructor(e,t,r){super(e,t,r),this.element="sourceMap"}get positionStart(){return this.children.filter((e=>e.classes.contains("position"))).get(0)}get positionEnd(){return this.children.filter((e=>e.classes.contains("position"))).get(1)}set position(e){if(void 0===e)return;const t=new Ux([e.start.row,e.start.column,e.start.char]),r=new Ux([e.end.row,e.end.column,e.end.char]);t.classes.push("position"),r.classes.push("position"),this.push(t).push(r)}}const Kx=(e,t)=>"object"==typeof t&&null!==t&&e in t&&"function"==typeof t[e],Qx=e=>"object"==typeof e&&null!=e&&"_storedElement"in e&&"string"==typeof e._storedElement&&"_content"in e,ej=(e,t)=>"object"==typeof t&&null!==t&&"primitive"in t&&("function"==typeof t.primitive&&t.primitive()===e),tj=(e,t)=>"object"==typeof t&&null!==t&&"classes"in t&&(Array.isArray(t.classes)||t.classes instanceof Ux)&&t.classes.includes(e),rj=(e,t)=>"object"==typeof t&&null!==t&&"element"in t&&t.element===e,nj=e=>e({hasMethod:Kx,hasBasicElementProps:Qx,primitiveEq:ej,isElementType:rj,hasClass:tj}),sj=nj((({hasBasicElementProps:e,primitiveEq:t})=>r=>r instanceof Mx||e(r)&&t(void 0,r))),ij=nj((({hasBasicElementProps:e,primitiveEq:t})=>r=>r instanceof Nx||e(r)&&t("string",r))),oj=nj((({hasBasicElementProps:e,primitiveEq:t})=>r=>r instanceof qx||e(r)&&t("number",r))),cj=nj((({hasBasicElementProps:e,primitiveEq:t})=>r=>r instanceof Lx||e(r)&&t("null",r))),aj=nj((({hasBasicElementProps:e,primitiveEq:t})=>r=>r instanceof Bx||e(r)&&t("boolean",r))),uj=nj((({hasBasicElementProps:e,primitiveEq:t,hasMethod:r})=>n=>n instanceof Jx||e(n)&&t("object",n)&&r("keys",n)&&r("values",n)&&r("items",n))),lj=nj((({hasBasicElementProps:e,primitiveEq:t,hasMethod:r})=>n=>n instanceof Ux&&!(n instanceof Jx)||e(n)&&t("array",n)&&r("push",n)&&r("unshift",n)&&r("map",n)&&r("reduce",n))),hj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Vx||e(n)&&t("member",n)&&r(void 0,n))),fj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Hx||e(n)&&t("link",n)&&r(void 0,n))),pj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Gx||e(n)&&t("ref",n)&&r(void 0,n))),dj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Xx||e(n)&&t("annotation",n)&&r("array",n))),mj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Wx||e(n)&&t("comment",n)&&r("string",n))),vj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Yx||e(n)&&t("parseResult",n)&&r("array",n))),yj=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof Zx||e(n)&&t("sourceMap",n)&&r("array",n))),bj=e=>rj("object",e)||rj("array",e)||rj("boolean",e)||rj("number",e)||rj("string",e)||rj("null",e)||rj("member",e),gj=e=>yj(e.meta.get("sourceMap")),wj=(e,t)=>0===e.length||Kh(dm(t.classes.toValue()),e),xj=Object.freeze(Object.defineProperty({__proto__:null,hasElementSourceMap:gj,includesClasses:wj,includesSymbols:(e,t)=>{if(0===e.length)return!0;const r=t.attributes.get("symbols");return!!lj(r)&&Kh(dm(r.toValue()),e)},isAnnotationElement:dj,isArrayElement:lj,isBooleanElement:aj,isCommentElement:mj,isElement:sj,isLinkElement:fj,isMemberElement:hj,isNullElement:cj,isNumberElement:oj,isObjectElement:uj,isParseResultElement:vj,isPrimitiveElement:bj,isRefElement:pj,isSourceMapElement:yj,isStringElement:ij},Symbol.toStringTag,{value:"Module"}));class jj extends Rx{constructor(){super(),this.register("annotation",Xx),this.register("comment",Wx),this.register("parseResult",Yx),this.register("sourceMap",Zx)}}const Ej=new jj,$j=e=>{const t=new jj;return em(e)&&t.use(e),t},Oj=()=>({predicates:{...xj},namespace:Ej}),Sj=(e,t,r)=>{const n=e[t];if(null!=n){if(!r&&"function"==typeof n)return n;const e=r?n.leave:n.enter;if("function"==typeof e)return e}else{const n=r?e.leave:e.enter;if(null!=n){if("function"==typeof n)return n;const e=n[t];if("function"==typeof e)return e}}return null},Aj={},Pj=e=>null==e?void 0:e.type,Tj=e=>"string"==typeof Pj(e),kj=e=>Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e)),Fj=(e,{visitFnGetter:t=Sj,nodeTypeGetter:r=Pj,breakSymbol:n=Aj,deleteNodeSymbol:s=null,skipVisitingNodeSymbol:i=!1,exposeEdits:o=!1}={})=>{const c=Symbol("skip"),a=new Array(e.length).fill(c);return{enter(u,l,h,f,p,d){let m=u,v=!1;const y={...d,replaceWith(e,t){d.replaceWith(e,t),m=e}};for(let u=0;u<e.length;u+=1)if(a[u]===c){const c=t(e[u],r(m),!1);if("function"==typeof c){const t=c.call(e[u],m,l,h,f,p,y);if("function"==typeof(null==t?void 0:t.then))throw new Ih("Async visitor not supported in sync mode",{visitor:e[u],visitFn:c});if(t===i)a[u]=m;else if(t===n)a[u]=n;else{if(t===s)return t;if(void 0!==t){if(!o)return t;m=t,v=!0}}}}return v?m:void 0},leave(s,o,u,l,h,f){let p=s;const d={...f,replaceWith(e,t){f.replaceWith(e,t),p=e}};for(let s=0;s<e.length;s+=1)if(a[s]===c){const c=t(e[s],r(p),!0);if("function"==typeof c){const t=c.call(e[s],p,o,u,l,h,d);if("function"==typeof(null==t?void 0:t.then))throw new Ih("Async visitor not supported in sync mode",{visitor:e[s],visitFn:c});if(t===n)a[s]=n;else if(void 0!==t&&t!==i)return t}}else a[s]===p&&(a[s]=c)}}};Fj[Symbol.for("nodejs.util.promisify.custom")]=(e,{visitFnGetter:t=Sj,nodeTypeGetter:r=Pj,breakSymbol:n=Aj,deleteNodeSymbol:s=null,skipVisitingNodeSymbol:i=!1,exposeEdits:o=!1}={})=>{const c=Symbol("skip"),a=new Array(e.length).fill(c);return{async enter(u,l,h,f,p,d){let m=u,v=!1;const y={...d,replaceWith(e,t){d.replaceWith(e,t),m=e}};for(let u=0;u<e.length;u+=1)if(a[u]===c){const c=t(e[u],r(m),!1);if("function"==typeof c){const t=await c.call(e[u],m,l,h,f,p,y);if(t===i)a[u]=m;else if(t===n)a[u]=n;else{if(t===s)return t;if(void 0!==t){if(!o)return t;m=t,v=!0}}}}return v?m:void 0},async leave(s,o,u,l,h,f){let p=s;const d={...f,replaceWith(e,t){f.replaceWith(e,t),p=e}};for(let s=0;s<e.length;s+=1)if(a[s]===c){const c=t(e[s],r(p),!0);if("function"==typeof c){const t=await c.call(e[s],p,o,u,l,h,d);if(t===n)a[s]=n;else if(void 0!==t&&t!==i)return t}}else a[s]===p&&(a[s]=c)}}};const Ij=(e,t,{keyMap:r=null,state:n={},breakSymbol:s=Aj,deleteNodeSymbol:i=null,skipVisitingNodeSymbol:o=!1,visitFnGetter:c=Sj,nodeTypeGetter:a=Pj,nodePredicate:u=Tj,nodeCloneFn:l=kj,detectCycles:h=!0}={})=>{const f=r||{};let p,d,m=Array.isArray(e),v=[e],y=-1,b=[],g=e;const w=[],x=[];do{y+=1;const e=y===v.length;let r;const $=e&&0!==b.length;if(e){if(r=0===x.length?void 0:w.pop(),g=d,d=x.pop(),$)if(m){g=g.slice();let e=0;for(const[t,r]of b){const n=t-e;r===i?(g.splice(n,1),e+=1):g[n]=r}}else{g=l(g);for(const[e,t]of b)g[e]=t}y=p.index,v=p.keys,b=p.edits,m=p.inArray,p=p.prev}else if(d!==i&&void 0!==d){if(r=m?y:v[y],g=d[r],g===i||void 0===g)continue;w.push(r)}let O;if(!Array.isArray(g)){var j;if(!u(g))throw new Ih(`Invalid AST Node: ${String(g)}`,{node:g});if(h&&x.includes(g)){w.pop();continue}const i=c(t,a(g),e);if(i){for(const[e,r]of Object.entries(n))t[e]=r;const s={replaceWith(t,n){"function"==typeof n?n(t,g,r,d,w,x):d&&(d[r]=t),e||(g=t)}};O=i.call(t,g,r,d,w,x,s)}if("function"==typeof(null===(j=O)||void 0===j?void 0:j.then))throw new Ih("Async visitor not supported in sync mode",{visitor:t,visitFn:i});if(O===s)break;if(O===o){if(!e){w.pop();continue}}else if(void 0!==O&&(b.push([r,O]),!e)){if(!u(O)){w.pop();continue}g=O}}var E;if(void 0===O&&$&&b.push([r,g]),!e)p={inArray:m,index:y,keys:v,edits:b,prev:p},m=Array.isArray(g),v=m?g:null!==(E=f[a(g)])&&void 0!==E?E:[],y=-1,b=[],d!==i&&void 0!==d&&x.push(d),d=g}while(void 0!==p);return 0!==b.length?b[b.length-1][1]:e};Ij[Symbol.for("nodejs.util.promisify.custom")]=async(e,t,{keyMap:r=null,state:n={},breakSymbol:s=Aj,deleteNodeSymbol:i=null,skipVisitingNodeSymbol:o=!1,visitFnGetter:c=Sj,nodeTypeGetter:a=Pj,nodePredicate:u=Tj,nodeCloneFn:l=kj,detectCycles:h=!0}={})=>{const f=r||{};let p,d,m=Array.isArray(e),v=[e],y=-1,b=[],g=e;const w=[],x=[];do{y+=1;const e=y===v.length;let r;const E=e&&0!==b.length;if(e){if(r=0===x.length?void 0:w.pop(),g=d,d=x.pop(),E)if(m){g=g.slice();let e=0;for(const[t,r]of b){const n=t-e;r===i?(g.splice(n,1),e+=1):g[n]=r}}else{g=l(g);for(const[e,t]of b)g[e]=t}y=p.index,v=p.keys,b=p.edits,m=p.inArray,p=p.prev}else if(d!==i&&void 0!==d){if(r=m?y:v[y],g=d[r],g===i||void 0===g)continue;w.push(r)}let $;if(!Array.isArray(g)){if(!u(g))throw new Ih(`Invalid AST Node: ${String(g)}`,{node:g});if(h&&x.includes(g)){w.pop();continue}const i=c(t,a(g),e);if(i){for(const[e,r]of Object.entries(n))t[e]=r;const s={replaceWith(t,n){"function"==typeof n?n(t,g,r,d,w,x):d&&(d[r]=t),e||(g=t)}};$=await i.call(t,g,r,d,w,x,s)}if($===s)break;if($===o){if(!e){w.pop();continue}}else if(void 0!==$&&(b.push([r,$]),!e)){if(!u($)){w.pop();continue}g=$}}var j;if(void 0===$&&E&&b.push([r,g]),!e)p={inArray:m,index:y,keys:v,edits:b,prev:p},m=Array.isArray(g),v=m?g:null!==(j=f[a(g)])&&void 0!==j?j:[],y=-1,b=[],d!==i&&void 0!==d&&x.push(d),d=g}while(void 0!==p);return 0!==b.length?b[b.length-1][1]:e};class Rj extends Ih{value;constructor(e,t){super(e,t),void 0!==t&&(this.value=t.value)}}class Dj extends Rj{}class _j extends Rj{}const Cj=(e,t={})=>{const{visited:r=new WeakMap}=t,n={...t,visited:r};if(r.has(e))return r.get(e);if(e instanceof Dx){const{key:t,value:s}=e,i=sj(t)?Cj(t,n):t,o=sj(s)?Cj(s,n):s,c=new Dx(i,o);return r.set(e,c),c}if(e instanceof Cx){const t=e=>Cj(e,n),s=[...e].map(t),i=new Cx(s);return r.set(e,i),i}if(e instanceof _x){const t=e=>Cj(e,n),s=[...e].map(t),i=new _x(s);return r.set(e,i),i}if(sj(e)){const t=qj(e);if(r.set(e,t),e.content)if(sj(e.content))t.content=Cj(e.content,n);else if(e.content instanceof Dx)t.content=Cj(e.content,n);else if(Array.isArray(e.content)){const r=e=>Cj(e,n);t.content=e.content.map(r)}else t.content=e.content;else t.content=e.content;return t}throw new Dj("Value provided to cloneDeep function couldn't be cloned",{value:e})};Cj.safe=e=>{try{return Cj(e)}catch{return e}};const Mj=e=>{const{key:t,value:r}=e;return new Dx(t,r)},Nj=e=>{const t=new e.constructor;if(t.element=e.element,e.meta.length>0&&(t._meta=Cj(e.meta)),e.attributes.length>0&&(t._attributes=Cj(e.attributes)),sj(e.content)){const r=e.content;t.content=Nj(r)}else Array.isArray(e.content)?t.content=[...e.content]:e.content instanceof Dx?t.content=Mj(e.content):t.content=e.content;return t},qj=e=>{if(e instanceof Dx)return Mj(e);if(e instanceof Cx)return(e=>{const t=[...e];return new Cx(t)})(e);if(e instanceof _x)return(e=>{const t=[...e];return new _x(t)})(e);if(sj(e))return Nj(e);throw new _j("Value provided to cloneShallow function couldn't be cloned",{value:e})};qj.safe=e=>{try{return qj(e)}catch{return e}};const Bj=e=>uj(e)?"ObjectElement":lj(e)?"ArrayElement":hj(e)?"MemberElement":ij(e)?"StringElement":aj(e)?"BooleanElement":oj(e)?"NumberElement":cj(e)?"NullElement":fj(e)?"LinkElement":pj(e)?"RefElement":void 0,Lj=e=>sj(e)?qj(e):kj(e),Uj=gp(Bj,Jd),Jj={ObjectElement:["content"],ArrayElement:["content"],MemberElement:["key","value"],StringElement:[],BooleanElement:[],NumberElement:[],NullElement:[],RefElement:[],LinkElement:[],Annotation:[],Comment:[],ParseResultElement:["content"],SourceMap:["content"]};class Vj{result;predicate;returnOnTrue;returnOnFalse;constructor({predicate:e=_h,returnOnTrue:t,returnOnFalse:r}={}){this.result=[],this.predicate=e,this.returnOnTrue=t,this.returnOnFalse=r}enter(e){return this.predicate(e)?(this.result.push(e),this.returnOnTrue):this.returnOnFalse}}const Gj=(e,t,{keyMap:r=Jj,...n}={})=>Ij(e,t,{keyMap:r,nodeTypeGetter:Bj,nodePredicate:Uj,nodeCloneFn:Lj,...n});Gj[Symbol.for("nodejs.util.promisify.custom")]=async(e,t,{keyMap:r=Jj,...n}={})=>Ij[Symbol.for("nodejs.util.promisify.custom")](e,t,{keyMap:r,nodeTypeGetter:Bj,nodePredicate:Uj,nodeCloneFn:Lj,...n});const Hj={toolboxCreator:Oj,visitorOptions:{nodeTypeGetter:Bj,exposeEdits:!0}},zj=(e,t,r={})=>{if(0===t.length)return e;const n=ud(Hj,r),{toolboxCreator:s,visitorOptions:i}=n,o=s(),c=t.map((e=>e(o))),a=Fj(c.map(bd({},"visitor")),{...i});c.forEach(mm(["pre"],[]));const u=Gj(e,a,i);return c.forEach(mm(["post"],[])),u};zj[Symbol.for("nodejs.util.promisify.custom")]=async(e,t,r={})=>{if(0===t.length)return e;const n=ud(Hj,r),{toolboxCreator:s,visitorOptions:i}=n,o=s(),c=t.map((e=>e(o))),a=Fj[Symbol.for("nodejs.util.promisify.custom")],u=Gj[Symbol.for("nodejs.util.promisify.custom")],l=a(c.map(bd({},"visitor")),{...i});await Promise.allSettled(c.map(mm(["pre"],[])));const h=await u(e,l,i);return await Promise.allSettled(c.map(mm(["post"],[]))),h};var Xj={exports:{}};!function(e){var t=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,o=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,c=(e,t)=>{for(var r in t||(t={}))s.call(t,r)&&o(e,r,t[r]);if(n)for(var r of n(t))i.call(t,r)&&o(e,r,t[r]);return e},a=(e,t,r)=>(o(e,"symbol"!=typeof t?t+"":t,r),r),u={};((t,r)=>{for(var n in r)e(t,n,{get:r[n],enumerable:!0})})(u,{DEFAULT_OPTIONS:()=>h,DEFAULT_UUID_LENGTH:()=>l,default:()=>p});var l=6,h={dictionary:"alphanum",shuffle:!0,debug:!1,length:l,counter:0},f=class{constructor(e={}){a(this,"counter"),a(this,"debug"),a(this,"dict"),a(this,"version"),a(this,"dictIndex",0),a(this,"dictRange",[]),a(this,"lowerBound",0),a(this,"upperBound",0),a(this,"dictLength",0),a(this,"uuidLength"),a(this,"_digit_first_ascii",48),a(this,"_digit_last_ascii",58),a(this,"_alpha_lower_first_ascii",97),a(this,"_alpha_lower_last_ascii",123),a(this,"_hex_last_ascii",103),a(this,"_alpha_upper_first_ascii",65),a(this,"_alpha_upper_last_ascii",91),a(this,"_number_dict_ranges",{digits:[this._digit_first_ascii,this._digit_last_ascii]}),a(this,"_alpha_dict_ranges",{lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii],upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),a(this,"_alpha_lower_dict_ranges",{lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii]}),a(this,"_alpha_upper_dict_ranges",{upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),a(this,"_alphanum_dict_ranges",{digits:[this._digit_first_ascii,this._digit_last_ascii],lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii],upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),a(this,"_alphanum_lower_dict_ranges",{digits:[this._digit_first_ascii,this._digit_last_ascii],lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii]}),a(this,"_alphanum_upper_dict_ranges",{digits:[this._digit_first_ascii,this._digit_last_ascii],upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),a(this,"_hex_dict_ranges",{decDigits:[this._digit_first_ascii,this._digit_last_ascii],alphaDigits:[this._alpha_lower_first_ascii,this._hex_last_ascii]}),a(this,"_dict_ranges",{_number_dict_ranges:this._number_dict_ranges,_alpha_dict_ranges:this._alpha_dict_ranges,_alpha_lower_dict_ranges:this._alpha_lower_dict_ranges,_alpha_upper_dict_ranges:this._alpha_upper_dict_ranges,_alphanum_dict_ranges:this._alphanum_dict_ranges,_alphanum_lower_dict_ranges:this._alphanum_lower_dict_ranges,_alphanum_upper_dict_ranges:this._alphanum_upper_dict_ranges,_hex_dict_ranges:this._hex_dict_ranges}),a(this,"log",((...e)=>{const t=[...e];if(t[0]=`[short-unique-id] ${e[0]}`,!0===this.debug&&"undefined"!=typeof console&&null!==console)return console.log(...t)})),a(this,"_normalizeDictionary",((e,t)=>{let r;if(e&&Array.isArray(e)&&e.length>1)r=e;else{let t;r=[],this.dictIndex=t=0;const n=`_${e}_dict_ranges`,s=this._dict_ranges[n];Object.keys(s).forEach((e=>{const n=e;for(this.dictRange=s[n],this.lowerBound=this.dictRange[0],this.upperBound=this.dictRange[1],this.dictIndex=t=this.lowerBound;this.lowerBound<=this.upperBound?t<this.upperBound:t>this.upperBound;this.dictIndex=this.lowerBound<=this.upperBound?t+=1:t-=1)r.push(String.fromCharCode(this.dictIndex))}))}if(t){const e=.5;r=r.sort((()=>Math.random()-e))}return r})),a(this,"setDictionary",((e,t)=>{this.dict=this._normalizeDictionary(e,t),this.dictLength=this.dict.length,this.setCounter(0)})),a(this,"seq",(()=>this.sequentialUUID())),a(this,"sequentialUUID",(()=>{let e,t,r="";e=this.counter;do{t=e%this.dictLength,e=Math.trunc(e/this.dictLength),r+=this.dict[t]}while(0!==e);return this.counter+=1,r})),a(this,"rnd",((e=this.uuidLength||l)=>this.randomUUID(e))),a(this,"randomUUID",((e=this.uuidLength||l)=>{let t,r,n;if(null==e||e<1)throw new Error("Invalid UUID Length Provided");for(t="",n=0;n<e;n+=1)r=parseInt((Math.random()*this.dictLength).toFixed(0),10)%this.dictLength,t+=this.dict[r];return t})),a(this,"fmt",((e,t)=>this.formattedUUID(e,t))),a(this,"formattedUUID",((e,t)=>{const r={$r:this.randomUUID,$s:this.sequentialUUID,$t:this.stamp};return e.replace(/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,(e=>{const n=e.slice(0,2),s=parseInt(e.slice(2),10);return"$s"===n?r[n]().padStart(s,"0"):"$t"===n&&t?r[n](s,t):r[n](s)}))})),a(this,"availableUUIDs",((e=this.uuidLength)=>parseFloat(Math.pow([...new Set(this.dict)].length,e).toFixed(0)))),a(this,"approxMaxBeforeCollision",((e=this.availableUUIDs(this.uuidLength))=>parseFloat(Math.sqrt(Math.PI/2*e).toFixed(20)))),a(this,"collisionProbability",((e=this.availableUUIDs(this.uuidLength),t=this.uuidLength)=>parseFloat((this.approxMaxBeforeCollision(e)/this.availableUUIDs(t)).toFixed(20)))),a(this,"uniqueness",((e=this.availableUUIDs(this.uuidLength))=>{const t=parseFloat((1-this.approxMaxBeforeCollision(e)/e).toFixed(20));return t>1?1:t<0?0:t})),a(this,"getVersion",(()=>this.version)),a(this,"stamp",((e,t)=>{const r=Math.floor(+(t||new Date)/1e3).toString(16);if("number"==typeof e&&0===e)return r;if("number"!=typeof e||e<10)throw new Error(["Param finalLength must be a number greater than or equal to 10,","or 0 if you want the raw hexadecimal timestamp"].join("\n"));const n=e-9,s=Math.round(Math.random()*(n>15?15:n)),i=this.randomUUID(n);return`${i.substring(0,s)}${r}${i.substring(s)}${s.toString(16)}`})),a(this,"parseStamp",((e,t)=>{if(t&&!/t0|t[1-9]\d{1,}/.test(t))throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");const r=t?t.replace(/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,(e=>{const t={$r:e=>[...Array(e)].map((()=>"r")).join(""),$s:e=>[...Array(e)].map((()=>"s")).join(""),$t:e=>[...Array(e)].map((()=>"t")).join("")},r=e.slice(0,2),n=parseInt(e.slice(2),10);return t[r](n)})).replace(/^(.*?)(t{8,})(.*)$/g,((t,r,n)=>e.substring(r.length,r.length+n.length))):e;if(8===r.length)return new Date(1e3*parseInt(r,16));if(r.length<10)throw new Error("Stamp length invalid");const n=parseInt(r.substring(r.length-1),16);return new Date(1e3*parseInt(r.substring(n,n+8),16))})),a(this,"setCounter",(e=>{this.counter=e})),a(this,"validate",((e,t)=>{const r=t?this._normalizeDictionary(t):this.dict;return e.split("").every((e=>r.includes(e)))}));const t=c(c({},h),e);this.counter=0,this.debug=!1,this.dict=[],this.version="5.2.0";const{dictionary:r,shuffle:n,length:s,counter:i}=t;return this.uuidLength=s,this.setDictionary(r,n),this.setCounter(i),this.debug=t.debug,this.log(this.dict),this.log(`Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`),this.log=this.log.bind(this),this.setDictionary=this.setDictionary.bind(this),this.setCounter=this.setCounter.bind(this),this.seq=this.seq.bind(this),this.sequentialUUID=this.sequentialUUID.bind(this),this.rnd=this.rnd.bind(this),this.randomUUID=this.randomUUID.bind(this),this.fmt=this.fmt.bind(this),this.formattedUUID=this.formattedUUID.bind(this),this.availableUUIDs=this.availableUUIDs.bind(this),this.approxMaxBeforeCollision=this.approxMaxBeforeCollision.bind(this),this.collisionProbability=this.collisionProbability.bind(this),this.uniqueness=this.uniqueness.bind(this),this.getVersion=this.getVersion.bind(this),this.stamp=this.stamp.bind(this),this.parseStamp=this.parseStamp.bind(this),this}};a(f,"default",f);var p=f;return(n=>((n,i,o,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of r(i))s.call(n,a)||a===o||e(n,a,{get:()=>i[a],enumerable:!(c=t(i,a))||c.enumerable});return n})(e({},"__esModule",{value:!0}),n))(u)})();e.exports=t.default,"undefined"!=typeof window&&(t=t.default)}(Xj);const Wj=dr(Xj.exports);class Yj extends Ih{value;constructor(e,t){super(e,t),void 0!==t&&(this.value=t.value)}}class Zj{uuid;identityMap;constructor({length:e=6}={}){this.uuid=new Wj({length:e}),this.identityMap=new WeakMap}identify(e){if(!sj(e))throw new Yj("Cannot not identify the element. `element` is neither structurally compatible nor a subclass of an Element class.",{value:e});if(e.meta.hasKey("id")&&ij(e.meta.get("id"))&&!e.meta.get("id").equals(""))return e.id;if(this.identityMap.has(e))return this.identityMap.get(e);const t=new Nx(this.generateId());return this.identityMap.set(e,t),t}forget(e){return!!this.identityMap.has(e)&&(this.identityMap.delete(e),!0)}generateId(){return this.uuid.randomUUID()}}new Zj;class Kj extends Array{unknownMediaType="application/octet-stream";filterByFormat(){throw new Dh("filterByFormat method in MediaTypes class is not yet implemented.")}findBy(){throw new Dh("findBy method in MediaTypes class is not yet implemented.")}latest(){throw new Dh("latest method in MediaTypes class is not yet implemented.")}}const Qj=e=>(t,r={})=>((e,{Type:t,plugins:r=[]})=>{const n=new t(e);return sj(e)&&(e.meta.length>0&&(n.meta=Cj(e.meta)),e.attributes.length>0&&(n.attributes=Cj(e.attributes))),zj(n,r,{toolboxCreator:Oj,visitorOptions:{nodeTypeGetter:Bj}})})(t,{...r,Type:e});Jx.refract=Qj(Jx),Ux.refract=Qj(Ux),Nx.refract=Qj(Nx),Bx.refract=Qj(Bx),Lx.refract=Qj(Lx),qx.refract=Qj(qx),Hx.refract=Qj(Hx),Gx.refract=Qj(Gx),Xx.refract=Qj(Xx),Wx.refract=Qj(Wx),Yx.refract=Qj(Yx),Zx.refract=Qj(Zx);const eE=(e,t)=>{const r=new Vj({predicate:e,returnOnTrue:Aj});return Gj(t,r),dd(void 0,[0],r.result)},tE=e=>"string"==typeof(null==e?void 0:e.type)?e.type:Bj(e),rE={EphemeralObject:["content"],EphemeralArray:["content"],...Jj},nE=(e,t,{keyMap:r=rE,...n}={})=>Gj(e,t,{keyMap:r,nodeTypeGetter:tE,nodePredicate:Ch,detectCycles:!1,deleteNodeSymbol:Symbol.for("delete-node"),skipVisitingNodeSymbol:Symbol.for("skip-visiting-node"),...n});nE[Symbol.for("nodejs.util.promisify.custom")]=async(e,{keyMap:t=rE,...r}={})=>Gj[Symbol.for("nodejs.util.promisify.custom")](e,visitor,{keyMap:t,nodeTypeGetter:tE,nodePredicate:Ch,detectCycles:!1,deleteNodeSymbol:Symbol.for("delete-node"),skipVisitingNodeSymbol:Symbol.for("skip-visiting-node"),...r});class sE{type="EphemeralArray";content=[];reference=void 0;constructor(e){this.content=e,this.reference=[]}toReference(){return this.reference}toArray(){return this.reference.push(...this.content),this.reference}}class iE{type="EphemeralObject";content=[];reference=void 0;constructor(e){this.content=e,this.reference={}}toReference(){return this.reference}toObject(){return Object.assign(this.reference,Object.fromEntries(this.content))}}const oE=e=>sj(e)?ij(e)||oj(e)||aj(e)||cj(e)?e.toValue():nE(e,new class{ObjectElement={enter:e=>{if(this.references.has(e))return this.references.get(e).toReference();const t=new iE(e.content);return this.references.set(e,t),t}};EphemeralObject={leave:e=>e.toObject()};MemberElement={enter:e=>[e.key,e.value]};ArrayElement={enter:e=>{if(this.references.has(e))return this.references.get(e).toReference();const t=new sE(e.content);return this.references.set(e,t),t}};EphemeralArray={leave:e=>e.toArray()};references=new WeakMap;BooleanElement(e){return e.toValue()}NumberElement(e){return e.toValue()}StringElement(e){return e.toValue()}NullElement(){return null}RefElement(e,...t){var r;const n=t[3];return"EphemeralObject"===(null===(r=n[n.length-1])||void 0===r?void 0:r.type)?Symbol.for("delete-node"):String(e.toValue())}LinkElement(e){return ij(e.href)?e.href.toValue():""}}):e,cE=(e,t=new WeakMap)=>(hj(e)?(t.set(e.key,e),cE(e.key,t),t.set(e.value,e),cE(e.value,t)):e.children.forEach((r=>{t.set(r,e),cE(r,t)})),t);class aE{element;edges;constructor({element:e}){this.element=e}transclude(e,t){var r;if(e===this.element)return t;if(e===t)return this.element;this.edges=null!==(r=this.edges)&&void 0!==r?r:cE(this.element);const n=this.edges.get(e);return Id(n)?void 0:(uj(n)?((e,t,r)=>{const n=r.get(e);uj(n)&&(n.content=n.map(((s,i,o)=>o===e?(r.delete(e),r.set(t,n),t):o)))})(e,t,this.edges):lj(n)?((e,t,r)=>{const n=r.get(e);lj(n)&&(n.content=n.map((s=>s===e?(r.delete(e),r.set(t,n),t):s)))})(e,t,this.edges):hj(n)&&((e,t,r)=>{const n=r.get(e);hj(n)&&(n.key===e&&(n.key=t,r.delete(e),r.set(t,n)),n.value===e&&(n.value=t,r.delete(e),r.set(t,n)))})(e,t,this.edges),this.element)}}const uE=(e,t)=>{const r=Ap(e,t);return od((e=>{if(em(e)&&Xp("$ref",e)&&gd(Jd,"$ref",e)){const t=pd(["$ref"],e),n=jm("#/",t);return pd(n.split("/"),r)}return em(e)?uE(e,r):e}),e)},lE=(e,t=Ej)=>{if(Jd(e))try{return t.fromRefract(JSON.parse(e))}catch{}return em(e)&&Xp("element",e)?t.fromRefract(e):t.toElement(e)},hE=e=>{const t=e.meta.length>0?Cj(e.meta):void 0,r=e.attributes.length>0?Cj(e.attributes):void 0;return new e.constructor(void 0,t,r)},fE=(e,t)=>t.clone&&t.isMergeableElement(e)?dE(hE(e),e,t):e,pE={clone:!0,isMergeableElement:e=>uj(e)||lj(e),arrayElementMerge:(e,t,r)=>e.concat(t)["fantasy-land/map"]((e=>fE(e,r))),objectElementMerge:(e,t,r)=>{const n=uj(e)?hE(e):hE(t);return uj(e)&&e.forEach(((e,t,s)=>{const i=qj(s);i.value=fE(e,r),n.content.push(i)})),t.forEach(((t,s,i)=>{const o=oE(s);let c;if(uj(e)&&e.hasKey(o)&&r.isMergeableElement(t)){const n=e.get(o);c=qj(i),c.value=((e,t)=>{if("function"!=typeof t.customMerge)return dE;const r=t.customMerge(e,t);return"function"==typeof r?r:dE})(s,r)(n,t)}else c=qj(i),c.value=fE(t,r);n.remove(o),n.content.push(c)})),n},customMerge:void 0,customMetaMerge:void 0,customAttributesMerge:void 0};function dE(e,t,r){var n,s,i;const o={...pE,...r};o.isMergeableElement=null!==(n=o.isMergeableElement)&&void 0!==n?n:pE.isMergeableElement,o.arrayElementMerge=null!==(s=o.arrayElementMerge)&&void 0!==s?s:pE.arrayElementMerge,o.objectElementMerge=null!==(i=o.objectElementMerge)&&void 0!==i?i:pE.objectElementMerge;const c=lj(t);if(!(c===lj(e)))return fE(t,o);const a=c&&"function"==typeof o.arrayElementMerge?o.arrayElementMerge(e,t,o):o.objectElementMerge(e,t,o);return a.meta=(e=>"function"!=typeof e.customMetaMerge?e=>Cj(e):e.customMetaMerge)(o)(e.meta,t.meta),a.attributes=(e=>"function"!=typeof e.customAttributesMerge?e=>Cj(e):e.customAttributesMerge)(o)(e.attributes,t.attributes),a}dE.all=(e,t)=>{if(!Array.isArray(e))throw new TypeError("First argument of deepmerge should be an array.");return 0===e.length?new Jx:e.reduce(((e,r)=>dE(e,r,t)),hE(e[0]))};class mE extends Fh{}class vE extends mE{}let yE=class{name;allowEmpty;sourceMap;fileExtensions;mediaTypes;constructor({name:e,allowEmpty:t=!0,sourceMap:r=!1,fileExtensions:n=[],mediaTypes:s=[]}){this.name=e,this.allowEmpty=t,this.sourceMap=r,this.fileExtensions=n,this.mediaTypes=s}};class bE extends Array{includesCycle(e){return this.filter((t=>t.has(e))).length>1}includes(e,t){return e instanceof Set?super.includes(e,t):this.some((t=>t.has(e)))}findItem(e){for(const t of this)for(const r of t)if(sj(r)&&e(r))return r}}let gE=class{uri;depth;value;refSet;errors;constructor({uri:e,depth:t=0,refSet:r,value:n}){this.uri=e,this.value=n,this.depth=t,this.refSet=r,this.errors=[]}};class wE extends Fh{}class xE extends wE{}class jE extends Fh{}class EE extends jE{}class $E extends wE{constructor(e){super(`Invalid JSON Schema $anchor "${e}".`)}}class OE extends mE{}class SE extends av{}class AE extends cv{}const PE=async(e,t={})=>(async(e,t)=>{let r=e,n=!1;if(!vj(e)){const t=qj(e);t.classes.push("result"),r=new Yx([t]),n=!0}const s=new Km({uri:t.resolve.baseURI,parseResult:r,mediaType:t.parse.mediaType}),i=await iv("canDereference",[s,t],t.dereference.strategies);if(ed(i))throw new vE(s.uri);try{const{result:e}=await ov("dereference",[s,t],i);return n?e.get(0):e}catch(e){throw new mE(`Error while dereferencing file "${s.uri}"`,{cause:e})}})(e,nv(ev,t));function TE(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function kE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FE(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}function IE(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function RE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,s,i=[],o=!0,c=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){c=!0,s=e}finally{try{o||null==r.return||r.return()}finally{if(c)throw s}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return TE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return TE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function DE(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var _E=function(e){throw TypeError(e)},CE=function(e,t,r){return t.has(e)||_E("Cannot "+r)},ME=function(e,t,r){return CE(e,t,"read from private field"),t.get(e)},NE=function(e,t,r){return t.has(e)?_E("Cannot add the same private member more than once"):IE(t,WeakSet)?t.add(e):t.set(e,r)},qE=function(e,t,r,n){return CE(e,t,"write to private field"),t.set(e,r),r},BE=function(e){return Object.prototype.toString.call(e)},LE=function(e){return ArrayBuffer.isView(e)&&!IE(e,DataView)},UE=Array.isArray,JE=Object.getOwnPropertyDescriptor,VE=Object.prototype.propertyIsEnumerable,GE=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty;function zE(e){for(var t=Object.keys(e),r=GE(e),n=0;n<r.length;n++)VE.call(e,r[n])&&t.push(r[n]);return t}function XE(e,t){var r;return!(null===(r=JE(e,t))||void 0===r?void 0:r.writable)}function WE(e,t){if("object"===(void 0===e?"undefined":DE(e))&&null!==e){var r;if(UE(e))r=[];else if("[object Date]"===BE(e))r=new Date(e.getTime?e.getTime():e);else if(function(e){return"[object RegExp]"===BE(e)}(e))r=new RegExp(e);else if(function(e){return"[object Error]"===BE(e)}(e))r={message:e.message};else if(function(e){return"[object Boolean]"===BE(e)}(e)||function(e){return"[object Number]"===BE(e)}(e)||function(e){return"[object String]"===BE(e)}(e))r=Object(e);else{if(LE(e))return e.slice();r=Object.create(Object.getPrototypeOf(e))}var n=t.includeSymbols?zE:Object.keys,s=!0,i=!1,o=void 0;try{for(var c,a=n(e)[Symbol.iterator]();!(s=(c=a.next()).done);s=!0){var u=c.value;r[u]=e[u]}}catch(e){i=!0,o=e}finally{try{s||null==a.return||a.return()}finally{if(i)throw o}}return r}return e}var YE,ZE,KE={includeSymbols:!1,immutable:!1};function QE(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:KE,n=[],s=[],i=!0,o=r.includeSymbols?zE:Object.keys,c=!!r.immutable;return function e(a){var u=c?WE(a,r):a,l={},h=!0,f={node:u,node_:a,path:[].concat(n),parent:s[s.length-1],parents:s,key:n[n.length-1],isRoot:0===n.length,level:n.length,circular:void 0,isLeaf:!1,notLeaf:!0,notRoot:!0,isFirst:!1,isLast:!1,update:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];f.isRoot||(f.parent.node[f.key]=e),f.node=e,t&&(h=!1)},delete:function(e){delete f.parent.node[f.key],e&&(h=!1)},remove:function(e){UE(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key],e&&(h=!1)},keys:null,before:function(e){l.before=e},after:function(e){l.after=e},pre:function(e){l.pre=e},post:function(e){l.post=e},stop:function(){i=!1},block:function(){h=!1}};if(!i)return f;function p(){if("object"===DE(f.node)&&null!==f.node){f.keys&&f.node_===f.node||(f.keys=o(f.node)),f.isLeaf=0===f.keys.length;for(var e=0;e<s.length;e++)if(s[e].node_===a){f.circular=s[e];break}}else f.isLeaf=!0,f.keys=null;f.notLeaf=!f.isLeaf,f.notRoot=!f.isRoot}p();var d=t.call(f,f.node);if(void 0!==d&&f.update&&f.update(d),l.before&&l.before.call(f,f.node),!h)return f;if("object"===DE(f.node)&&null!==f.node&&!f.circular){var m;s.push(f),p();var v=!0,y=!1,b=void 0;try{for(var g,w=Object.entries(null!==(m=f.keys)&&void 0!==m?m:[])[Symbol.iterator]();!(v=(g=w.next()).done);v=!0){var x,j=RE(g.value,2),E=j[0],$=j[1];n.push($),l.pre&&l.pre.call(f,f.node[$],$);var O=e(f.node[$]);c&&HE.call(f.node,$)&&!XE(f.node,$)&&(f.node[$]=O.node),O.isLast=!!(null===(x=f.keys)||void 0===x?void 0:x.length)&&+E==f.keys.length-1,O.isFirst=0==+E,l.post&&l.post.call(f,O),n.pop()}}catch(e){y=!0,b=e}finally{try{v||null==w.return||w.return()}finally{if(y)throw b}}s.pop()}return l.after&&l.after.call(f,f.node),f}(e).node}var e$=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:KE;kE(this,e),NE(this,YE),NE(this,ZE),qE(this,YE,t),qE(this,ZE,r)}return FE(e,[{key:"get",value:function(e){for(var t=ME(this,YE),r=0;t&&r<e.length;r++){var n=e[r];if(!HE.call(t,n)||!ME(this,ZE).includeSymbols&&"symbol"===(void 0===n?"undefined":DE(n)))return;t=t[n]}return t}},{key:"has",value:function(e){for(var t=ME(this,YE),r=0;t&&r<e.length;r++){var n=e[r];if(!HE.call(t,n)||!ME(this,ZE).includeSymbols&&"symbol"===(void 0===n?"undefined":DE(n)))return!1;t=t[n]}return!0}},{key:"set",value:function(e,t){var r=ME(this,YE),n=0;for(n=0;n<e.length-1;n++){var s=e[n];HE.call(r,s)||(r[s]={}),r=r[s]}return r[e[n]]=t,t}},{key:"map",value:function(e){return QE(ME(this,YE),e,{immutable:!0,includeSymbols:!!ME(this,ZE).includeSymbols})}},{key:"forEach",value:function(e){return qE(this,YE,QE(ME(this,YE),e,ME(this,ZE))),ME(this,YE)}},{key:"reduce",value:function(e,t){var r=1===arguments.length,n=r?ME(this,YE):t;return this.forEach((function(t){this.isRoot&&r||(n=e.call(this,n,t))})),n}},{key:"paths",value:function(){var e=[];return this.forEach((function(){e.push(this.path)})),e}},{key:"nodes",value:function(){var e=[];return this.forEach((function(){e.push(this.node)})),e}},{key:"clone",value:function(){var e=[],t=[],r=ME(this,ZE);return LE(ME(this,YE))?ME(this,YE).slice():function n(s){for(var i=0;i<e.length;i++)if(e[i]===s)return t[i];if("object"===(void 0===s?"undefined":DE(s))&&null!==s){var o=WE(s,r);e.push(s),t.push(o);var c=r.includeSymbols?zE:Object.keys,a=!0,u=!1,l=void 0;try{for(var h,f=c(s)[Symbol.iterator]();!(a=(h=f.next()).done);a=!0){var p=h.value;o[p]=n(s[p])}}catch(e){u=!0,l=e}finally{try{a||null==f.return||f.return()}finally{if(u)throw l}}return e.pop(),t.pop(),o}return s}(ME(this,YE))}}]),e}();YE=new WeakMap,ZE=new WeakMap;var t$=function(e,t){return new e$(e,t)};t$.get=function(e,t,r){return new e$(e,r).get(t)},t$.set=function(e,t,r,n){return new e$(e,n).set(t,r)},t$.has=function(e,t,r){return new e$(e,r).has(t)},t$.map=function(e,t,r){return new e$(e,r).map(t)},t$.forEach=function(e,t,r){return new e$(e,r).forEach(t)},t$.reduce=function(e,t,r,n){return new e$(e,n).reduce(t,r)},t$.paths=function(e,t){return new e$(e,t).paths()},t$.nodes=function(e,t){return new e$(e,t).nodes()},t$.clone=function(e,t){return new e$(e,t).clone()};var r$=t$;const n$=["properties"],s$=["properties"],i$=["definitions","parameters","responses","securityDefinitions","components/schemas","components/responses","components/parameters","components/securitySchemes"],o$=["schema/example","items/example"];function c$(e){const t=e[e.length-1],r=e[e.length-2],n=e.join("/");return n$.indexOf(t)>-1&&-1===s$.indexOf(r)||i$.indexOf(n)>-1||o$.some((e=>n.indexOf(e)>-1))}function a$(e,t){const[r,n]=e.split("#"),s=null!=t?t:"",i=null!=r?r:"";let o;if(Um(s))o=Xm(s,i);else{const e=Xm("https://swagger.io",s),t=Xm(e,i).replace("https://swagger.io","");o=i.startsWith("/")?t:t.substring(1)}return n?`${o}#${n}`:o}const u$=/^([a-z]+:\/\/|\/\/)/i;class l$ extends Ih{}const h$={},f$=new WeakMap,p$=[e=>"paths"===e[0]&&"responses"===e[3]&&"examples"===e[5],e=>"paths"===e[0]&&"responses"===e[3]&&"content"===e[5]&&"example"===e[7],e=>"paths"===e[0]&&"responses"===e[3]&&"content"===e[5]&&"examples"===e[7]&&"value"===e[9],e=>"paths"===e[0]&&"requestBody"===e[3]&&"content"===e[4]&&"example"===e[6],e=>"paths"===e[0]&&"requestBody"===e[3]&&"content"===e[4]&&"examples"===e[6]&&"value"===e[8],e=>"paths"===e[0]&&"parameters"===e[2]&&"example"===e[4],e=>"paths"===e[0]&&"parameters"===e[3]&&"example"===e[5],e=>"paths"===e[0]&&"parameters"===e[2]&&"examples"===e[4]&&"value"===e[6],e=>"paths"===e[0]&&"parameters"===e[3]&&"examples"===e[5]&&"value"===e[7],e=>"paths"===e[0]&&"parameters"===e[2]&&"content"===e[4]&&"example"===e[6],e=>"paths"===e[0]&&"parameters"===e[2]&&"content"===e[4]&&"examples"===e[6]&&"value"===e[8],e=>"paths"===e[0]&&"parameters"===e[3]&&"content"===e[4]&&"example"===e[7],e=>"paths"===e[0]&&"parameters"===e[3]&&"content"===e[5]&&"examples"===e[7]&&"value"===e[9]],d$={key:"$ref",plugin:(e,t,r,n)=>{const s=n.getInstance(),i=r.slice(0,-1);if(c$(i)||(e=>p$.some((t=>t(e))))(i))return;const{baseDoc:o}=n.getContext(r);if("string"!=typeof e)return new l$("$ref: must be a string (JSON-Ref)",{$ref:e,baseDoc:o,fullPath:r});const c=b$(e),a=c[0],u=c[1]||"";let l,h,f;try{l=o||a?v$(a,o):null}catch(t){return y$(t,{pointer:u,$ref:e,basePath:l,fullPath:r})}if(function(e,t,r,n){let s=f$.get(n);s||(s={},f$.set(n,s));const i=function(e){if(0===e.length)return"";return`/${e.map($$).join("/")}`}(r),o=`${t||"<specmap-base>"}#${e}`,c=i.replace(/allOf\/\d+\/?/g,""),a=n.contextTree.get([]).baseDoc;if(t===a&&O$(c,e))return!0;let u="";const l=r.some((e=>(u=`${u}/${$$(e)}`,s[u]&&s[u].some((e=>O$(e,o)||O$(o,e))))));if(l)return!0;return void(s[c]=(s[c]||[]).concat(o))}(u,l,i,n)&&!s.useCircularStructures){const t=a$(e,l);return e===t?null:$r.replace(r,t)}if(null==l?(f=j$(u),h=n.get(f),void 0===h&&(h=new l$(`Could not resolve reference: ${e}`,{pointer:u,$ref:e,baseDoc:o,fullPath:r}))):(h=g$(l,u),h=null!=h.l?h.l:h.catch((t=>{throw y$(t,{pointer:u,$ref:e,baseDoc:o,fullPath:r})}))),h instanceof Error)return[$r.remove(r),h];const p=a$(e,l),d=$r.replace(i,h,{$$ref:p});if(l&&l!==o)return[d,$r.context(i,{baseDoc:l})];try{if(!function(e,t){const r=[e];return t.path.reduce(((e,t)=>(r.push(e[t]),e[t])),e),n(t.value);function n(e){return $r.isObject(e)&&(r.indexOf(e)>=0||Object.keys(e).some((t=>n(e[t]))))}}(n.state,d)||s.useCircularStructures)return d}catch(e){return null}}},m$=Object.assign(d$,{docCache:h$,absoluteify:v$,clearCache:function(e){void 0!==e?delete h$[e]:Object.keys(h$).forEach((e=>{delete h$[e]}))},JSONRefError:l$,wrapError:y$,getDoc:w$,split:b$,extractFromDoc:g$,fetchJSON:function(e){return fetch(e,{headers:{Accept:"application/json, application/yaml"},loadSpec:!0}).then((e=>e.text())).then((e=>It.load(e)))},extract:x$,jsonPointerToArray:j$,unescapeJsonPointerToken:E$});function v$(e,t){if(!u$.test(e)){if(!t)throw new l$(`Tried to resolve a relative URL, without having a basePath. path: '${e}' basePath: '${t}'`);return Xm(t,e)}return e}function y$(e,t){let r;return r=e&&e.response&&e.response.body?`${e.response.body.code} ${e.response.body.message}`:e.message,new l$(`Could not resolve reference: ${r}`,{...t,cause:e})}function b$(e){return(e+"").split("#")}function g$(e,t){const r=h$[e];if(r&&!$r.isPromise(r))try{const e=x$(t,r);return Object.assign(Promise.resolve(e),{l:e})}catch(e){return Promise.reject(e)}return w$(e).then((e=>x$(t,e)))}function w$(e){const t=h$[e];return t?$r.isPromise(t)?t:Promise.resolve(t):(h$[e]=m$.fetchJSON(e).then((t=>(h$[e]=t,t))),h$[e])}function x$(e,t){const r=j$(e);if(r.length<1)return t;const n=$r.getIn(t,r);if(void 0===n)throw new l$(`Could not resolve pointer: ${e} does not exist in document`,{pointer:e});return n}function j$(e){if("string"!=typeof e)throw new TypeError("Expected a string, got a "+typeof e);return"/"===e[0]&&(e=e.substr(1)),""===e?[]:e.split("/").map(E$)}function E$(e){if("string"!=typeof e)return e;return new URLSearchParams(`=${e.replace(/~1/g,"/").replace(/~0/g,"~")}`).get("")}function $$(e){return new URLSearchParams([["",e.replace(/~/g,"~0").replace(/\//g,"~1")]]).toString().slice(1)}function O$(e,t){if(!(r=t)||"/"===r||"#"===r)return!0;var r;const n=e.charAt(t.length),s=t.slice(-1);return 0===e.indexOf(t)&&(!n||"/"===n||"#"===n)&&"#"!==s}const S$={key:"allOf",plugin:(e,t,r,n,s)=>{if(s.meta&&s.meta.$$ref)return;const i=r.slice(0,-1);if(c$(i))return;if(!Array.isArray(e)){const e=new TypeError("allOf must be an array");return e.fullPath=r,e}let o=!1,c=s.value;if(i.forEach((e=>{c&&(c=c[e])})),c={...c},0===Object.keys(c).length)return;delete c.allOf;const a=[];return a.push(n.replace(i,{})),e.forEach(((e,t)=>{if(!n.isObject(e)){if(o)return null;o=!0;const e=new TypeError("Elements in allOf must be objects");return e.fullPath=r,a.push(e)}a.push(n.mergeDeep(i,e));const s=function(e,t,{specmap:r,getBaseUrlForNodePath:n=(e=>r.getContext([...t,...e]).baseDoc),targetKeys:s=["$ref","$$ref"]}={}){const i=[];return r$(e).forEach((function(){if(s.includes(this.key)&&"string"==typeof this.node){const e=this.path,s=t.concat(this.path),o=a$(this.node,n(e));i.push(r.replace(s,o))}})),i}(e,r.slice(0,-1),{getBaseUrlForNodePath:e=>n.getContext([...r,t,...e]).baseDoc,specmap:n});a.push(...s)})),c.example&&a.push(n.remove([].concat(i,"example"))),a.push(n.mergeDeep(i,c)),c.$$ref||a.push(n.remove([].concat(i,"$$ref"))),a}},A$={key:"parameters",plugin:(e,t,r,n)=>{if(Array.isArray(e)&&e.length){const t=Object.assign([],e),s=r.slice(0,-1),i={...$r.getIn(n.spec,s)};for(let s=0;s<e.length;s+=1){const o=e[s];try{t[s].default=n.parameterMacro(i,o)}catch(e){const t=new Error(e);return t.fullPath=r,t}}return $r.replace(r,t)}return $r.replace(r,e)}},P$={key:"properties",plugin:(e,t,r,n)=>{const s={...e};for(const t in e)try{s[t].default=n.modelPropertyMacro(s[t])}catch(e){const t=new Error(e);return t.fullPath=r,t}return $r.replace(r,s)}};class T${constructor(e){this.root=k$(e||{})}set(e,t){const r=this.getParent(e,!0);if(!r)return void F$(this.root,t,null);const n=e[e.length-1],{children:s}=r;s[n]?F$(s[n],t,r):s[n]=k$(t,r)}get(e){if((e=e||[]).length<1)return this.root.value;let t,r,n=this.root;for(let s=0;s<e.length&&(r=e[s],t=n.children,t[r]);s+=1)n=t[r];return n&&n.protoValue}getParent(e,t){return!e||e.length<1?null:e.length<2?this.root:e.slice(0,-1).reduce(((e,r)=>{if(!e)return e;const{children:n}=e;return!n[r]&&t&&(n[r]=k$(null,e)),n[r]}),this.root)}}function k$(e,t){return F$({children:{}},e,t)}function F$(e,t,r){return e.value=t||{},e.protoValue=r?{...r.protoValue,...e.value}:e.value,Object.keys(e.children).forEach((t=>{const r=e.children[t];e.children[t]=F$(r,r.value,e)})),e}const I$=()=>{};class R${static getPluginName(e){return e.pluginName}static getPatchesOfType(e,t){return e.filter(t)}constructor(e){Object.assign(this,{spec:"",debugLevel:"info",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new T$,showDebug:!1,allPatches:[],pluginProp:"specMap",libMethods:Object.assign(Object.create(this),$r,{getInstance:()=>this}),allowMetaPatches:!1},e),this.get=this._get.bind(this),this.getContext=this._getContext.bind(this),this.hasRun=this._hasRun.bind(this),this.wrappedPlugins=this.plugins.map(this.wrapPlugin.bind(this)).filter($r.isFunction),this.patches.push($r.add([],this.spec)),this.patches.push($r.context([],this.context)),this.updatePatches(this.patches)}debug(e,...t){this.debugLevel===e&&console.log(...t)}verbose(e,...t){"verbose"===this.debugLevel&&console.log(`[${e}] `,...t)}wrapPlugin(e,t){const{pathDiscriminator:r}=this;let n,s=null;return e[this.pluginProp]?(s=e,n=e[this.pluginProp]):$r.isFunction(e)?n=e:$r.isObject(e)&&(n=function(e){const t=(e,t)=>!Array.isArray(e)||e.every(((e,r)=>e===t[r]));return function*(n,s){const i={};for(const[e,t]of n.filter($r.isAdditiveMutation).entries()){if(!(e<3e3))return;yield*o(t.value,t.path,t)}function*o(n,c,a){if($r.isObject(n)){const u=c.length-1,l=c[u],h=c.indexOf("properties"),f="properties"===l&&u===h,p=s.allowMetaPatches&&i[n.$$ref];for(const u of Object.keys(n)){const l=n[u],h=c.concat(u),d=$r.isObject(l),m=n.$$ref;if(p||d&&(s.allowMetaPatches&&m&&(i[m]=!0),yield*o(l,h,a)),!f&&u===e.key){const n=t(r,c);r&&!n||(yield e.plugin(l,u,h,s,a))}}}else e.key===c[c.length-1]&&(yield e.plugin(n,e.key,c,s))}}}(e)),Object.assign(n.bind(s),{pluginName:e.name||t,isGenerator:$r.isGenerator(n)})}nextPlugin(){return this.wrappedPlugins.find((e=>this.getMutationsForPlugin(e).length>0))}nextPromisedPatch(){if(this.promisedPatches.length>0)return Promise.race(this.promisedPatches.map((e=>e.value)))}getPluginHistory(e){const t=this.constructor.getPluginName(e);return this.pluginHistory[t]||[]}getPluginRunCount(e){return this.getPluginHistory(e).length}getPluginHistoryTip(e){const t=this.getPluginHistory(e);return t&&t[t.length-1]||{}}getPluginMutationIndex(e){const t=this.getPluginHistoryTip(e).mutationIndex;return"number"!=typeof t?-1:t}updatePluginHistory(e,t){const r=this.constructor.getPluginName(e);this.pluginHistory[r]=this.pluginHistory[r]||[],this.pluginHistory[r].push(t)}updatePatches(e){$r.normalizeArray(e).forEach((e=>{if(e instanceof Error)this.errors.push(e);else try{if(!$r.isObject(e))return void this.debug("updatePatches","Got a non-object patch",e);if(this.showDebug&&this.allPatches.push(e),$r.isPromise(e.value))return this.promisedPatches.push(e),void this.promisedPatchThen(e);if($r.isContextPatch(e))return void this.setContext(e.path,e.value);$r.isMutation(e)&&this.updateMutations(e)}catch(e){console.error(e),this.errors.push(e)}}))}updateMutations(e){"object"==typeof e.value&&!Array.isArray(e.value)&&this.allowMetaPatches&&(e.value={...e.value});const t=$r.applyPatch(this.state,e,{allowMetaPatches:this.allowMetaPatches});t&&(this.mutations.push(e),this.state=t)}removePromisedPatch(e){const t=this.promisedPatches.indexOf(e);t<0?this.debug("Tried to remove a promisedPatch that isn't there!"):this.promisedPatches.splice(t,1)}promisedPatchThen(e){return e.value=e.value.then((t=>{const r={...e,value:t};this.removePromisedPatch(e),this.updatePatches(r)})).catch((t=>{this.removePromisedPatch(e),this.updatePatches(t)})),e.value}getMutations(e,t){return e=e||0,"number"!=typeof t&&(t=this.mutations.length),this.mutations.slice(e,t)}getCurrentMutations(){return this.getMutationsForPlugin(this.getCurrentPlugin())}getMutationsForPlugin(e){const t=this.getPluginMutationIndex(e);return this.getMutations(t+1)}getCurrentPlugin(){return this.currentPlugin}getLib(){return this.libMethods}_get(e){return $r.getIn(this.state,e)}_getContext(e){return this.contextTree.get(e)}setContext(e,t){return this.contextTree.set(e,t)}_hasRun(e){return this.getPluginRunCount(this.getCurrentPlugin())>(e||0)}dispatch(){const e=this,t=this.nextPlugin();if(!t){const e=this.nextPromisedPatch();if(e)return e.then((()=>this.dispatch())).catch((()=>this.dispatch()));const t={spec:this.state,errors:this.errors};return this.showDebug&&(t.patches=this.allPatches),Promise.resolve(t)}if(e.pluginCount=e.pluginCount||new WeakMap,e.pluginCount.set(t,(e.pluginCount.get(t)||0)+1),e.pluginCount[t]>100)return Promise.resolve({spec:e.state,errors:e.errors.concat(new Error("We've reached a hard limit of 100 plugin runs"))});if(t!==this.currentPlugin&&this.promisedPatches.length){const e=this.promisedPatches.map((e=>e.value));return Promise.all(e.map((e=>e.then(I$,I$)))).then((()=>this.dispatch()))}return function(){e.currentPlugin=t;const n=e.getCurrentMutations(),s=e.mutations.length-1;try{if(t.isGenerator)for(const s of t(n,e.getLib()))r(s);else{r(t(n,e.getLib()))}}catch(e){console.error(e),r([Object.assign(Object.create(e),{plugin:t})])}finally{e.updatePluginHistory(t,{mutationIndex:s})}return e.dispatch()}();function r(r){r&&(r=$r.fullyNormalizeArray(r),e.updatePatches(r,t))}}}const D$={refs:m$,allOf:S$,parameters:A$,properties:P$};async function _$(e){const{spec:t,mode:r,allowMetaPatches:n=!0,pathDiscriminator:s,modelPropertyMacro:i,parameterMacro:o,requestInterceptor:c,responseInterceptor:a,skipNormalization:u=!1,useCircularStructures:l,strategies:h}=e,f=Mt(e),p=Nt(e),d=h.find((e=>e.match(t)));return async function(e){f&&(D$.refs.docCache[f]=e);D$.refs.fetchJSON=Ct(p,{requestInterceptor:c,responseInterceptor:a});const t=[D$.refs];"function"==typeof o&&t.push(D$.parameters);"function"==typeof i&&t.push(D$.properties);"strict"!==r&&t.push(D$.allOf);const h=await(m={spec:e,context:{baseDoc:f},plugins:t,allowMetaPatches:n,pathDiscriminator:s,parameterMacro:o,modelPropertyMacro:i,useCircularStructures:l},new R$(m).dispatch());var m;u||(h.spec=d.normalize(h.spec));return h}(t)}const C$=e=>e.replace(/\W/gi,"_");function M$(e,t,r="",{v2OperationIdCompatibilityMode:n}={}){if(!e||"object"!=typeof e)return null;return(e.operationId||"").replace(/\s/g,"").length?C$(e.operationId):function(e,t,{v2OperationIdCompatibilityMode:r}={}){if(r){let r=`${t.toLowerCase()}_${e}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return r=r||`${e.substring(1)}_${t}`,r.replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return`${t.toLowerCase()}${C$(e)}`}(t,r,{v2OperationIdCompatibilityMode:n})}function N$(e){const{spec:t}=e,{paths:r}=t,n={};if(!r||t.$$normalized)return e;for(const e in r){const s=r[e];if(null==s||!["object","function"].includes(typeof s))continue;const i=s.parameters;for(const r in s){const o=s[r];if(null==o||!["object","function"].includes(typeof o))continue;const c=M$(o,e,r);if(c){n[c]?n[c].push(o):n[c]=[o];const e=n[c];if(e.length>1)e.forEach(((e,t)=>{e.h=e.h||e.operationId,e.operationId=`${c}${t+1}`}));else if(void 0!==o.operationId){const t=e[0];t.h=t.h||o.operationId,t.operationId=c}}if("parameters"!==r){const e=[],r={};for(const n in t)"produces"!==n&&"consumes"!==n&&"security"!==n||(r[n]=t[n],e.push(r));if(i&&(r.parameters=i,e.push(r)),e.length)for(const t of e)for(const e in t)if(o[e]){if("parameters"===e)for(const r of t[e]){o[e].some((e=>e.name&&e.name===r.name||e.$ref&&e.$ref===r.$ref||e.$$ref&&e.$$ref===r.$$ref||e===r))||o[e].push(r)}}else o[e]=t[e]}}}return t.$$normalized=!0,e}const q$={name:"generic",match:()=>!0,normalize(e){const{spec:t}=N$({spec:e});return t},resolve:async e=>_$(e)};const B$=e=>{try{const{swagger:t}=e;return"2.0"===t}catch{return!1}},L$=e=>{try{const{openapi:t}=e;return"string"==typeof t&&/^3\.0\.([0123])(?:-rc[012])?$/.test(t)}catch{return!1}},U$=e=>{try{const{openapi:t}=e;return"string"==typeof t&&/^3\.1\.(?:[1-9]\d*|0)$/.test(t)}catch{return!1}},J$=e=>L$(e)||U$(e),V$={name:"openapi-2",match:e=>B$(e),normalize(e){const{spec:t}=N$({spec:e});return t},resolve:async e=>async function(e){return _$(e)}(e)};const G$={name:"openapi-3-0",match:e=>L$(e),normalize(e){const{spec:t}=N$({spec:e});return t},resolve:async e=>async function(e){return _$(e)}(e)},H$=e=>async t=>(async e=>{const{spec:t,requestInterceptor:r,responseInterceptor:n}=e,s=Mt(e),i=Nt(e),o=t||await Ct(i,{requestInterceptor:r,responseInterceptor:n})(s),c={...e,spec:o};return e.strategies.find((e=>e.match(o))).resolve(c)})({...e,...t}),z$=H$({strategies:[G$,V$,q$]});class X$ extends Ih{}class W$ extends X${pointer;constructor(e,t){super(e,t),void 0!==t&&(this.pointer=t.pointer)}}class Y$ extends X${tokens;constructor(e,t){super(e,t),void 0!==t&&(this.tokens=[...t.tokens])}}class Z$ extends X${pointer;tokens;failedToken;failedTokenPosition;element;constructor(e,t){super(e,t),void 0!==t&&(this.pointer=t.pointer,Array.isArray(t.tokens)&&(this.tokens=[...t.tokens]),this.failedToken=t.failedToken,this.failedTokenPosition=t.failedTokenPosition,this.element=t.element)}}const K$=gp(jd(/~/g,"~0"),jd(/\//g,"~1"),encodeURIComponent),Q$=gp(jd(/~1/g,"/"),jd(/~0/g,"~"),(e=>{try{return decodeURIComponent(e)}catch{return e}})),eO=e=>{const t=(e=>{const t=e.indexOf("#");return-1!==t?e.substring(t):"#"})(e);return jm("#",t)},tO=e=>{try{return 0===e.length?"":`/${e.map(K$).join("/")}`}catch(t){throw new Y$("JSON Pointer compilation of tokens encountered an error.",{tokens:e,cause:t})}},rO=(e,t)=>{let r;try{r=(e=>{if(Vd(e))return[];if(!Od("/",e))throw new W$(`Invalid JSON Pointer "${e}". JSON Pointers must begin with "/"`,{pointer:e});try{const t=gp($d("/"),Ff(Q$))(e);return bp(t)}catch(t){throw new W$(`JSON Pointer parsing of "${e}" encountered an error.`,{pointer:e,cause:t})}})(e)}catch(r){throw new Z$(`JSON Pointer evaluation failed while parsing the pointer "${e}".`,{pointer:e,element:Cj(t),cause:r})}return r.reduce(((t,n,s)=>{if(uj(t)){if(!t.hasKey(n))throw new Z$(`JSON Pointer evaluation failed while evaluating token "${n}" against an ObjectElement`,{pointer:e,tokens:r,failedToken:n,failedTokenPosition:s,element:Cj(t)});return t.get(n)}if(lj(t)){if(!(n in t.content)||!im(Number(n)))throw new Z$(`JSON Pointer evaluation failed while evaluating token "${n}" against an ArrayElement`,{pointer:e,tokens:r,failedToken:n,failedTokenPosition:s,element:Cj(t)});return t.get(Number(n))}throw new Z$(`JSON Pointer evaluation failed while evaluating token "${n}" against an unexpected Element`,{pointer:e,tokens:r,failedToken:n,failedTokenPosition:s,element:Cj(t)})}),t)};class nO extends Kj{filterByFormat(e="generic"){const t="generic"===e?"openapi;version":e;return this.filter((e=>e.includes(t)))}findBy(e="3.1.0",t="generic"){const r="generic"===t?`vnd.oai.openapi;version=${e}`:`vnd.oai.openapi+${t};version=${e}`;return this.find((e=>e.includes(r)))||this.unknownMediaType}latest(e="generic"){return Np(this.filterByFormat(e))}}const sO=new nO("application/vnd.oai.openapi;version=3.1.0","application/vnd.oai.openapi+json;version=3.1.0","application/vnd.oai.openapi+yaml;version=3.1.0");let iO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="callback"}},oO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="components"}get schemas(){return this.get("schemas")}set schemas(e){this.set("schemas",e)}get responses(){return this.get("responses")}set responses(e){this.set("responses",e)}get parameters(){return this.get("parameters")}set parameters(e){this.set("parameters",e)}get examples(){return this.get("examples")}set examples(e){this.set("examples",e)}get requestBodies(){return this.get("requestBodies")}set requestBodies(e){this.set("requestBodies",e)}get headers(){return this.get("headers")}set headers(e){this.set("headers",e)}get securitySchemes(){return this.get("securitySchemes")}set securitySchemes(e){this.set("securitySchemes",e)}get links(){return this.get("links")}set links(e){this.set("links",e)}get callbacks(){return this.get("callbacks")}set callbacks(e){this.set("callbacks",e)}},cO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="contact"}get name(){return this.get("name")}set name(e){this.set("name",e)}get url(){return this.get("url")}set url(e){this.set("url",e)}get email(){return this.get("email")}set email(e){this.set("email",e)}},aO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="discriminator"}get propertyName(){return this.get("propertyName")}set propertyName(e){this.set("propertyName",e)}get mapping(){return this.get("mapping")}set mapping(e){this.set("mapping",e)}},uO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="encoding"}get contentType(){return this.get("contentType")}set contentType(e){this.set("contentType",e)}get headers(){return this.get("headers")}set headers(e){this.set("headers",e)}get style(){return this.get("style")}set style(e){this.set("style",e)}get explode(){return this.get("explode")}set explode(e){this.set("explode",e)}get allowedReserved(){return this.get("allowedReserved")}set allowedReserved(e){this.set("allowedReserved",e)}},lO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="example"}get summary(){return this.get("summary")}set summary(e){this.set("summary",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get value(){return this.get("value")}set value(e){this.set("value",e)}get externalValue(){return this.get("externalValue")}set externalValue(e){this.set("externalValue",e)}},hO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="externalDocumentation"}get description(){return this.get("description")}set description(e){this.set("description",e)}get url(){return this.get("url")}set url(e){this.set("url",e)}},fO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="header"}get required(){return this.hasKey("required")?this.get("required"):new Bx(!1)}set required(e){this.set("required",e)}get deprecated(){return this.hasKey("deprecated")?this.get("deprecated"):new Bx(!1)}set deprecated(e){this.set("deprecated",e)}get allowEmptyValue(){return this.get("allowEmptyValue")}set allowEmptyValue(e){this.set("allowEmptyValue",e)}get style(){return this.get("style")}set style(e){this.set("style",e)}get explode(){return this.get("explode")}set explode(e){this.set("explode",e)}get allowReserved(){return this.get("allowReserved")}set allowReserved(e){this.set("allowReserved",e)}get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}get example(){return this.get("example")}set example(e){this.set("example",e)}get examples(){return this.get("examples")}set examples(e){this.set("examples",e)}get contentProp(){return this.get("content")}set contentProp(e){this.set("content",e)}};Object.defineProperty(fO.prototype,"description",{get(){return this.get("description")},set(e){this.set("description",e)},enumerable:!0});let pO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="info",this.classes.push("info")}get title(){return this.get("title")}set title(e){this.set("title",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get termsOfService(){return this.get("termsOfService")}set termsOfService(e){this.set("termsOfService",e)}get contact(){return this.get("contact")}set contact(e){this.set("contact",e)}get license(){return this.get("license")}set license(e){this.set("license",e)}get version(){return this.get("version")}set version(e){this.set("version",e)}},dO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="license"}get name(){return this.get("name")}set name(e){this.set("name",e)}get url(){return this.get("url")}set url(e){this.set("url",e)}},mO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="link"}get operationRef(){return this.get("operationRef")}set operationRef(e){this.set("operationRef",e)}get operationId(){return this.get("operationId")}set operationId(e){this.set("operationId",e)}get operation(){var e,t;return ij(this.operationRef)?null===(e=this.operationRef)||void 0===e?void 0:e.meta.get("operation"):ij(this.operationId)?null===(t=this.operationId)||void 0===t?void 0:t.meta.get("operation"):void 0}set operation(e){this.set("operation",e)}get parameters(){return this.get("parameters")}set parameters(e){this.set("parameters",e)}get requestBody(){return this.get("requestBody")}set requestBody(e){this.set("requestBody",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get server(){return this.get("server")}set server(e){this.set("server",e)}},vO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="mediaType"}get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}get example(){return this.get("example")}set example(e){this.set("example",e)}get examples(){return this.get("examples")}set examples(e){this.set("examples",e)}get encoding(){return this.get("encoding")}set encoding(e){this.set("encoding",e)}},yO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="oAuthFlow"}get authorizationUrl(){return this.get("authorizationUrl")}set authorizationUrl(e){this.set("authorizationUrl",e)}get tokenUrl(){return this.get("tokenUrl")}set tokenUrl(e){this.set("tokenUrl",e)}get refreshUrl(){return this.get("refreshUrl")}set refreshUrl(e){this.set("refreshUrl",e)}get scopes(){return this.get("scopes")}set scopes(e){this.set("scopes",e)}},bO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="oAuthFlows"}get implicit(){return this.get("implicit")}set implicit(e){this.set("implicit",e)}get password(){return this.get("password")}set password(e){this.set("password",e)}get clientCredentials(){return this.get("clientCredentials")}set clientCredentials(e){this.set("clientCredentials",e)}get authorizationCode(){return this.get("authorizationCode")}set authorizationCode(e){this.set("authorizationCode",e)}},gO=class extends Nx{constructor(e,t,r){super(e,t,r),this.element="openapi",this.classes.push("spec-version"),this.classes.push("version")}};class wO extends Jx{constructor(e,t,r){super(e,t,r),this.element="openApi3_0",this.classes.push("api")}get openapi(){return this.get("openapi")}set openapi(e){this.set("openapi",e)}get info(){return this.get("info")}set info(e){this.set("info",e)}get servers(){return this.get("servers")}set servers(e){this.set("servers",e)}get paths(){return this.get("paths")}set paths(e){this.set("paths",e)}get components(){return this.get("components")}set components(e){this.set("components",e)}get security(){return this.get("security")}set security(e){this.set("security",e)}get tags(){return this.get("tags")}set tags(e){this.set("tags",e)}get externalDocs(){return this.get("externalDocs")}set externalDocs(e){this.set("externalDocs",e)}}let xO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="operation"}get tags(){return this.get("tags")}set tags(e){this.set("tags",e)}get summary(){return this.get("summary")}set summary(e){this.set("summary",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}set externalDocs(e){this.set("externalDocs",e)}get externalDocs(){return this.get("externalDocs")}get operationId(){return this.get("operationId")}set operationId(e){this.set("operationId",e)}get parameters(){return this.get("parameters")}set parameters(e){this.set("parameters",e)}get requestBody(){return this.get("requestBody")}set requestBody(e){this.set("requestBody",e)}get responses(){return this.get("responses")}set responses(e){this.set("responses",e)}get callbacks(){return this.get("callbacks")}set callbacks(e){this.set("callbacks",e)}get deprecated(){return this.hasKey("deprecated")?this.get("deprecated"):new Bx(!1)}set deprecated(e){this.set("deprecated",e)}get security(){return this.get("security")}set security(e){this.set("security",e)}get servers(){return this.get("severs")}set servers(e){this.set("servers",e)}},jO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="parameter"}get name(){return this.get("name")}set name(e){this.set("name",e)}get in(){return this.get("in")}set in(e){this.set("in",e)}get required(){return this.hasKey("required")?this.get("required"):new Bx(!1)}set required(e){this.set("required",e)}get deprecated(){return this.hasKey("deprecated")?this.get("deprecated"):new Bx(!1)}set deprecated(e){this.set("deprecated",e)}get allowEmptyValue(){return this.get("allowEmptyValue")}set allowEmptyValue(e){this.set("allowEmptyValue",e)}get style(){return this.get("style")}set style(e){this.set("style",e)}get explode(){return this.get("explode")}set explode(e){this.set("explode",e)}get allowReserved(){return this.get("allowReserved")}set allowReserved(e){this.set("allowReserved",e)}get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}get example(){return this.get("example")}set example(e){this.set("example",e)}get examples(){return this.get("examples")}set examples(e){this.set("examples",e)}get contentProp(){return this.get("content")}set contentProp(e){this.set("content",e)}};Object.defineProperty(jO.prototype,"description",{get(){return this.get("description")},set(e){this.set("description",e)},enumerable:!0});let EO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="pathItem"}get $ref(){return this.get("$ref")}set $ref(e){this.set("$ref",e)}get summary(){return this.get("summary")}set summary(e){this.set("summary",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get GET(){return this.get("get")}set GET(e){this.set("GET",e)}get PUT(){return this.get("put")}set PUT(e){this.set("PUT",e)}get POST(){return this.get("post")}set POST(e){this.set("POST",e)}get DELETE(){return this.get("delete")}set DELETE(e){this.set("DELETE",e)}get OPTIONS(){return this.get("options")}set OPTIONS(e){this.set("OPTIONS",e)}get HEAD(){return this.get("head")}set HEAD(e){this.set("HEAD",e)}get PATCH(){return this.get("patch")}set PATCH(e){this.set("PATCH",e)}get TRACE(){return this.get("trace")}set TRACE(e){this.set("TRACE",e)}get servers(){return this.get("servers")}set servers(e){this.set("servers",e)}get parameters(){return this.get("parameters")}set parameters(e){this.set("parameters",e)}},$O=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="paths"}},OO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="reference",this.classes.push("openapi-reference")}get $ref(){return this.get("$ref")}set $ref(e){this.set("$ref",e)}},SO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="requestBody"}get description(){return this.get("description")}set description(e){this.set("description",e)}get contentProp(){return this.get("content")}set contentProp(e){this.set("content",e)}get required(){return this.hasKey("required")?this.get("required"):new Bx(!1)}set required(e){this.set("required",e)}},AO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="response"}get description(){return this.get("description")}set description(e){this.set("description",e)}get headers(){return this.get("headers")}set headers(e){this.set("headers",e)}get contentProp(){return this.get("content")}set contentProp(e){this.set("content",e)}get links(){return this.get("links")}set links(e){this.set("links",e)}},PO=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="responses"}get default(){return this.get("default")}set default(e){this.set("default",e)}};class TO extends Jx{constructor(e,t,r){super(e,t,r),this.element="JSONSchemaDraft4"}get idProp(){return this.get("id")}set idProp(e){this.set("id",e)}get $schema(){return this.get("$schema")}set $schema(e){this.set("$schema",e)}get multipleOf(){return this.get("multipleOf")}set multipleOf(e){this.set("multipleOf",e)}get maximum(){return this.get("maximum")}set maximum(e){this.set("maximum",e)}get exclusiveMaximum(){return this.get("exclusiveMaximum")}set exclusiveMaximum(e){this.set("exclusiveMaximum",e)}get minimum(){return this.get("minimum")}set minimum(e){this.set("minimum",e)}get exclusiveMinimum(){return this.get("exclusiveMinimum")}set exclusiveMinimum(e){this.set("exclusiveMinimum",e)}get maxLength(){return this.get("maxLength")}set maxLength(e){this.set("maxLength",e)}get minLength(){return this.get("minLength")}set minLength(e){this.set("minLength",e)}get pattern(){return this.get("pattern")}set pattern(e){this.set("pattern",e)}get additionalItems(){return this.get("additionalItems")}set additionalItems(e){this.set("additionalItems",e)}get items(){return this.get("items")}set items(e){this.set("items",e)}get maxItems(){return this.get("maxItems")}set maxItems(e){this.set("maxItems",e)}get minItems(){return this.get("minItems")}set minItems(e){this.set("minItems",e)}get uniqueItems(){return this.get("uniqueItems")}set uniqueItems(e){this.set("uniqueItems",e)}get maxProperties(){return this.get("maxProperties")}set maxProperties(e){this.set("maxProperties",e)}get minProperties(){return this.get("minProperties")}set minProperties(e){this.set("minProperties",e)}get required(){return this.get("required")}set required(e){this.set("required",e)}get properties(){return this.get("properties")}set properties(e){this.set("properties",e)}get additionalProperties(){return this.get("additionalProperties")}set additionalProperties(e){this.set("additionalProperties",e)}get patternProperties(){return this.get("patternProperties")}set patternProperties(e){this.set("patternProperties",e)}get dependencies(){return this.get("dependencies")}set dependencies(e){this.set("dependencies",e)}get enum(){return this.get("enum")}set enum(e){this.set("enum",e)}get type(){return this.get("type")}set type(e){this.set("type",e)}get allOf(){return this.get("allOf")}set allOf(e){this.set("allOf",e)}get anyOf(){return this.get("anyOf")}set anyOf(e){this.set("anyOf",e)}get oneOf(){return this.get("oneOf")}set oneOf(e){this.set("oneOf",e)}get not(){return this.get("not")}set not(e){this.set("not",e)}get definitions(){return this.get("definitions")}set definitions(e){this.set("definitions",e)}get title(){return this.get("title")}set title(e){this.set("title",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get default(){return this.get("default")}set default(e){this.set("default",e)}get format(){return this.get("format")}set format(e){this.set("format",e)}get base(){return this.get("base")}set base(e){this.set("base",e)}get links(){return this.get("links")}set links(e){this.set("links",e)}get media(){return this.get("media")}set media(e){this.set("media",e)}get readOnly(){return this.get("readOnly")}set readOnly(e){this.set("readOnly",e)}}class kO extends Jx{constructor(e,t,r){super(e,t,r),this.element="JSONReference",this.classes.push("json-reference")}get $ref(){return this.get("$ref")}set $ref(e){this.set("$ref",e)}}class FO extends Jx{constructor(e,t,r){super(e,t,r),this.element="media"}get binaryEncoding(){return this.get("binaryEncoding")}set binaryEncoding(e){this.set("binaryEncoding",e)}get type(){return this.get("type")}set type(e){this.set("type",e)}}class IO extends Jx{constructor(e,t,r){super(e,t,r),this.element="linkDescription"}get href(){return this.get("href")}set href(e){this.set("href",e)}get rel(){return this.get("rel")}set rel(e){this.set("rel",e)}get title(){return this.get("title")}set title(e){this.set("title",e)}get targetSchema(){return this.get("targetSchema")}set targetSchema(e){this.set("targetSchema",e)}get mediaType(){return this.get("mediaType")}set mediaType(e){this.set("mediaType",e)}get method(){return this.get("method")}set method(e){this.set("method",e)}get encType(){return this.get("encType")}set encType(e){this.set("encType",e)}get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}}const RO={namespace:e=>{const{base:t}=e;return t.register("jSONSchemaDraft4",TO),t.register("jSONReference",kO),t.register("media",FO),t.register("linkDescription",IO),t}},DO=e=>{if(sj(e))return`${e.element.charAt(0).toUpperCase()+e.element.slice(1)}Element`},_O={JSONSchemaDraft4Element:["content"],JSONReferenceElement:["content"],MediaElement:["content"],LinkDescriptionElement:["content"],...Jj};let CO=class{element;constructor(e){Object.assign(this,e)}copyMetaAndAttributes(e,t){(e.meta.length>0||t.meta.length>0)&&(t.meta=dE(t.meta,e.meta),gj(e)&&t.meta.set("sourceMap",e.meta.get("sourceMap"))),(e.attributes.length>0||e.meta.length>0)&&(t.attributes=dE(t.attributes,e.attributes))}},MO=class extends CO{enter(e){return this.element=Cj(e),Aj}};const NO=(e,t,r=[])=>{const n=Object.getOwnPropertyDescriptors(t);for(let e of r)delete n[e];Object.defineProperties(e,n)},qO=(e,t=[e])=>{const r=Object.getPrototypeOf(e);return null===r?t:qO(r,[...t,r])},BO=(e,t,r=[])=>{var n;const s=null!==(n=((...e)=>{if(0===e.length)return;let t;const r=e.map((e=>qO(e)));for(;r.every((e=>e.length>0));){const e=r.map((e=>e.pop())),n=e[0];if(!e.every((e=>e===n)))break;t=n}return t})(...e))&&void 0!==n?n:Object.prototype,i=Object.create(s),o=qO(s);for(let t of e){let e=qO(t);for(let t=e.length-1;t>=0;t--){let n=e[t];-1===o.indexOf(n)&&(NO(i,n,["constructor",...r]),o.push(n))}}return i.constructor=t,i},LO=e=>e.filter(((t,r)=>e.indexOf(t)==r)),UO=new WeakMap,JO=e=>UO.get(e),VO=(e,t)=>{var r,n;const s=LO([...Object.getOwnPropertyNames(e),...Object.getOwnPropertyNames(t)]),i={};for(let o of s)i[o]=LO([...null!==(r=null==e?void 0:e[o])&&void 0!==r?r:[],...null!==(n=null==t?void 0:t[o])&&void 0!==n?n:[]]);return i},GO=(e,t)=>{var r,n,s,i;return{property:VO(null!==(r=null==e?void 0:e.property)&&void 0!==r?r:{},null!==(n=null==t?void 0:t.property)&&void 0!==n?n:{}),method:VO(null!==(s=null==e?void 0:e.method)&&void 0!==s?s:{},null!==(i=null==t?void 0:t.method)&&void 0!==i?i:{})}},HO=new Map,zO=(...e)=>{const t=((...e)=>{var t;const r=new Set,n=new Set([...e]);for(;n.size>0;)for(let e of n){const s=[...qO(e.prototype).map((e=>e.constructor)),...null!==(t=JO(e))&&void 0!==t?t:[]].filter((e=>!r.has(e)));for(let e of s)n.add(e);r.add(e),n.delete(e)}return[...r]})(...e).map((e=>HO.get(e))).filter((e=>!!e));return 0==t.length?{}:1==t.length?t[0]:t.reduce(((e,t)=>((e,t)=>{var r,n,s,i,o,c;return{class:LO([...null!==(r=null==e?void 0:e.class)&&void 0!==r?r:[],...null!==(n=null==t?void 0:t.class)&&void 0!==n?n:[]]),static:GO(null!==(s=null==e?void 0:e.static)&&void 0!==s?s:{},null!==(i=null==t?void 0:t.static)&&void 0!==i?i:{}),instance:GO(null!==(o=null==e?void 0:e.instance)&&void 0!==o?o:{},null!==(c=null==t?void 0:t.instance)&&void 0!==c?c:{})}})(e,t)))};function XO(...e){var t,r,n;const s=e.map((e=>e.prototype));function i(...t){for(const r of e)NO(this,new r(...t))}i.prototype=BO(s,i),Object.setPrototypeOf(i,BO(e,null,["prototype"]));let o=i;{const s=zO(...e);for(let e of null!==(t=null==s?void 0:s.class)&&void 0!==t?t:[]){const t=e(o);t&&(o=t)}WO(null!==(r=null==s?void 0:s.static)&&void 0!==r?r:{},o),WO(null!==(n=null==s?void 0:s.instance)&&void 0!==n?n:{},o.prototype)}var c,a;return c=o,a=e,UO.set(c,a),o}const WO=(e,t)=>{const r=e.property,n=e.method;if(r)for(let e in r)for(let n of r[e])n(t,e);if(n)for(let e in n)for(let r of n[e])r(t,e,Object.getOwnPropertyDescriptor(t,e))};let YO=class extends CO{specObj;passingOptionsNames=["specObj"];constructor({specObj:e,...t}){super({...t}),this.specObj=e}retrievePassingOptions(){return vd(this.passingOptionsNames,this)}retrieveFixedFields(e){const t=pd(["visitors",...e,"fixedFields"],this.specObj);return"object"==typeof t&&null!==t?Object.keys(t):[]}retrieveVisitor(e){return md(qd,["visitors",...e],this.specObj)?pd(["visitors",...e],this.specObj):pd(["visitors",...e,"$visitor"],this.specObj)}retrieveVisitorInstance(e,t={}){const r=this.retrievePassingOptions();return new(this.retrieveVisitor(e))({...r,...t})}toRefractedElement(e,t,r={}){const n=this.retrieveVisitorInstance(e,r);return n instanceof MO&&(null==n?void 0:n.constructor)===MO?Cj(t):(Gj(t,n,r),n.element)}},ZO=class extends YO{specPath;ignoredFields;constructor({specPath:e,ignoredFields:t,...r}){super({...r}),this.specPath=e,this.ignoredFields=t||[]}ObjectElement(e){const t=this.specPath(e),r=this.retrieveFixedFields(t);return e.forEach(((e,n,s)=>{if(ij(n)&&r.includes(oE(n))&&!this.ignoredFields.includes(oE(n))){const r=this.toRefractedElement([...t,"fixedFields",oE(n)],e),i=new Vx(Cj(n),r);this.copyMetaAndAttributes(s,i),i.classes.push("fixed-field"),this.element.content.push(i)}else this.ignoredFields.includes(oE(n))||this.element.content.push(Cj(s))})),this.copyMetaAndAttributes(e,this.element),Aj}};class KO extends(XO(ZO,MO)){constructor(e){super(e),this.element=new TO,this.specPath=Wf(["document","objects","JSONSchema"])}}let QO=class{parent;constructor({parent:e}){this.parent=e}};const eS=e=>uj(e)&&e.hasKey("$ref");let tS=class extends(XO(YO,QO,MO)){ObjectElement(e){const t=eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"];return this.element=this.toRefractedElement(t,e),Aj}ArrayElement(e){return this.element=new Ux,this.element.classes.push("json-schema-items"),e.forEach((e=>{const t=eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}};let rS=class extends YO{specPath;ignoredFields;fieldPatternPredicate=_h;constructor({specPath:e,ignoredFields:t,fieldPatternPredicate:r,...n}){super({...n}),this.specPath=e,this.ignoredFields=t||[],"function"==typeof r&&(this.fieldPatternPredicate=r)}ObjectElement(e){return e.forEach(((e,t,r)=>{if(!this.ignoredFields.includes(oE(t))&&this.fieldPatternPredicate(oE(t))){const n=this.specPath(e),s=this.toRefractedElement(n,e),i=new Vx(Cj(t),s);this.copyMetaAndAttributes(r,i),i.classes.push("patterned-field"),this.element.content.push(i)}else this.ignoredFields.includes(oE(t))||this.element.content.push(Cj(r))})),this.copyMetaAndAttributes(e,this.element),Aj}},nS=class extends rS{constructor(e){super(e),this.fieldPatternPredicate=Xd}},sS=class extends(XO(nS,QO,MO)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-properties"),this.specPath=e=>eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"]}},iS=class extends(XO(nS,QO,MO)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-patternProperties"),this.specPath=e=>eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"]}};class oS extends(XO(nS,QO,MO)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-dependencies"),this.specPath=e=>eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"]}}let cS=class extends(XO(YO,QO,MO)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-allOf")}ArrayElement(e){return e.forEach((e=>{const t=eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}},aS=class extends(XO(YO,QO,MO)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-anyOf")}ArrayElement(e){return e.forEach((e=>{const t=eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}},uS=class extends(XO(YO,QO,MO)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-oneOf")}ArrayElement(e){return e.forEach((e=>{const t=eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}};class lS extends(XO(nS,QO,MO)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-definitions"),this.specPath=e=>eS(e)?["document","objects","JSONReference"]:["document","objects","JSONSchema"]}}let hS=class extends(XO(YO,QO,MO)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-links")}ArrayElement(e){return e.forEach((e=>{const t=this.toRefractedElement(["document","objects","LinkDescription"],e);this.element.push(t)})),this.copyMetaAndAttributes(e,this.element),Aj}};class fS extends(XO(ZO,MO)){constructor(e){super(e),this.element=new kO,this.specPath=Wf(["document","objects","JSONReference"])}ObjectElement(e){const t=ZO.prototype.ObjectElement.call(this,e);return ij(this.element.$ref)&&this.element.classes.push("reference-element"),t}}let pS=class extends YO{alternator;constructor({alternator:e,...t}){super({...t}),this.alternator=e}enter(e){const t=this.alternator.map((({predicate:e,specPath:t})=>Yp(e,Wf(t),Fd))),r=pm(t)(e);return this.element=this.toRefractedElement(r,e),Aj}},dS=class extends pS{constructor(e){super(e),this.alternator=[{predicate:eS,specPath:["document","objects","JSONReference"]},{predicate:Ch,specPath:["document","objects","JSONSchema"]}]}};class mS extends(XO(ZO,MO)){constructor(e){super(e),this.element=new FO,this.specPath=Wf(["document","objects","Media"])}}class vS extends(XO(ZO,MO)){constructor(e){super(e),this.element=new IO,this.specPath=Wf(["document","objects","LinkDescription"])}}const yS={visitors:{value:MO,JSONSchemaOrJSONReferenceVisitor:dS,document:{objects:{JSONSchema:{$visitor:KO,fixedFields:{id:{$ref:"#/visitors/value"},$schema:{$ref:"#/visitors/value"},multipleOf:{$ref:"#/visitors/value"},maximum:{$ref:"#/visitors/value"},exclusiveMaximum:{$ref:"#/visitors/value"},minimum:{$ref:"#/visitors/value"},exclusiveMinimum:{$ref:"#/visitors/value"},maxLength:{$ref:"#/visitors/value"},minLength:{$ref:"#/visitors/value"},pattern:{$ref:"#/visitors/value"},additionalItems:dS,items:tS,maxItems:{$ref:"#/visitors/value"},minItems:{$ref:"#/visitors/value"},uniqueItems:{$ref:"#/visitors/value"},maxProperties:{$ref:"#/visitors/value"},minProperties:{$ref:"#/visitors/value"},required:class extends MO{ArrayElement(e){const t=this.enter(e);return this.element.classes.push("json-schema-required"),t}},properties:sS,additionalProperties:dS,patternProperties:iS,dependencies:oS,enum:class extends MO{ArrayElement(e){const t=this.enter(e);return this.element.classes.push("json-schema-enum"),t}},type:class extends MO{StringElement(e){const t=this.enter(e);return this.element.classes.push("json-schema-type"),t}ArrayElement(e){const t=this.enter(e);return this.element.classes.push("json-schema-type"),t}},allOf:cS,anyOf:aS,oneOf:uS,not:dS,definitions:lS,title:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},default:{$ref:"#/visitors/value"},format:{$ref:"#/visitors/value"},base:{$ref:"#/visitors/value"},links:hS,media:{$ref:"#/visitors/document/objects/Media"},readOnly:{$ref:"#/visitors/value"}}},JSONReference:{$visitor:fS,fixedFields:{$ref:class extends MO{StringElement(e){const t=this.enter(e);return this.element.classes.push("reference-value"),t}}}},Media:{$visitor:mS,fixedFields:{binaryEncoding:{$ref:"#/visitors/value"},type:{$ref:"#/visitors/value"}}},LinkDescription:{$visitor:vS,fixedFields:{href:{$ref:"#/visitors/value"},rel:{$ref:"#/visitors/value"},title:{$ref:"#/visitors/value"},targetSchema:dS,mediaType:{$ref:"#/visitors/value"},method:{$ref:"#/visitors/value"},encType:{$ref:"#/visitors/value"},schema:dS}}}}}},bS=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof TO||e(n)&&t("JSONSchemaDraft4",n)&&r("object",n))),gS=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof kO||e(n)&&t("JSONReference",n)&&r("object",n))),wS=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof FO||e(n)&&t("media",n)&&r("object",n))),xS=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof IO||e(n)&&t("linkDescription",n)&&r("object",n))),jS=Object.freeze(Object.defineProperty({__proto__:null,isJSONReferenceElement:gS,isJSONSchemaElement:bS,isLinkDescriptionElement:xS,isMediaElement:wS},Symbol.toStringTag,{value:"Module"})),ES=()=>{const e=$j(RO);return{predicates:{...jS,isStringElement:ij},namespace:e}},$S=e=>(t,r={})=>((e,{specPath:t=["visitors","document","objects","JSONSchema","$visitor"],plugins:r=[],specificationObj:n=yS}={})=>{const s=zx(e),i=uE(n),o=new(pd(t,i))({specObj:i});return Gj(s,o),zj(o.element,r,{toolboxCreator:ES,visitorOptions:{keyMap:_O,nodeTypeGetter:DO}})})(t,{specPath:e,...r});TO.refract=$S(["visitors","document","objects","JSONSchema","$visitor"]),kO.refract=$S(["visitors","document","objects","JSONReference","$visitor"]),FO.refract=$S(["visitors","document","objects","Media","$visitor"]),IO.refract=$S(["visitors","document","objects","LinkDescription","$visitor"]);let OS=class extends TO{constructor(e,t,r){super(e,t,r),this.element="schema",this.classes.push("json-schema-draft-4")}get idProp(){throw new Rh("idProp getter in Schema class is not not supported.")}set idProp(e){throw new Rh("idProp setter in Schema class is not not supported.")}get $schema(){throw new Rh("$schema getter in Schema class is not not supported.")}set $schema(e){throw new Rh("$schema setter in Schema class is not not supported.")}get additionalItems(){return this.get("additionalItems")}set additionalItems(e){this.set("additionalItems",e)}get items(){return this.get("items")}set items(e){this.set("items",e)}get additionalProperties(){return this.get("additionalProperties")}set additionalProperties(e){this.set("additionalProperties",e)}get patternProperties(){throw new Rh("patternProperties getter in Schema class is not not supported.")}set patternProperties(e){throw new Rh("patternProperties setter in Schema class is not not supported.")}get dependencies(){throw new Rh("dependencies getter in Schema class is not not supported.")}set dependencies(e){throw new Rh("dependencies setter in Schema class is not not supported.")}get type(){return this.get("type")}set type(e){this.set("type",e)}get not(){return this.get("not")}set not(e){this.set("not",e)}get definitions(){throw new Rh("definitions getter in Schema class is not not supported.")}set definitions(e){throw new Rh("definitions setter in Schema class is not not supported.")}get base(){throw new Rh("base getter in Schema class is not not supported.")}set base(e){throw new Rh("base setter in Schema class is not not supported.")}get links(){throw new Rh("links getter in Schema class is not not supported.")}set links(e){throw new Rh("links setter in Schema class is not not supported.")}get media(){throw new Rh("media getter in Schema class is not not supported.")}set media(e){throw new Rh("media setter in Schema class is not not supported.")}get nullable(){return this.get("nullable")}set nullable(e){this.set("nullable",e)}get discriminator(){return this.get("discriminator")}set discriminator(e){this.set("discriminator",e)}get writeOnly(){return this.get("writeOnly")}set writeOnly(e){this.set("writeOnly",e)}get xml(){return this.get("xml")}set xml(e){this.set("xml",e)}get externalDocs(){return this.get("externalDocs")}set externalDocs(e){this.set("externalDocs",e)}get example(){return this.get("example")}set example(e){this.set("example",e)}get deprecated(){return this.get("deprecated")}set deprecated(e){this.set("deprecated",e)}},SS=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="securityRequirement"}},AS=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="securityScheme"}get type(){return this.get("type")}set type(e){this.set("type",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get name(){return this.get("name")}set name(e){this.set("name",e)}get in(){return this.get("in")}set in(e){this.set("in",e)}get scheme(){return this.get("scheme")}set scheme(e){this.set("scheme",e)}get bearerFormat(){return this.get("bearerFormat")}set bearerFormat(e){this.set("bearerFormat",e)}get flows(){return this.get("flows")}set flows(e){this.set("flows",e)}get openIdConnectUrl(){return this.get("openIdConnectUrl")}set openIdConnectUrl(e){this.set("openIdConnectUrl",e)}},PS=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="server"}get url(){return this.get("url")}set url(e){this.set("url",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get variables(){return this.get("variables")}set variables(e){this.set("variables",e)}},TS=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="serverVariable"}get enum(){return this.get("enum")}set enum(e){this.set("enum",e)}get default(){return this.get("default")}set default(e){this.set("default",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}},kS=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="tag"}get name(){return this.get("name")}set name(e){this.set("name",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get externalDocs(){return this.get("externalDocs")}set externalDocs(e){this.set("externalDocs",e)}},FS=class extends Jx{constructor(e,t,r){super(e,t,r),this.element="xml"}get name(){return this.get("name")}set name(e){this.set("name",e)}get namespace(){return this.get("namespace")}set namespace(e){this.set("namespace",e)}get prefix(){return this.get("prefix")}set prefix(e){this.set("prefix",e)}get attribute(){return this.get("attribute")}set attribute(e){this.set("attribute",e)}get wrapped(){return this.get("wrapped")}set wrapped(e){this.set("wrapped",e)}};const IS={namespace:e=>{const{base:t}=e;return t.register("callback",iO),t.register("components",oO),t.register("contact",cO),t.register("discriminator",aO),t.register("encoding",uO),t.register("example",lO),t.register("externalDocumentation",hO),t.register("header",fO),t.register("info",pO),t.register("license",dO),t.register("link",mO),t.register("mediaType",vO),t.register("oAuthFlow",yO),t.register("oAuthFlows",bO),t.register("openapi",gO),t.register("openApi3_0",wO),t.register("operation",xO),t.register("parameter",jO),t.register("pathItem",EO),t.register("paths",$O),t.register("reference",OO),t.register("requestBody",SO),t.register("response",AO),t.register("responses",PO),t.register("schema",OS),t.register("securityRequirement",SS),t.register("securityScheme",AS),t.register("server",PS),t.register("serverVariable",TS),t.register("tag",kS),t.register("xml",FS),t}};class RS extends Ux{static primaryClass="servers";constructor(e,t,r){super(e,t,r),this.classes.push(RS.primaryClass)}}class DS extends Ux{static primaryClass="security";constructor(e,t,r){super(e,t,r),this.classes.push(DS.primaryClass)}}class _S extends Ux{static primaryClass="tags";constructor(e,t,r){super(e,t,r),this.classes.push(_S.primaryClass)}}class CS extends Jx{static primaryClass="server-variables";constructor(e,t,r){super(e,t,r),this.classes.push(CS.primaryClass)}}class MS extends Jx{static primaryClass="components-schemas";constructor(e,t,r){super(e,t,r),this.classes.push(MS.primaryClass)}}class NS extends Jx{static primaryClass="components-responses";constructor(e,t,r){super(e,t,r),this.classes.push(NS.primaryClass)}}class qS extends Jx{static primaryClass="components-parameters";constructor(e,t,r){super(e,t,r),this.classes.push(qS.primaryClass),this.classes.push("parameters")}}class BS extends Jx{static primaryClass="components-examples";constructor(e,t,r){super(e,t,r),this.classes.push(BS.primaryClass),this.classes.push("examples")}}class LS extends Jx{static primaryClass="components-request-bodies";constructor(e,t,r){super(e,t,r),this.classes.push(LS.primaryClass)}}class US extends Jx{static primaryClass="components-headers";constructor(e,t,r){super(e,t,r),this.classes.push(US.primaryClass)}}class JS extends Jx{static primaryClass="components-security-schemes";constructor(e,t,r){super(e,t,r),this.classes.push(JS.primaryClass)}}class VS extends Jx{static primaryClass="components-links";constructor(e,t,r){super(e,t,r),this.classes.push(VS.primaryClass)}}class GS extends Jx{static primaryClass="components-callbacks";constructor(e,t,r){super(e,t,r),this.classes.push(GS.primaryClass)}}class HS extends Ux{static primaryClass="path-item-servers";constructor(e,t,r){super(e,t,r),this.classes.push(HS.primaryClass),this.classes.push("servers")}}class zS extends Ux{static primaryClass="path-item-parameters";constructor(e,t,r){super(e,t,r),this.classes.push(zS.primaryClass),this.classes.push("parameters")}}class XS extends Ux{static primaryClass="operation-parameters";constructor(e,t,r){super(e,t,r),this.classes.push(XS.primaryClass),this.classes.push("parameters")}}class WS extends Jx{static primaryClass="parameter-examples";constructor(e,t,r){super(e,t,r),this.classes.push(WS.primaryClass),this.classes.push("examples")}}class YS extends Jx{static primaryClass="parameter-content";constructor(e,t,r){super(e,t,r),this.classes.push(YS.primaryClass),this.classes.push("content")}}class ZS extends Ux{static primaryClass="operation-tags";constructor(e,t,r){super(e,t,r),this.classes.push(ZS.primaryClass)}}class KS extends Jx{static primaryClass="operation-callbacks";constructor(e,t,r){super(e,t,r),this.classes.push(KS.primaryClass)}}class QS extends Ux{static primaryClass="operation-security";constructor(e,t,r){super(e,t,r),this.classes.push(QS.primaryClass),this.classes.push("security")}}class eA extends Ux{static primaryClass="operation-servers";constructor(e,t,r){super(e,t,r),this.classes.push(eA.primaryClass),this.classes.push("servers")}}class tA extends Jx{static primaryClass="request-body-content";constructor(e,t,r){super(e,t,r),this.classes.push(tA.primaryClass),this.classes.push("content")}}class rA extends Jx{static primaryClass="media-type-examples";constructor(e,t,r){super(e,t,r),this.classes.push(rA.primaryClass),this.classes.push("examples")}}class nA extends Jx{static primaryClass="media-type-encoding";constructor(e,t,r){super(e,t,r),this.classes.push(nA.primaryClass)}}class sA extends Jx{static primaryClass="encoding-headers";constructor(e,t,r){super(e,t,r),this.classes.push(sA.primaryClass)}}class iA extends Jx{static primaryClass="response-headers";constructor(e,t,r){super(e,t,r),this.classes.push(iA.primaryClass)}}class oA extends Jx{static primaryClass="response-content";constructor(e,t,r){super(e,t,r),this.classes.push(oA.primaryClass),this.classes.push("content")}}class cA extends Jx{static primaryClass="response-links";constructor(e,t,r){super(e,t,r),this.classes.push(cA.primaryClass)}}class aA extends Jx{static primaryClass="discriminator-mapping";constructor(e,t,r){super(e,t,r),this.classes.push(aA.primaryClass)}}class uA extends Jx{static primaryClass="oauth-flow-scopes";constructor(e,t,r){super(e,t,r),this.classes.push(uA.primaryClass)}}class lA extends Jx{static primaryClass="link-parameters";constructor(e,t,r){super(e,t,r),this.classes.push(lA.primaryClass)}}class hA extends Jx{static primaryClass="header-examples";constructor(e,t,r){super(e,t,r),this.classes.push(hA.primaryClass),this.classes.push("examples")}}class fA extends Jx{static primaryClass="header-content";constructor(e,t,r){super(e,t,r),this.classes.push(fA.primaryClass),this.classes.push("content")}}const pA=e=>{if(sj(e))return`${e.element.charAt(0).toUpperCase()+e.element.slice(1)}Element`},dA={CallbackElement:["content"],ComponentsElement:["content"],ContactElement:["content"],DiscriminatorElement:["content"],Encoding:["content"],Example:["content"],ExternalDocumentationElement:["content"],HeaderElement:["content"],InfoElement:["content"],LicenseElement:["content"],MediaTypeElement:["content"],OAuthFlowElement:["content"],OAuthFlowsElement:["content"],OpenApi3_0Element:["content"],OperationElement:["content"],ParameterElement:["content"],PathItemElement:["content"],PathsElement:["content"],ReferenceElement:["content"],RequestBodyElement:["content"],ResponseElement:["content"],ResponsesElement:["content"],SchemaElement:["content"],SecurityRequirementElement:["content"],SecuritySchemeElement:["content"],ServerElement:["content"],ServerVariableElement:["content"],TagElement:["content"],...Jj};class mA{element;constructor(e={}){Object.assign(this,e)}copyMetaAndAttributes(e,t){(e.meta.length>0||t.meta.length>0)&&(t.meta=dE(t.meta,e.meta),gj(e)&&t.meta.set("sourceMap",e.meta.get("sourceMap"))),(e.attributes.length>0||e.meta.length>0)&&(t.attributes=dE(t.attributes,e.attributes))}}class vA extends mA{enter(e){return this.element=Cj(e),Aj}}class yA extends mA{specObj;passingOptionsNames=["specObj","openApiGenericElement","openApiSemanticElement"];openApiGenericElement;openApiSemanticElement;constructor({specObj:e,passingOptionsNames:t,openApiGenericElement:r,openApiSemanticElement:n,...s}){super({...s}),this.specObj=e,this.openApiGenericElement=r,this.openApiSemanticElement=n,Array.isArray(t)&&(this.passingOptionsNames=t)}retrievePassingOptions(){return vd(this.passingOptionsNames,this)}retrieveFixedFields(e){const t=pd(["visitors",...e,"fixedFields"],this.specObj);return"object"==typeof t&&null!==t?Object.keys(t):[]}retrieveVisitor(e){return md(qd,["visitors",...e],this.specObj)?pd(["visitors",...e],this.specObj):pd(["visitors",...e,"$visitor"],this.specObj)}retrieveVisitorInstance(e,t={}){const r=this.retrievePassingOptions();return new(this.retrieveVisitor(e))({...r,...t})}toRefractedElement(e,t,r={}){const n=this.retrieveVisitorInstance(e,r);return n instanceof vA&&(null==n?void 0:n.constructor)===vA?Cj(t):(Gj(t,n,r),n.element)}}const bA=e=>uj(e)&&e.hasKey("$ref"),gA=uj,wA=uj,xA=e=>ij(e.key)&&Od("x-",oE(e.key));class jA extends yA{specPath;ignoredFields;canSupportSpecificationExtensions=!0;specificationExtensionPredicate=xA;constructor({specPath:e,ignoredFields:t,canSupportSpecificationExtensions:r,specificationExtensionPredicate:n,...s}){super({...s}),this.specPath=e,this.ignoredFields=t||[],"boolean"==typeof r&&(this.canSupportSpecificationExtensions=r),"function"==typeof n&&(this.specificationExtensionPredicate=n)}ObjectElement(e){const t=this.specPath(e),r=this.retrieveFixedFields(t);return e.forEach(((e,n,s)=>{if(ij(n)&&r.includes(oE(n))&&!this.ignoredFields.includes(oE(n))){const r=this.toRefractedElement([...t,"fixedFields",oE(n)],e),i=new Vx(Cj(n),r);this.copyMetaAndAttributes(s,i),i.classes.push("fixed-field"),this.element.content.push(i)}else if(this.canSupportSpecificationExtensions&&this.specificationExtensionPredicate(s)){const e=this.toRefractedElement(["document","extension"],s);this.element.content.push(e)}else this.ignoredFields.includes(oE(n))||this.element.content.push(Cj(s))})),this.copyMetaAndAttributes(e,this.element),Aj}}class EA extends(XO(jA,vA)){constructor(e){super(e),this.element=new wO,this.specPath=Wf(["document","objects","OpenApi"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){return jA.prototype.ObjectElement.call(this,e)}}class $A extends(XO(yA,vA)){StringElement(e){const t=new gO(oE(e));return this.copyMetaAndAttributes(e,t),this.element=t,Aj}}let OA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new pO,this.specPath=Wf(["document","objects","Info"]),this.canSupportSpecificationExtensions=!0}};let SA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new cO,this.specPath=Wf(["document","objects","Contact"]),this.canSupportSpecificationExtensions=!0}},AA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new dO,this.specPath=Wf(["document","objects","License"]),this.canSupportSpecificationExtensions=!0}},PA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new mO,this.specPath=Wf(["document","objects","Link"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return(ij(this.element.operationId)||ij(this.element.operationRef))&&this.element.classes.push("reference-element"),t}};class TA extends yA{specPath;ignoredFields;fieldPatternPredicate=_h;canSupportSpecificationExtensions=!1;specificationExtensionPredicate=xA;constructor({specPath:e,ignoredFields:t,fieldPatternPredicate:r,canSupportSpecificationExtensions:n,specificationExtensionPredicate:s,...i}){super({...i}),this.specPath=e,this.ignoredFields=t||[],"function"==typeof r&&(this.fieldPatternPredicate=r),"boolean"==typeof n&&(this.canSupportSpecificationExtensions=n),"function"==typeof s&&(this.specificationExtensionPredicate=s)}ObjectElement(e){return e.forEach(((e,t,r)=>{if(this.canSupportSpecificationExtensions&&this.specificationExtensionPredicate(r)){const e=this.toRefractedElement(["document","extension"],r);this.element.content.push(e)}else if(!this.ignoredFields.includes(oE(t))&&this.fieldPatternPredicate(oE(t))){const n=this.specPath(e),s=this.toRefractedElement(n,e),i=new Vx(Cj(t),s);this.copyMetaAndAttributes(r,i),i.classes.push("patterned-field"),this.element.content.push(i)}else this.ignoredFields.includes(oE(t))||this.element.content.push(Cj(r))})),this.copyMetaAndAttributes(e,this.element),Aj}}class kA extends TA{constructor(e){super(e),this.fieldPatternPredicate=Xd}}let FA=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new lA,this.specPath=Wf(["value"])}},IA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new PS,this.specPath=Wf(["document","objects","Server"]),this.canSupportSpecificationExtensions=!0}};let RA=class extends(XO(yA,vA)){constructor(e){super(e),this.element=new RS}ArrayElement(e){return e.forEach((e=>{const t=gA(e)?["document","objects","Server"]:["value"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}},DA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new TS,this.specPath=Wf(["document","objects","ServerVariable"]),this.canSupportSpecificationExtensions=!0}};class _A extends(XO(kA,vA)){constructor(e){super(e),this.element=new CS,this.specPath=Wf(["document","objects","ServerVariable"])}}let CA=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new vO,this.specPath=Wf(["document","objects","MediaType"]),this.canSupportSpecificationExtensions=!0}};class MA extends yA{alternator;constructor({alternator:e,...t}){super({...t}),this.alternator=e||[]}enter(e){const t=this.alternator.map((({predicate:e,specPath:t})=>Yp(e,Wf(t),Fd))),r=pm(t)(e);return this.element=this.toRefractedElement(r,e),Aj}}const NA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof iO||e(n)&&t("callback",n)&&r("object",n))),qA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof oO||e(n)&&t("components",n)&&r("object",n))),BA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof cO||e(n)&&t("contact",n)&&r("object",n))),LA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof lO||e(n)&&t("example",n)&&r("object",n))),UA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof hO||e(n)&&t("externalDocumentation",n)&&r("object",n))),JA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof fO||e(n)&&t("header",n)&&r("object",n))),VA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof pO||e(n)&&t("info",n)&&r("object",n))),GA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof dO||e(n)&&t("license",n)&&r("object",n))),HA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof mO||e(n)&&t("link",n)&&r("object",n))),zA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof gO||e(n)&&t("openapi",n)&&r("string",n))),XA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r,hasClass:n})=>s=>s instanceof wO||e(s)&&t("openApi3_0",s)&&r("object",s)&&n("api",s))),WA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof xO||e(n)&&t("operation",n)&&r("object",n))),YA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof jO||e(n)&&t("parameter",n)&&r("object",n))),ZA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof EO||e(n)&&t("pathItem",n)&&r("object",n))),KA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof $O||e(n)&&t("paths",n)&&r("object",n))),QA=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof OO||e(n)&&t("reference",n)&&r("object",n))),eP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof SO||e(n)&&t("requestBody",n)&&r("object",n))),tP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof AO||e(n)&&t("response",n)&&r("object",n))),rP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof PO||e(n)&&t("responses",n)&&r("object",n))),nP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof OS||e(n)&&t("schema",n)&&r("object",n))),sP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof SS||e(n)&&t("securityRequirement",n)&&r("object",n))),iP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof AS||e(n)&&t("securityScheme",n)&&r("object",n))),oP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof PS||e(n)&&t("server",n)&&r("object",n))),cP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof TS||e(n)&&t("serverVariable",n)&&r("object",n))),aP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof vO||e(n)&&t("mediaType",n)&&r("object",n))),uP=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r,hasClass:n})=>s=>s instanceof RS||e(s)&&t("array",s)&&r("array",s)&&n("servers",s))),lP=Object.freeze(Object.defineProperty({__proto__:null,isBooleanJsonSchemaElement:e=>aj(e)&&e.classes.includes("boolean-json-schema"),isCallbackElement:NA,isComponentsElement:qA,isContactElement:BA,isExampleElement:LA,isExternalDocumentationElement:UA,isHeaderElement:JA,isInfoElement:VA,isLicenseElement:GA,isLinkElement:HA,isMediaTypeElement:aP,isOpenApi3_0Element:XA,isOpenapiElement:zA,isOperationElement:WA,isParameterElement:YA,isPathItemElement:ZA,isPathsElement:KA,isReferenceElement:QA,isRequestBodyElement:eP,isResponseElement:tP,isResponsesElement:rP,isSchemaElement:nP,isSecurityRequirementElement:sP,isSecuritySchemeElement:iP,isServerElement:oP,isServerVariableElement:cP,isServersElement:uP},Symbol.toStringTag,{value:"Module"}));let hP=class extends(XO(MA,vA)){constructor(e){super(e),this.alternator=[{predicate:bA,specPath:["document","objects","Reference"]},{predicate:Ch,specPath:["document","objects","Schema"]}]}ObjectElement(e){const t=MA.prototype.enter.call(this,e);return QA(this.element)&&this.element.setMetaProperty("referenced-element","schema"),t}},fP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("examples"),this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Example"],this.canSupportSpecificationExtensions=!0}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","example")})),t}},pP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new nA,this.specPath=Wf(["document","objects","Encoding"])}},dP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new SS,this.specPath=Wf(["value"])}},mP=class extends(XO(yA,vA)){constructor(e){super(e),this.element=new DS}ArrayElement(e){return e.forEach((e=>{if(uj(e)){const t=this.toRefractedElement(["document","objects","SecurityRequirement"],e);this.element.push(t)}else this.element.push(Cj(e))})),this.copyMetaAndAttributes(e,this.element),Aj}},vP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new oO,this.specPath=Wf(["document","objects","Components"]),this.canSupportSpecificationExtensions=!0}},yP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new kS,this.specPath=Wf(["document","objects","Tag"]),this.canSupportSpecificationExtensions=!0}},bP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new OO,this.specPath=Wf(["document","objects","Reference"]),this.canSupportSpecificationExtensions=!1}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return ij(this.element.$ref)&&this.element.classes.push("reference-element"),t}},gP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new jO,this.specPath=Wf(["document","objects","Parameter"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return uj(this.element.contentProp)&&this.element.contentProp.filter(aP).forEach(((e,t)=>{e.setMetaProperty("media-type",oE(t))})),t}},wP=class extends(XO(MA,vA)){constructor(e){super(e),this.alternator=[{predicate:bA,specPath:["document","objects","Reference"]},{predicate:Ch,specPath:["document","objects","Schema"]}]}ObjectElement(e){const t=MA.prototype.enter.call(this,e);return QA(this.element)&&this.element.setMetaProperty("referenced-element","schema"),t}},xP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new fO,this.specPath=Wf(["document","objects","Header"]),this.canSupportSpecificationExtensions=!0}},jP=class extends(XO(MA,vA)){constructor(e){super(e),this.alternator=[{predicate:bA,specPath:["document","objects","Reference"]},{predicate:Ch,specPath:["document","objects","Schema"]}]}ObjectElement(e){const t=MA.prototype.enter.call(this,e);return QA(this.element)&&this.element.setMetaProperty("referenced-element","schema"),t}},EP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("content"),this.specPath=Wf(["document","objects","MediaType"])}},$P=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new OS,this.specPath=Wf(["document","objects","Schema"]),this.canSupportSpecificationExtensions=!0}};const{allOf:OP}=yS.visitors.document.objects.JSONSchema.fixedFields;const{anyOf:SP}=yS.visitors.document.objects.JSONSchema.fixedFields;const{oneOf:AP}=yS.visitors.document.objects.JSONSchema.fixedFields;const{items:PP}=yS.visitors.document.objects.JSONSchema.fixedFields;const{properties:TP}=yS.visitors.document.objects.JSONSchema.fixedFields;const{type:kP}=yS.visitors.document.objects.JSONSchema.fixedFields;const{JSONSchemaOrJSONReferenceVisitor:FP}=yS.visitors;class IP extends FP{ObjectElement(e){const t=FP.prototype.enter.call(this,e);return QA(this.element)&&this.element.setMetaProperty("referenced-element","schema"),t}}let RP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new aO,this.specPath=Wf(["document","objects","Discriminator"]),this.canSupportSpecificationExtensions=!1}};class DP extends(XO(kA,vA)){constructor(e){super(e),this.element=new aA,this.specPath=Wf(["value"])}}let _P=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new FS,this.specPath=Wf(["document","objects","XML"]),this.canSupportSpecificationExtensions=!0}},CP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new MS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Schema"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","schema")})),t}},MP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new NS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Response"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","response")})),this.element.filter(tP).forEach(((e,t)=>{e.setMetaProperty("http-status-code",oE(t))})),t}},NP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new qS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Parameter"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","parameter")})),t}},qP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new BS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Example"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","example")})),t}};class BP extends(XO(kA,vA)){constructor(e){super(e),this.element=new LS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","RequestBody"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","requestBody")})),t}}let LP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new US,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Header"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","header")})),this.element.filter(JA).forEach(((e,t)=>{e.setMetaProperty("header-name",oE(t))})),t}};class UP extends(XO(kA,vA)){constructor(e){super(e),this.element=new JS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","SecurityScheme"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","securityScheme")})),t}}let JP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new VS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Link"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","link")})),t}},VP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new GS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Callback"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","callback")})),t}},GP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new lO,this.specPath=Wf(["document","objects","Example"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return ij(this.element.externalValue)&&this.element.classes.push("reference-element"),t}};let HP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new hO,this.specPath=Wf(["document","objects","ExternalDocumentation"]),this.canSupportSpecificationExtensions=!0}},zP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new uO,this.specPath=Wf(["document","objects","Encoding"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return uj(this.element.headers)&&this.element.headers.filter(JA).forEach(((e,t)=>{e.setMetaProperty("header-name",oE(t))})),t}},XP=class extends(XO(kA,vA)){constructor(e){super(e),this.element=new sA,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Header"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","header")})),this.element.forEach(((e,t)=>{if(!JA(e))return;const r=oE(t);e.setMetaProperty("headerName",r)})),t}},WP=class extends(XO(TA,vA)){constructor(e){super(e),this.element=new $O,this.specPath=Wf(["document","objects","PathItem"]),this.canSupportSpecificationExtensions=!0,this.fieldPatternPredicate=Ch}ObjectElement(e){const t=TA.prototype.ObjectElement.call(this,e);return this.element.filter(ZA).forEach(((e,t)=>{t.classes.push("openapi-path-template"),t.classes.push("path-template"),e.setMetaProperty("path",Cj(t))})),t}},YP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new SO,this.specPath=Wf(["document","objects","RequestBody"])}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return uj(this.element.contentProp)&&this.element.contentProp.filter(aP).forEach(((e,t)=>{e.setMetaProperty("media-type",oE(t))})),t}},ZP=class extends(XO(TA,vA)){constructor(e){super(e),this.element=new iO,this.specPath=Wf(["document","objects","PathItem"]),this.canSupportSpecificationExtensions=!0,this.fieldPatternPredicate=e=>/{(?<expression>[^}]{1,2083})}/.test(String(e))}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(ZA).forEach(((e,t)=>{e.setMetaProperty("runtime-expression",oE(t))})),t}},KP=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new AO,this.specPath=Wf(["document","objects","Response"])}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return uj(this.element.contentProp)&&this.element.contentProp.filter(aP).forEach(((e,t)=>{e.setMetaProperty("media-type",oE(t))})),uj(this.element.headers)&&this.element.headers.filter(JA).forEach(((e,t)=>{e.setMetaProperty("header-name",oE(t))})),t}};class QP extends(XO(kA,vA)){constructor(e){super(e),this.element=new iA,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Header"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","header")})),this.element.forEach(((e,t)=>{if(!JA(e))return;const r=oE(t);e.setMetaProperty("header-name",r)})),t}}class eT extends(XO(kA,vA)){constructor(e){super(e),this.element=new cA,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Link"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","link")})),t}}class tT extends(XO(jA,TA)){specPathFixedFields;specPathPatternedFields;constructor({specPathFixedFields:e,specPathPatternedFields:t,...r}){super({...r}),this.specPathFixedFields=e,this.specPathPatternedFields=t}ObjectElement(e){const{specPath:t,ignoredFields:r}=this;try{this.specPath=this.specPathFixedFields;const t=this.retrieveFixedFields(this.specPath(e));this.ignoredFields=[...r,...kp(e.keys(),t)],jA.prototype.ObjectElement.call(this,e),this.specPath=this.specPathPatternedFields,this.ignoredFields=t,TA.prototype.ObjectElement.call(this,e)}catch(e){throw this.specPath=t,e}return Aj}}let rT=class extends(XO(tT,vA)){constructor(e){super(e),this.element=new PO,this.specPathFixedFields=Wf(["document","objects","Responses"]),this.canSupportSpecificationExtensions=!0,this.specPathPatternedFields=e=>bA(e)?["document","objects","Reference"]:["document","objects","Response"],this.fieldPatternPredicate=e=>new RegExp(`^(1XX|2XX|3XX|4XX|5XX|${wd(100,600).join("|")})$`).test(String(e))}ObjectElement(e){const t=tT.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","response")})),this.element.filter(tP).forEach(((e,t)=>{const r=Cj(t);this.fieldPatternPredicate(oE(r))&&e.setMetaProperty("http-status-code",r)})),t}};class nT extends(XO(MA,vA)){constructor(e){super(e),this.alternator=[{predicate:bA,specPath:["document","objects","Reference"]},{predicate:Ch,specPath:["document","objects","Response"]}]}ObjectElement(e){const t=MA.prototype.enter.call(this,e);return QA(this.element)?this.element.setMetaProperty("referenced-element","response"):tP(this.element)&&this.element.setMetaProperty("http-status-code","default"),t}}let sT=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new xO,this.specPath=Wf(["document","objects","Operation"])}},iT=class extends(XO(yA,vA)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("parameters")}ArrayElement(e){return e.forEach((e=>{const t=bA(e)?["document","objects","Reference"]:["document","objects","Parameter"],r=this.toRefractedElement(t,e);QA(r)&&r.setMetaProperty("referenced-element","parameter"),this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}};class oT extends(XO(kA,vA)){specPath;constructor(e){super(e),this.element=new KS,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","Callback"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","callback")})),t}}class cT extends(XO(yA,vA)){constructor(e){super(e),this.element=new QS}ArrayElement(e){return e.forEach((e=>{const t=uj(e)?["document","objects","SecurityRequirement"]:["value"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}}let aT=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new EO,this.specPath=Wf(["document","objects","PathItem"])}ObjectElement(e){const t=jA.prototype.ObjectElement.call(this,e);return this.element.filter(WA).forEach(((e,t)=>{const r=Cj(t);r.content=oE(r).toUpperCase(),e.setMetaProperty("http-method",r)})),ij(this.element.$ref)&&this.element.classes.push("reference-element"),t}};let uT=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new AS,this.specPath=Wf(["document","objects","SecurityScheme"]),this.canSupportSpecificationExtensions=!0}},lT=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new bO,this.specPath=Wf(["document","objects","OAuthFlows"]),this.canSupportSpecificationExtensions=!0}},hT=class extends(XO(jA,vA)){constructor(e){super(e),this.element=new yO,this.specPath=Wf(["document","objects","OAuthFlow"]),this.canSupportSpecificationExtensions=!0}};class fT extends(XO(kA,vA)){constructor(e){super(e),this.element=new uA,this.specPath=Wf(["value"])}}class pT extends(XO(yA,vA)){constructor(e){super(e),this.element=new _S}ArrayElement(e){return e.forEach((e=>{const t=wA(e)?["document","objects","Tag"]:["value"],r=this.toRefractedElement(t,e);this.element.push(r)})),this.copyMetaAndAttributes(e,this.element),Aj}}const{fixedFields:dT}=yS.visitors.document.objects.JSONSchema,mT={visitors:{value:vA,document:{objects:{OpenApi:{$visitor:EA,fixedFields:{openapi:$A,info:{$ref:"#/visitors/document/objects/Info"},servers:RA,paths:{$ref:"#/visitors/document/objects/Paths"},components:{$ref:"#/visitors/document/objects/Components"},security:mP,tags:pT,externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"}}},Info:{$visitor:OA,fixedFields:{title:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},termsOfService:{$ref:"#/visitors/value"},contact:{$ref:"#/visitors/document/objects/Contact"},license:{$ref:"#/visitors/document/objects/License"},version:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("api-version"),this.element.classes.push("version"),t}}}},Contact:{$visitor:SA,fixedFields:{name:{$ref:"#/visitors/value"},url:{$ref:"#/visitors/value"},email:{$ref:"#/visitors/value"}}},License:{$visitor:AA,fixedFields:{name:{$ref:"#/visitors/value"},url:{$ref:"#/visitors/value"}}},Server:{$visitor:IA,fixedFields:{url:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("server-url"),t}},description:{$ref:"#/visitors/value"},variables:_A}},ServerVariable:{$visitor:DA,fixedFields:{enum:{$ref:"#/visitors/value"},default:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"}}},Components:{$visitor:vP,fixedFields:{schemas:CP,responses:MP,parameters:NP,examples:qP,requestBodies:BP,headers:LP,securitySchemes:UP,links:JP,callbacks:VP}},Paths:{$visitor:WP},PathItem:{$visitor:aT,fixedFields:{$ref:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("reference-value"),t}},summary:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},get:{$ref:"#/visitors/document/objects/Operation"},put:{$ref:"#/visitors/document/objects/Operation"},post:{$ref:"#/visitors/document/objects/Operation"},delete:{$ref:"#/visitors/document/objects/Operation"},options:{$ref:"#/visitors/document/objects/Operation"},head:{$ref:"#/visitors/document/objects/Operation"},patch:{$ref:"#/visitors/document/objects/Operation"},trace:{$ref:"#/visitors/document/objects/Operation"},servers:class extends RA{constructor(e){super(e),this.element=new HS}},parameters:class extends iT{constructor(e){super(e),this.element=new zS}}}},Operation:{$visitor:sT,fixedFields:{tags:class extends vA{constructor(e){super(e),this.element=new ZS}ArrayElement(e){return this.element=this.element.concat(Cj(e)),Aj}},summary:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"},operationId:{$ref:"#/visitors/value"},parameters:class extends iT{constructor(e){super(e),this.element=new XS}},requestBody:class extends MA{constructor(e){super(e),this.alternator=[{predicate:bA,specPath:["document","objects","Reference"]},{predicate:Ch,specPath:["document","objects","RequestBody"]}]}ObjectElement(e){const t=MA.prototype.enter.call(this,e);return QA(this.element)&&this.element.setMetaProperty("referenced-element","requestBody"),t}},responses:{$ref:"#/visitors/document/objects/Responses"},callbacks:oT,deprecated:{$ref:"#/visitors/value"},security:cT,servers:class extends RA{constructor(e){super(e),this.element=new eA}}}},ExternalDocumentation:{$visitor:HP,fixedFields:{description:{$ref:"#/visitors/value"},url:{$ref:"#/visitors/value"}}},Parameter:{$visitor:gP,fixedFields:{name:{$ref:"#/visitors/value"},in:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},required:{$ref:"#/visitors/value"},deprecated:{$ref:"#/visitors/value"},allowEmptyValue:{$ref:"#/visitors/value"},style:{$ref:"#/visitors/value"},explode:{$ref:"#/visitors/value"},allowReserved:{$ref:"#/visitors/value"},schema:wP,example:{$ref:"#/visitors/value"},examples:class extends fP{constructor(e){super(e),this.element=new WS}},content:class extends EP{constructor(e){super(e),this.element=new YS}}}},RequestBody:{$visitor:YP,fixedFields:{description:{$ref:"#/visitors/value"},content:class extends EP{constructor(e){super(e),this.element=new tA}},required:{$ref:"#/visitors/value"}}},MediaType:{$visitor:CA,fixedFields:{schema:hP,example:{$ref:"#/visitors/value"},examples:class extends fP{constructor(e){super(e),this.element=new rA}},encoding:pP}},Encoding:{$visitor:zP,fixedFields:{contentType:{$ref:"#/visitors/value"},headers:XP,style:{$ref:"#/visitors/value"},explode:{$ref:"#/visitors/value"},allowReserved:{$ref:"#/visitors/value"}}},Responses:{$visitor:rT,fixedFields:{default:nT}},Response:{$visitor:KP,fixedFields:{description:{$ref:"#/visitors/value"},headers:QP,content:class extends EP{constructor(e){super(e),this.element=new oA}},links:eT}},Callback:{$visitor:ZP},Example:{$visitor:GP,fixedFields:{summary:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},value:{$ref:"#/visitors/value"},externalValue:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("reference-value"),t}}}},Link:{$visitor:PA,fixedFields:{operationRef:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("reference-value"),t}},operationId:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("reference-value"),t}},parameters:FA,requestBody:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},server:{$ref:"#/visitors/document/objects/Server"}}},Header:{$visitor:xP,fixedFields:{description:{$ref:"#/visitors/value"},required:{$ref:"#/visitors/value"},deprecated:{$ref:"#/visitors/value"},allowEmptyValue:{$ref:"#/visitors/value"},style:{$ref:"#/visitors/value"},explode:{$ref:"#/visitors/value"},allowReserved:{$ref:"#/visitors/value"},schema:jP,example:{$ref:"#/visitors/value"},examples:class extends fP{constructor(e){super(e),this.element=new hA}},content:class extends EP{constructor(e){super(e),this.element=new fA}}}},Tag:{$visitor:yP,fixedFields:{name:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"}}},Reference:{$visitor:bP,fixedFields:{$ref:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("reference-value"),t}}}},JSONSchema:{$ref:"#/visitors/document/objects/Schema"},JSONReference:{$ref:"#/visitors/document/objects/Reference"},Schema:{$visitor:$P,fixedFields:{title:dT.title,multipleOf:dT.multipleOf,maximum:dT.maximum,exclusiveMaximum:dT.exclusiveMaximum,minimum:dT.minimum,exclusiveMinimum:dT.exclusiveMinimum,maxLength:dT.maxLength,minLength:dT.minLength,pattern:dT.pattern,maxItems:dT.maxItems,minItems:dT.minItems,uniqueItems:dT.uniqueItems,maxProperties:dT.maxProperties,minProperties:dT.minProperties,required:dT.required,enum:dT.enum,type:class extends kP{ArrayElement(e){return this.enter(e)}},allOf:class extends OP{ArrayElement(e){const t=OP.prototype.ArrayElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","schema")})),t}},anyOf:class extends SP{ArrayElement(e){const t=SP.prototype.ArrayElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","schema")})),t}},oneOf:class extends AP{ArrayElement(e){const t=AP.prototype.ArrayElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","schema")})),t}},not:IP,items:class extends PP{ObjectElement(e){const t=PP.prototype.ObjectElement.call(this,e);return QA(this.element)&&this.element.setMetaProperty("referenced-element","schema"),t}ArrayElement(e){return this.enter(e)}},properties:class extends TP{ObjectElement(e){const t=TP.prototype.ObjectElement.call(this,e);return this.element.filter(QA).forEach((e=>{e.setMetaProperty("referenced-element","schema")})),t}},additionalProperties:IP,description:dT.description,format:dT.format,default:dT.default,nullable:{$ref:"#/visitors/value"},discriminator:{$ref:"#/visitors/document/objects/Discriminator"},writeOnly:{$ref:"#/visitors/value"},xml:{$ref:"#/visitors/document/objects/XML"},externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"},example:{$ref:"#/visitors/value"},deprecated:{$ref:"#/visitors/value"}}},Discriminator:{$visitor:RP,fixedFields:{propertyName:{$ref:"#/visitors/value"},mapping:DP}},XML:{$visitor:_P,fixedFields:{name:{$ref:"#/visitors/value"},namespace:{$ref:"#/visitors/value"},prefix:{$ref:"#/visitors/value"},attribute:{$ref:"#/visitors/value"},wrapped:{$ref:"#/visitors/value"}}},SecurityScheme:{$visitor:uT,fixedFields:{type:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},name:{$ref:"#/visitors/value"},in:{$ref:"#/visitors/value"},scheme:{$ref:"#/visitors/value"},bearerFormat:{$ref:"#/visitors/value"},flows:{$ref:"#/visitors/document/objects/OAuthFlows"},openIdConnectUrl:{$ref:"#/visitors/value"}}},OAuthFlows:{$visitor:lT,fixedFields:{implicit:{$ref:"#/visitors/document/objects/OAuthFlow"},password:{$ref:"#/visitors/document/objects/OAuthFlow"},clientCredentials:{$ref:"#/visitors/document/objects/OAuthFlow"},authorizationCode:{$ref:"#/visitors/document/objects/OAuthFlow"}}},OAuthFlow:{$visitor:hT,fixedFields:{authorizationUrl:{$ref:"#/visitors/value"},tokenUrl:{$ref:"#/visitors/value"},refreshUrl:{$ref:"#/visitors/value"},scopes:fT}},SecurityRequirement:{$visitor:dP}},extension:{$visitor:class extends yA{MemberElement(e){return this.element=Cj(e),this.element.classes.push("specification-extension"),Aj}}}}}},vT=()=>{const e=$j(IS);return{predicates:{...lP,isElement:sj,isStringElement:ij,isArrayElement:lj,isObjectElement:uj,isMemberElement:hj,includesClasses:wj,hasElementSourceMap:gj},namespace:e}},yT=e=>(t,r={})=>((e,{specPath:t=["visitors","document","objects","OpenApi","$visitor"],plugins:r=[]}={})=>{const n=zx(e),s=uE(mT),i=new(pd(t,s))({specObj:s});return Gj(n,i),zj(i.element,r,{toolboxCreator:vT,visitorOptions:{keyMap:dA,nodeTypeGetter:pA}})})(t,{specPath:e,...r});iO.refract=yT(["visitors","document","objects","Callback","$visitor"]),oO.refract=yT(["visitors","document","objects","Components","$visitor"]),cO.refract=yT(["visitors","document","objects","Contact","$visitor"]),lO.refract=yT(["visitors","document","objects","Example","$visitor"]),aO.refract=yT(["visitors","document","objects","Discriminator","$visitor"]),uO.refract=yT(["visitors","document","objects","Encoding","$visitor"]),hO.refract=yT(["visitors","document","objects","ExternalDocumentation","$visitor"]),fO.refract=yT(["visitors","document","objects","Header","$visitor"]),pO.refract=yT(["visitors","document","objects","Info","$visitor"]),dO.refract=yT(["visitors","document","objects","License","$visitor"]),mO.refract=yT(["visitors","document","objects","Link","$visitor"]),vO.refract=yT(["visitors","document","objects","MediaType","$visitor"]),yO.refract=yT(["visitors","document","objects","OAuthFlow","$visitor"]),bO.refract=yT(["visitors","document","objects","OAuthFlows","$visitor"]),gO.refract=yT(["visitors","document","objects","OpenApi","fixedFields","openapi"]),wO.refract=yT(["visitors","document","objects","OpenApi","$visitor"]),xO.refract=yT(["visitors","document","objects","Operation","$visitor"]),jO.refract=yT(["visitors","document","objects","Parameter","$visitor"]),EO.refract=yT(["visitors","document","objects","PathItem","$visitor"]),$O.refract=yT(["visitors","document","objects","Paths","$visitor"]),OO.refract=yT(["visitors","document","objects","Reference","$visitor"]),SO.refract=yT(["visitors","document","objects","RequestBody","$visitor"]),AO.refract=yT(["visitors","document","objects","Response","$visitor"]),PO.refract=yT(["visitors","document","objects","Responses","$visitor"]),OS.refract=yT(["visitors","document","objects","Schema","$visitor"]),SS.refract=yT(["visitors","document","objects","SecurityRequirement","$visitor"]),AS.refract=yT(["visitors","document","objects","SecurityScheme","$visitor"]),PS.refract=yT(["visitors","document","objects","Server","$visitor"]),TS.refract=yT(["visitors","document","objects","ServerVariable","$visitor"]),kS.refract=yT(["visitors","document","objects","Tag","$visitor"]),FS.refract=yT(["visitors","document","objects","XML","$visitor"]);class bT extends iO{}class gT extends oO{get pathItems(){return this.get("pathItems")}set pathItems(e){this.set("pathItems",e)}}class wT extends cO{}class xT extends aO{}class jT extends uO{}class ET extends lO{}class $T extends hO{}class OT extends fO{get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}}class ST extends pO{get license(){return this.get("license")}set license(e){this.set("license",e)}get summary(){return this.get("summary")}set summary(e){this.set("summary",e)}}class AT extends Nx{static default=new AT("https://spec.openapis.org/oas/3.1/dialect/base");constructor(e,t,r){super(e,t,r),this.element="jsonSchemaDialect"}}class PT extends dO{get identifier(){return this.get("identifier")}set identifier(e){this.set("identifier",e)}}class TT extends mO{}class kT extends vO{get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}}class FT extends yO{}class IT extends bO{}class RT extends gO{}class DT extends Jx{constructor(e,t,r){super(e,t,r),this.element="openApi3_1",this.classes.push("api")}get openapi(){return this.get("openapi")}set openapi(e){this.set("openapi",e)}get info(){return this.get("info")}set info(e){this.set("info",e)}get jsonSchemaDialect(){return this.get("jsonSchemaDialect")}set jsonSchemaDialect(e){this.set("jsonSchemaDialect",e)}get servers(){return this.get("servers")}set servers(e){this.set("servers",e)}get paths(){return this.get("paths")}set paths(e){this.set("paths",e)}get components(){return this.get("components")}set components(e){this.set("components",e)}get security(){return this.get("security")}set security(e){this.set("security",e)}get tags(){return this.get("tags")}set tags(e){this.set("tags",e)}get externalDocs(){return this.get("externalDocs")}set externalDocs(e){this.set("externalDocs",e)}get webhooks(){return this.get("webhooks")}set webhooks(e){this.set("webhooks",e)}}class _T extends xO{get requestBody(){return this.get("requestBody")}set requestBody(e){this.set("requestBody",e)}}class CT extends jO{get schema(){return this.get("schema")}set schema(e){this.set("schema",e)}}class MT extends EO{get GET(){return this.get("get")}set GET(e){this.set("GET",e)}get PUT(){return this.get("put")}set PUT(e){this.set("PUT",e)}get POST(){return this.get("post")}set POST(e){this.set("POST",e)}get DELETE(){return this.get("delete")}set DELETE(e){this.set("DELETE",e)}get OPTIONS(){return this.get("options")}set OPTIONS(e){this.set("OPTIONS",e)}get HEAD(){return this.get("head")}set HEAD(e){this.set("HEAD",e)}get PATCH(){return this.get("patch")}set PATCH(e){this.set("PATCH",e)}get TRACE(){return this.get("trace")}set TRACE(e){this.set("TRACE",e)}}class NT extends $O{}class qT extends OO{}Object.defineProperty(qT.prototype,"description",{get(){return this.get("description")},set(e){this.set("description",e)},enumerable:!0}),Object.defineProperty(qT.prototype,"summary",{get(){return this.get("summary")},set(e){this.set("summary",e)},enumerable:!0});class BT extends SO{}let LT=class extends AO{};class UT extends PO{}class JT extends Jx{constructor(e,t,r){super(e,t,r),this.element="schema"}get $schema(){return this.get("$schema")}set $schema(e){this.set("$schema",e)}get $vocabulary(){return this.get("$vocabulary")}set $vocabulary(e){this.set("$vocabulary",e)}get $id(){return this.get("$id")}set $id(e){this.set("$id",e)}get $anchor(){return this.get("$anchor")}set $anchor(e){this.set("$anchor",e)}get $dynamicAnchor(){return this.get("$dynamicAnchor")}set $dynamicAnchor(e){this.set("$dynamicAnchor",e)}get $dynamicRef(){return this.get("$dynamicRef")}set $dynamicRef(e){this.set("$dynamicRef",e)}get $ref(){return this.get("$ref")}set $ref(e){this.set("$ref",e)}get $defs(){return this.get("$defs")}set $defs(e){this.set("$defs",e)}get $comment(){return this.get("$comment")}set $comment(e){this.set("$comment",e)}get allOf(){return this.get("allOf")}set allOf(e){this.set("allOf",e)}get anyOf(){return this.get("anyOf")}set anyOf(e){this.set("anyOf",e)}get oneOf(){return this.get("oneOf")}set oneOf(e){this.set("oneOf",e)}get not(){return this.get("not")}set not(e){this.set("not",e)}get if(){return this.get("if")}set if(e){this.set("if",e)}get then(){return this.get("then")}set then(e){this.set("then",e)}get else(){return this.get("else")}set else(e){this.set("else",e)}get dependentSchemas(){return this.get("dependentSchemas")}set dependentSchemas(e){this.set("dependentSchemas",e)}get prefixItems(){return this.get("prefixItems")}set prefixItems(e){this.set("prefixItems",e)}get items(){return this.get("items")}set items(e){this.set("items",e)}get containsProp(){return this.get("contains")}set containsProp(e){this.set("contains",e)}get properties(){return this.get("properties")}set properties(e){this.set("properties",e)}get patternProperties(){return this.get("patternProperties")}set patternProperties(e){this.set("patternProperties",e)}get additionalProperties(){return this.get("additionalProperties")}set additionalProperties(e){this.set("additionalProperties",e)}get propertyNames(){return this.get("propertyNames")}set propertyNames(e){this.set("propertyNames",e)}get unevaluatedItems(){return this.get("unevaluatedItems")}set unevaluatedItems(e){this.set("unevaluatedItems",e)}get unevaluatedProperties(){return this.get("unevaluatedProperties")}set unevaluatedProperties(e){this.set("unevaluatedProperties",e)}get type(){return this.get("type")}set type(e){this.set("type",e)}get enum(){return this.get("enum")}set enum(e){this.set("enum",e)}get const(){return this.get("const")}set const(e){this.set("const",e)}get multipleOf(){return this.get("multipleOf")}set multipleOf(e){this.set("multipleOf",e)}get maximum(){return this.get("maximum")}set maximum(e){this.set("maximum",e)}get exclusiveMaximum(){return this.get("exclusiveMaximum")}set exclusiveMaximum(e){this.set("exclusiveMaximum",e)}get minimum(){return this.get("minimum")}set minimum(e){this.set("minimum",e)}get exclusiveMinimum(){return this.get("exclusiveMinimum")}set exclusiveMinimum(e){this.set("exclusiveMinimum",e)}get maxLength(){return this.get("maxLength")}set maxLength(e){this.set("maxLength",e)}get minLength(){return this.get("minLength")}set minLength(e){this.set("minLength",e)}get pattern(){return this.get("pattern")}set pattern(e){this.set("pattern",e)}get maxItems(){return this.get("maxItems")}set maxItems(e){this.set("maxItems",e)}get minItems(){return this.get("minItems")}set minItems(e){this.set("minItems",e)}get uniqueItems(){return this.get("uniqueItems")}set uniqueItems(e){this.set("uniqueItems",e)}get maxContains(){return this.get("maxContains")}set maxContains(e){this.set("maxContains",e)}get minContains(){return this.get("minContains")}set minContains(e){this.set("minContains",e)}get maxProperties(){return this.get("maxProperties")}set maxProperties(e){this.set("maxProperties",e)}get minProperties(){return this.get("minProperties")}set minProperties(e){this.set("minProperties",e)}get required(){return this.get("required")}set required(e){this.set("required",e)}get dependentRequired(){return this.get("dependentRequired")}set dependentRequired(e){this.set("dependentRequired",e)}get title(){return this.get("title")}set title(e){this.set("title",e)}get description(){return this.get("description")}set description(e){this.set("description",e)}get default(){return this.get("default")}set default(e){this.set("default",e)}get deprecated(){return this.get("deprecated")}set deprecated(e){this.set("deprecated",e)}get readOnly(){return this.get("readOnly")}set readOnly(e){this.set("readOnly",e)}get writeOnly(){return this.get("writeOnly")}set writeOnly(e){this.set("writeOnly",e)}get examples(){return this.get("examples")}set examples(e){this.set("examples",e)}get format(){return this.get("format")}set format(e){this.set("format",e)}get contentEncoding(){return this.get("contentEncoding")}set contentEncoding(e){this.set("contentEncoding",e)}get contentMediaType(){return this.get("contentMediaType")}set contentMediaType(e){this.set("contentMediaType",e)}get contentSchema(){return this.get("contentSchema")}set contentSchema(e){this.set("contentSchema",e)}get discriminator(){return this.get("discriminator")}set discriminator(e){this.set("discriminator",e)}get xml(){return this.get("xml")}set xml(e){this.set("xml",e)}get externalDocs(){return this.get("externalDocs")}set externalDocs(e){this.set("externalDocs",e)}get example(){return this.get("example")}set example(e){this.set("example",e)}}class VT extends SS{}class GT extends AS{}class HT extends PS{}class zT extends TS{}class XT extends kS{}class WT extends FS{}const YT={namespace:e=>{const{base:t}=e;return t.register("callback",bT),t.register("components",gT),t.register("contact",wT),t.register("discriminator",xT),t.register("encoding",jT),t.register("example",ET),t.register("externalDocumentation",$T),t.register("header",OT),t.register("info",ST),t.register("jsonSchemaDialect",AT),t.register("license",PT),t.register("link",TT),t.register("mediaType",kT),t.register("oAuthFlow",FT),t.register("oAuthFlows",IT),t.register("openapi",RT),t.register("openApi3_1",DT),t.register("operation",_T),t.register("parameter",CT),t.register("pathItem",MT),t.register("paths",NT),t.register("reference",qT),t.register("requestBody",BT),t.register("response",LT),t.register("responses",UT),t.register("schema",JT),t.register("securityRequirement",VT),t.register("securityScheme",GT),t.register("server",HT),t.register("serverVariable",zT),t.register("tag",XT),t.register("xml",WT),t}};class ZT extends Jx{static primaryClass="components-path-items";constructor(e,t,r){super(e,t,r),this.classes.push(ZT.primaryClass)}}class KT extends Jx{static primaryClass="webhooks";constructor(e,t,r){super(e,t,r),this.classes.push(KT.primaryClass)}}const QT=e=>{if(sj(e))return`${e.element.charAt(0).toUpperCase()+e.element.slice(1)}Element`},ek={CallbackElement:["content"],ComponentsElement:["content"],ContactElement:["content"],DiscriminatorElement:["content"],Encoding:["content"],Example:["content"],ExternalDocumentationElement:["content"],HeaderElement:["content"],InfoElement:["content"],LicenseElement:["content"],MediaTypeElement:["content"],OAuthFlowElement:["content"],OAuthFlowsElement:["content"],OpenApi3_1Element:["content"],OperationElement:["content"],ParameterElement:["content"],PathItemElement:["content"],PathsElement:["content"],ReferenceElement:["content"],RequestBodyElement:["content"],ResponseElement:["content"],ResponsesElement:["content"],SchemaElement:["content"],SecurityRequirementElement:["content"],SecuritySchemeElement:["content"],ServerElement:["content"],ServerVariableElement:["content"],TagElement:["content"],...Jj};class tk{internalStore;constructor(e,t,r){this.storageElement=e,this.storageField=t,this.storageSubField=r}get store(){if(!this.internalStore){let e=this.storageElement.get(this.storageField);uj(e)||(e=new Jx,this.storageElement.set(this.storageField,e));let t=e.get(this.storageSubField);lj(t)||(t=new Ux,e.set(this.storageSubField,t)),this.internalStore=t}return this.internalStore}append(e){this.includes(e)||this.store.push(e)}includes(e){return this.store.includes(e)}}const rk=({storageField:e="x-normalized"}={})=>t=>{const{predicates:r,ancestorLineageToJSONPointer:n}=t,s=(e,t)=>!!r.isParameterElement(e)&&(!!r.isParameterElement(t)&&(!!r.isStringElement(e.name)&&(!!r.isStringElement(e.in)&&(!!r.isStringElement(t.name)&&(!!r.isStringElement(t.in)&&(oE(e.name)===oE(t.name)&&oE(e.in)===oE(t.in))))))),i=[];let o;return{visitor:{OpenApi3_1Element:{enter(t){o=new tk(t,e,"parameters")},leave(){o=void 0}},PathItemElement:{enter(e,t,n,s,o){if(o.some(r.isComponentsElement))return;const{parameters:c}=e;r.isArrayElement(c)?i.push([...c.content]):i.push([])},leave(){i.pop()}},OperationElement:{leave(e,t,r,c,a){const u=Np(i);if(!Array.isArray(u)||0===u.length)return;const l=n([...a,r,e]);if(o.includes(l))return;const h=dd([],["parameters","content"],e),f=Td(s,[...h,...u]);e.parameters=new XS(f),o.append(l)}}}}},nk=({storageField:e="x-normalized"}={})=>t=>{const{predicates:r,ancestorLineageToJSONPointer:n}=t;let s,i;return{visitor:{OpenApi3_1Element:{enter(t){i=new tk(t,e,"security-requirements"),r.isArrayElement(t.security)&&(s=t.security)},leave(){i=void 0,s=void 0}},OperationElement:{leave(e,t,o,c,a){if(a.some(r.isComponentsElement))return;const u=n([...a,o,e]);if(i.includes(u))return;var l;void 0===e.security&&void 0!==s&&(e.security=new QS(null===(l=s)||void 0===l?void 0:l.content),i.append(u))}}}}},sk=e=>e.replace(/\s/g,""),ik=e=>e.replace(/\W/gi,"_"),ok=(e,t,r)=>{const n=sk(e);return n.length>0?ik(n):((e,t)=>`${ik(sk(t.toLowerCase()))}${ik(sk(e))}`)(t,r)},ck=({storageField:e="x-normalized",operationIdNormalizer:t=ok}={})=>r=>{const{predicates:n,ancestorLineageToJSONPointer:s,namespace:i}=r,o=[],c=[],a=[];let u;return{visitor:{OpenApi3_1Element:{enter(t){u=new tk(t,e,"operation-ids")},leave(){const e=Hp((e=>oE(e.operationId)),c);Object.entries(e).forEach((([e,t])=>{Array.isArray(t)&&(t.length<=1||t.forEach(((t,r)=>{const n=`${e}${r+1}`;t.operationId=new i.elements.String(n)})))})),a.forEach((e=>{if(void 0===e.operationId)return;const t=String(oE(e.operationId)),r=c.find((e=>oE(e.meta.get("originalOperationId"))===t));void 0!==r&&(e.operationId=Cj.safe(r.operationId),e.meta.set("originalOperationId",t),e.set("__originalOperationId",t))})),c.length=0,a.length=0,u=void 0}},PathItemElement:{enter(e){const t=Ap("path",oE(e.meta.get("path")));o.push(t)},leave(){o.pop()}},OperationElement:{enter(e,r,n,a,l){if(void 0===e.operationId)return;const h=s([...l,n,e]);if(u.includes(h))return;const f=String(oE(e.operationId)),p=Np(o),d=Ap("method",oE(e.meta.get("http-method"))),m=t(f,p,d);f!==m&&(e.operationId=new i.elements.String(m),e.set("__originalOperationId",f),e.meta.set("originalOperationId",f),c.push(e),u.append(h))}},LinkElement:{leave(e){n.isLinkElement(e)&&void 0!==e.operationId&&a.push(e)}}}}},ak=({storageField:e="x-normalized"}={})=>t=>{const{predicates:r,ancestorLineageToJSONPointer:n}=t;let s;return{visitor:{OpenApi3_1Element:{enter(t){s=new tk(t,e,"parameter-examples")},leave(){s=void 0}},ParameterElement:{leave(e,t,i,o,c){var a,u;if(c.some(r.isComponentsElement))return;if(void 0===e.schema||!r.isSchemaElement(e.schema))return;if(void 0===(null===(a=e.schema)||void 0===a?void 0:a.example)&&void 0===(null===(u=e.schema)||void 0===u?void 0:u.examples))return;const l=n([...c,i,e]);if(!s.includes(l)){if(void 0!==e.examples&&r.isObjectElement(e.examples)){const t=e.examples.map((e=>Cj.safe(e.value)));return void 0!==e.schema.examples&&(e.schema.set("examples",t),s.append(l)),void(void 0!==e.schema.example&&(e.schema.set("example",t[0]),s.append(l)))}void 0!==e.example&&(void 0!==e.schema.examples&&(e.schema.set("examples",[Cj(e.example)]),s.append(l)),void 0!==e.schema.example&&(e.schema.set("example",Cj(e.example)),s.append(l)))}}}}}},uk=({storageField:e="x-normalized"}={})=>t=>{const{predicates:r,ancestorLineageToJSONPointer:n}=t;let s;return{visitor:{OpenApi3_1Element:{enter(t){s=new tk(t,e,"header-examples")},leave(){s=void 0}},HeaderElement:{leave(e,t,i,o,c){var a,u;if(c.some(r.isComponentsElement))return;if(void 0===e.schema||!r.isSchemaElement(e.schema))return;if(void 0===(null===(a=e.schema)||void 0===a?void 0:a.example)&&void 0===(null===(u=e.schema)||void 0===u?void 0:u.examples))return;const l=n([...c,i,e]);if(!s.includes(l)){if(void 0!==e.examples&&r.isObjectElement(e.examples)){const t=e.examples.map((e=>Cj.safe(e.value)));return void 0!==e.schema.examples&&(e.schema.set("examples",t),s.append(l)),void(void 0!==e.schema.example&&(e.schema.set("example",t[0]),s.append(l)))}void 0!==e.example&&(void 0!==e.schema.examples&&(e.schema.set("examples",[Cj(e.example)]),s.append(l)),void 0!==e.schema.example&&(e.schema.set("example",Cj(e.example)),s.append(l)))}}}}}},lk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof bT||e(n)&&t("callback",n)&&r("object",n))),hk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof gT||e(n)&&t("components",n)&&r("object",n))),fk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof wT||e(n)&&t("contact",n)&&r("object",n))),pk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof ET||e(n)&&t("example",n)&&r("object",n))),dk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof $T||e(n)&&t("externalDocumentation",n)&&r("object",n))),mk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof OT||e(n)&&t("header",n)&&r("object",n))),vk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof ST||e(n)&&t("info",n)&&r("object",n))),yk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof AT||e(n)&&t("jsonSchemaDialect",n)&&r("string",n))),bk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof PT||e(n)&&t("license",n)&&r("object",n))),gk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof TT||e(n)&&t("link",n)&&r("object",n))),wk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof RT||e(n)&&t("openapi",n)&&r("string",n))),xk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r,hasClass:n})=>s=>s instanceof DT||e(s)&&t("openApi3_1",s)&&r("object",s)&&n("api",s))),jk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof _T||e(n)&&t("operation",n)&&r("object",n))),Ek=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof CT||e(n)&&t("parameter",n)&&r("object",n))),$k=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof MT||e(n)&&t("pathItem",n)&&r("object",n))),Ok=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof NT||e(n)&&t("paths",n)&&r("object",n))),Sk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof qT||e(n)&&t("reference",n)&&r("object",n))),Ak=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof BT||e(n)&&t("requestBody",n)&&r("object",n))),Pk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof LT||e(n)&&t("response",n)&&r("object",n))),Tk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof UT||e(n)&&t("responses",n)&&r("object",n))),kk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof JT||e(n)&&t("schema",n)&&r("object",n))),Fk=e=>aj(e)&&e.classes.includes("boolean-json-schema"),Ik=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof VT||e(n)&&t("securityRequirement",n)&&r("object",n))),Rk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof GT||e(n)&&t("securityScheme",n)&&r("object",n))),Dk=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof HT||e(n)&&t("server",n)&&r("object",n))),_k=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof zT||e(n)&&t("serverVariable",n)&&r("object",n))),Ck=nj((({hasBasicElementProps:e,isElementType:t,primitiveEq:r})=>n=>n instanceof kT||e(n)&&t("mediaType",n)&&r("object",n))),Mk=Object.freeze(Object.defineProperty({__proto__:null,isBooleanJsonSchemaElement:Fk,isCallbackElement:lk,isComponentsElement:hk,isContactElement:fk,isExampleElement:pk,isExternalDocumentationElement:dk,isHeaderElement:mk,isInfoElement:vk,isJsonSchemaDialectElement:yk,isLicenseElement:bk,isLinkElement:gk,isMediaTypeElement:Ck,isOpenApi3_1Element:xk,isOpenapiElement:wk,isOperationElement:jk,isParameterElement:Ek,isPathItemElement:$k,isPathItemElementExternal:e=>{if(!$k(e))return!1;if(!ij(e.$ref))return!1;const t=oE(e.$ref);return"string"==typeof t&&t.length>0&&!t.startsWith("#")},isPathsElement:Ok,isReferenceElement:Sk,isReferenceElementExternal:e=>{if(!Sk(e))return!1;if(!ij(e.$ref))return!1;const t=oE(e.$ref);return"string"==typeof t&&t.length>0&&!t.startsWith("#")},isRequestBodyElement:Ak,isResponseElement:Pk,isResponsesElement:Tk,isSchemaElement:kk,isSecurityRequirementElement:Ik,isSecuritySchemeElement:Rk,isServerElement:Dk,isServerVariableElement:_k},Symbol.toStringTag,{value:"Module"})),Nk=e=>{const t=e.reduce(((t,r,n)=>{if(hj(r)){const e=String(oE(r.key));t.push(e)}else if(lj(e[n-2])){const s=String(e[n-2].content.indexOf(r));t.push(s)}return t}),[]);return tO(t)},qk=()=>{const e=$j(YT);return{predicates:{...Mk,isElement:sj,isStringElement:ij,isArrayElement:lj,isObjectElement:uj,isMemberElement:hj,isServersElement:uP,includesClasses:wj,hasElementSourceMap:gj},ancestorLineageToJSONPointer:Nk,namespace:e}};class Bk extends(XO(jA,vA)){constructor(e){super(e),this.element=new DT,this.specPath=Wf(["document","objects","OpenApi"]),this.canSupportSpecificationExtensions=!0,this.openApiSemanticElement=this.element}ObjectElement(e){return this.openApiGenericElement=e,jA.prototype.ObjectElement.call(this,e)}}const{visitors:{document:{objects:{Info:{$visitor:Lk}}}}}=mT;const{visitors:{document:{objects:{Contact:{$visitor:Uk}}}}}=mT;const{visitors:{document:{objects:{License:{$visitor:Jk}}}}}=mT;const{visitors:{document:{objects:{Link:{$visitor:Vk}}}}}=mT;class Gk extends(XO(yA,vA)){StringElement(e){const t=new AT(oE(e));return this.copyMetaAndAttributes(e,t),this.element=t,Aj}}const{visitors:{document:{objects:{Server:{$visitor:Hk}}}}}=mT;const{visitors:{document:{objects:{ServerVariable:{$visitor:zk}}}}}=mT;const{visitors:{document:{objects:{MediaType:{$visitor:Xk}}}}}=mT;const{visitors:{document:{objects:{SecurityRequirement:{$visitor:Wk}}}}}=mT;const{visitors:{document:{objects:{Components:{$visitor:Yk}}}}}=mT;const{visitors:{document:{objects:{Tag:{$visitor:Zk}}}}}=mT;const{visitors:{document:{objects:{Reference:{$visitor:Kk}}}}}=mT;const{visitors:{document:{objects:{Parameter:{$visitor:Qk}}}}}=mT;const{visitors:{document:{objects:{Header:{$visitor:eF}}}}}=mT;class tF{parent;constructor({parent:e}){this.parent=e}}class rF extends(XO(jA,tF,vA)){constructor(e){super(e),this.element=new JT,this.specPath=Wf(["document","objects","Schema"]),this.canSupportSpecificationExtensions=!0,this.jsonSchemaDefaultDialect=AT.default,this.passingOptionsNames.push("parent")}ObjectElement(e){this.handle$schema(e),this.handle$id(e),this.parent=this.element;const t=jA.prototype.ObjectElement.call(this,e);return ij(this.element.$ref)&&(this.element.classes.push("reference-element"),this.element.setMetaProperty("referenced-element","schema")),t}BooleanElement(e){const t=super.enter(e);return this.element.classes.push("boolean-json-schema"),t}getJsonSchemaDialect(){let e;return e=void 0!==this.openApiSemanticElement&&yk(this.openApiSemanticElement.jsonSchemaDialect)?oE(this.openApiSemanticElement.jsonSchemaDialect):void 0!==this.openApiGenericElement&&ij(this.openApiGenericElement.get("jsonSchemaDialect"))?oE(this.openApiGenericElement.get("jsonSchemaDialect")):oE(this.jsonSchemaDefaultDialect),e}handle$schema(e){if(Id(this.parent)&&!ij(e.get("$schema")))this.element.setMetaProperty("inherited$schema",this.getJsonSchemaDialect());else if(kk(this.parent)&&!ij(e.get("$schema"))){const e=Ap(oE(this.parent.meta.get("inherited$schema")),oE(this.parent.$schema));this.element.setMetaProperty("inherited$schema",e)}}handle$id(e){const t=void 0!==this.parent?Cj(this.parent.getMetaProperty("inherited$id",[])):new Ux,r=oE(e.get("$id"));Xd(r)&&t.push(r),this.element.setMetaProperty("inherited$id",t)}}class nF extends(XO(kA,tF,vA)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-$defs"),this.specPath=Wf(["document","objects","Schema"]),this.passingOptionsNames.push("parent")}}let sF=class extends(XO(yA,tF,vA)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-allOf"),this.passingOptionsNames.push("parent")}ArrayElement(e){return e.forEach((e=>{if(uj(e)){const t=this.toRefractedElement(["document","objects","Schema"],e);this.element.push(t)}else{const t=Cj(e);this.element.push(t)}})),this.copyMetaAndAttributes(e,this.element),Aj}};class iF extends(XO(yA,tF,vA)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-anyOf"),this.passingOptionsNames.push("parent")}ArrayElement(e){return e.forEach((e=>{if(uj(e)){const t=this.toRefractedElement(["document","objects","Schema"],e);this.element.push(t)}else{const t=Cj(e);this.element.push(t)}})),this.copyMetaAndAttributes(e,this.element),Aj}}class oF extends(XO(yA,tF,vA)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-oneOf"),this.passingOptionsNames.push("parent")}ArrayElement(e){return e.forEach((e=>{if(uj(e)){const t=this.toRefractedElement(["document","objects","Schema"],e);this.element.push(t)}else{const t=Cj(e);this.element.push(t)}})),this.copyMetaAndAttributes(e,this.element),Aj}}class cF extends(XO(kA,tF,vA)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-dependentSchemas"),this.specPath=Wf(["document","objects","Schema"]),this.passingOptionsNames.push("parent")}}class aF extends(XO(yA,tF,vA)){constructor(e){super(e),this.element=new Ux,this.element.classes.push("json-schema-prefixItems"),this.passingOptionsNames.push("parent")}ArrayElement(e){return e.forEach((e=>{if(uj(e)){const t=this.toRefractedElement(["document","objects","Schema"],e);this.element.push(t)}else{const t=Cj(e);this.element.push(t)}})),this.copyMetaAndAttributes(e,this.element),Aj}}class uF extends(XO(kA,tF,vA)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-properties"),this.specPath=Wf(["document","objects","Schema"]),this.passingOptionsNames.push("parent")}}class lF extends(XO(kA,tF,vA)){constructor(e){super(e),this.element=new Jx,this.element.classes.push("json-schema-patternProperties"),this.specPath=Wf(["document","objects","Schema"]),this.passingOptionsNames.push("parent")}}const{visitors:{document:{objects:{Discriminator:{$visitor:hF}}}}}=mT;const{visitors:{document:{objects:{XML:{$visitor:fF}}}}}=mT;class pF extends(XO(kA,vA)){constructor(e){super(e),this.element=new MS,this.specPath=Wf(["document","objects","Schema"])}}class dF extends(XO(kA,vA)){constructor(e){super(e),this.element=new ZT,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","PathItem"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(Sk).forEach((e=>{e.setMetaProperty("referenced-element","pathItem")})),t}}const{visitors:{document:{objects:{Example:{$visitor:mF}}}}}=mT;const{visitors:{document:{objects:{ExternalDocumentation:{$visitor:vF}}}}}=mT;const{visitors:{document:{objects:{Encoding:{$visitor:yF}}}}}=mT;const{visitors:{document:{objects:{Paths:{$visitor:bF}}}}}=mT;const{visitors:{document:{objects:{RequestBody:{$visitor:gF}}}}}=mT;const{visitors:{document:{objects:{Callback:{$visitor:wF}}}}}=mT;const{visitors:{document:{objects:{Response:{$visitor:xF}}}}}=mT;const{visitors:{document:{objects:{Responses:{$visitor:jF}}}}}=mT;const{visitors:{document:{objects:{Operation:{$visitor:EF}}}}}=mT;const{visitors:{document:{objects:{PathItem:{$visitor:$F}}}}}=mT;const{visitors:{document:{objects:{SecurityScheme:{$visitor:OF}}}}}=mT;const{visitors:{document:{objects:{OAuthFlows:{$visitor:SF}}}}}=mT;const{visitors:{document:{objects:{OAuthFlow:{$visitor:AF}}}}}=mT;class PF extends(XO(kA,vA)){constructor(e){super(e),this.element=new KT,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","PathItem"]}ObjectElement(e){const t=kA.prototype.ObjectElement.call(this,e);return this.element.filter(Sk).forEach((e=>{e.setMetaProperty("referenced-element","pathItem")})),this.element.filter($k).forEach(((e,t)=>{e.setMetaProperty("webhook-name",oE(t))})),t}}const TF={visitors:{value:mT.visitors.value,document:{objects:{OpenApi:{$visitor:Bk,fixedFields:{openapi:mT.visitors.document.objects.OpenApi.fixedFields.openapi,info:{$ref:"#/visitors/document/objects/Info"},jsonSchemaDialect:Gk,servers:mT.visitors.document.objects.OpenApi.fixedFields.servers,paths:{$ref:"#/visitors/document/objects/Paths"},webhooks:PF,components:{$ref:"#/visitors/document/objects/Components"},security:mT.visitors.document.objects.OpenApi.fixedFields.security,tags:mT.visitors.document.objects.OpenApi.fixedFields.tags,externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"}}},Info:{$visitor:class extends Lk{constructor(e){super(e),this.element=new ST}},fixedFields:{title:mT.visitors.document.objects.Info.fixedFields.title,description:mT.visitors.document.objects.Info.fixedFields.description,summary:{$ref:"#/visitors/value"},termsOfService:mT.visitors.document.objects.Info.fixedFields.termsOfService,contact:{$ref:"#/visitors/document/objects/Contact"},license:{$ref:"#/visitors/document/objects/License"},version:mT.visitors.document.objects.Info.fixedFields.version}},Contact:{$visitor:class extends Uk{constructor(e){super(e),this.element=new wT}},fixedFields:{name:mT.visitors.document.objects.Contact.fixedFields.name,url:mT.visitors.document.objects.Contact.fixedFields.url,email:mT.visitors.document.objects.Contact.fixedFields.email}},License:{$visitor:class extends Jk{constructor(e){super(e),this.element=new PT}},fixedFields:{name:mT.visitors.document.objects.License.fixedFields.name,identifier:{$ref:"#/visitors/value"},url:mT.visitors.document.objects.License.fixedFields.url}},Server:{$visitor:class extends Hk{constructor(e){super(e),this.element=new HT}},fixedFields:{url:mT.visitors.document.objects.Server.fixedFields.url,description:mT.visitors.document.objects.Server.fixedFields.description,variables:mT.visitors.document.objects.Server.fixedFields.variables}},ServerVariable:{$visitor:class extends zk{constructor(e){super(e),this.element=new zT}},fixedFields:{enum:mT.visitors.document.objects.ServerVariable.fixedFields.enum,default:mT.visitors.document.objects.ServerVariable.fixedFields.default,description:mT.visitors.document.objects.ServerVariable.fixedFields.description}},Components:{$visitor:class extends Yk{constructor(e){super(e),this.element=new gT}},fixedFields:{schemas:pF,responses:mT.visitors.document.objects.Components.fixedFields.responses,parameters:mT.visitors.document.objects.Components.fixedFields.parameters,examples:mT.visitors.document.objects.Components.fixedFields.examples,requestBodies:mT.visitors.document.objects.Components.fixedFields.requestBodies,headers:mT.visitors.document.objects.Components.fixedFields.headers,securitySchemes:mT.visitors.document.objects.Components.fixedFields.securitySchemes,links:mT.visitors.document.objects.Components.fixedFields.links,callbacks:mT.visitors.document.objects.Components.fixedFields.callbacks,pathItems:dF}},Paths:{$visitor:class extends bF{constructor(e){super(e),this.element=new NT}}},PathItem:{$visitor:class extends $F{constructor(e){super(e),this.element=new MT}},fixedFields:{$ref:mT.visitors.document.objects.PathItem.fixedFields.$ref,summary:mT.visitors.document.objects.PathItem.fixedFields.summary,description:mT.visitors.document.objects.PathItem.fixedFields.description,get:{$ref:"#/visitors/document/objects/Operation"},put:{$ref:"#/visitors/document/objects/Operation"},post:{$ref:"#/visitors/document/objects/Operation"},delete:{$ref:"#/visitors/document/objects/Operation"},options:{$ref:"#/visitors/document/objects/Operation"},head:{$ref:"#/visitors/document/objects/Operation"},patch:{$ref:"#/visitors/document/objects/Operation"},trace:{$ref:"#/visitors/document/objects/Operation"},servers:mT.visitors.document.objects.PathItem.fixedFields.servers,parameters:mT.visitors.document.objects.PathItem.fixedFields.parameters}},Operation:{$visitor:class extends EF{constructor(e){super(e),this.element=new _T}},fixedFields:{tags:mT.visitors.document.objects.Operation.fixedFields.tags,summary:mT.visitors.document.objects.Operation.fixedFields.summary,description:mT.visitors.document.objects.Operation.fixedFields.description,externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"},operationId:mT.visitors.document.objects.Operation.fixedFields.operationId,parameters:mT.visitors.document.objects.Operation.fixedFields.parameters,requestBody:mT.visitors.document.objects.Operation.fixedFields.requestBody,responses:{$ref:"#/visitors/document/objects/Responses"},callbacks:mT.visitors.document.objects.Operation.fixedFields.callbacks,deprecated:mT.visitors.document.objects.Operation.fixedFields.deprecated,security:mT.visitors.document.objects.Operation.fixedFields.security,servers:mT.visitors.document.objects.Operation.fixedFields.servers}},ExternalDocumentation:{$visitor:class extends vF{constructor(e){super(e),this.element=new $T}},fixedFields:{description:mT.visitors.document.objects.ExternalDocumentation.fixedFields.description,url:mT.visitors.document.objects.ExternalDocumentation.fixedFields.url}},Parameter:{$visitor:class extends Qk{constructor(e){super(e),this.element=new CT}},fixedFields:{name:mT.visitors.document.objects.Parameter.fixedFields.name,in:mT.visitors.document.objects.Parameter.fixedFields.in,description:mT.visitors.document.objects.Parameter.fixedFields.description,required:mT.visitors.document.objects.Parameter.fixedFields.required,deprecated:mT.visitors.document.objects.Parameter.fixedFields.deprecated,allowEmptyValue:mT.visitors.document.objects.Parameter.fixedFields.allowEmptyValue,style:mT.visitors.document.objects.Parameter.fixedFields.style,explode:mT.visitors.document.objects.Parameter.fixedFields.explode,allowReserved:mT.visitors.document.objects.Parameter.fixedFields.allowReserved,schema:{$ref:"#/visitors/document/objects/Schema"},example:mT.visitors.document.objects.Parameter.fixedFields.example,examples:mT.visitors.document.objects.Parameter.fixedFields.examples,content:mT.visitors.document.objects.Parameter.fixedFields.content}},RequestBody:{$visitor:class extends gF{constructor(e){super(e),this.element=new BT}},fixedFields:{description:mT.visitors.document.objects.RequestBody.fixedFields.description,content:mT.visitors.document.objects.RequestBody.fixedFields.content,required:mT.visitors.document.objects.RequestBody.fixedFields.required}},MediaType:{$visitor:class extends Xk{constructor(e){super(e),this.element=new kT}},fixedFields:{schema:{$ref:"#/visitors/document/objects/Schema"},example:mT.visitors.document.objects.MediaType.fixedFields.example,examples:mT.visitors.document.objects.MediaType.fixedFields.examples,encoding:mT.visitors.document.objects.MediaType.fixedFields.encoding}},Encoding:{$visitor:class extends yF{constructor(e){super(e),this.element=new jT}},fixedFields:{contentType:mT.visitors.document.objects.Encoding.fixedFields.contentType,headers:mT.visitors.document.objects.Encoding.fixedFields.headers,style:mT.visitors.document.objects.Encoding.fixedFields.style,explode:mT.visitors.document.objects.Encoding.fixedFields.explode,allowReserved:mT.visitors.document.objects.Encoding.fixedFields.allowReserved}},Responses:{$visitor:class extends jF{constructor(e){super(e),this.element=new UT}},fixedFields:{default:mT.visitors.document.objects.Responses.fixedFields.default}},Response:{$visitor:class extends xF{constructor(e){super(e),this.element=new LT}},fixedFields:{description:mT.visitors.document.objects.Response.fixedFields.description,headers:mT.visitors.document.objects.Response.fixedFields.headers,content:mT.visitors.document.objects.Response.fixedFields.content,links:mT.visitors.document.objects.Response.fixedFields.links}},Callback:{$visitor:class extends wF{constructor(e){super(e),this.element=new bT,this.specPath=e=>bA(e)?["document","objects","Reference"]:["document","objects","PathItem"]}ObjectElement(e){const t=wF.prototype.ObjectElement.call(this,e);return this.element.filter(Sk).forEach((e=>{e.setMetaProperty("referenced-element","pathItem")})),t}}},Example:{$visitor:class extends mF{constructor(e){super(e),this.element=new ET}},fixedFields:{summary:mT.visitors.document.objects.Example.fixedFields.summary,description:mT.visitors.document.objects.Example.fixedFields.description,value:mT.visitors.document.objects.Example.fixedFields.value,externalValue:mT.visitors.document.objects.Example.fixedFields.externalValue}},Link:{$visitor:class extends Vk{constructor(e){super(e),this.element=new TT}},fixedFields:{operationRef:mT.visitors.document.objects.Link.fixedFields.operationRef,operationId:mT.visitors.document.objects.Link.fixedFields.operationId,parameters:mT.visitors.document.objects.Link.fixedFields.parameters,requestBody:mT.visitors.document.objects.Link.fixedFields.requestBody,description:mT.visitors.document.objects.Link.fixedFields.description,server:{$ref:"#/visitors/document/objects/Server"}}},Header:{$visitor:class extends eF{constructor(e){super(e),this.element=new OT}},fixedFields:{description:mT.visitors.document.objects.Header.fixedFields.description,required:mT.visitors.document.objects.Header.fixedFields.required,deprecated:mT.visitors.document.objects.Header.fixedFields.deprecated,allowEmptyValue:mT.visitors.document.objects.Header.fixedFields.allowEmptyValue,style:mT.visitors.document.objects.Header.fixedFields.style,explode:mT.visitors.document.objects.Header.fixedFields.explode,allowReserved:mT.visitors.document.objects.Header.fixedFields.allowReserved,schema:{$ref:"#/visitors/document/objects/Schema"},example:mT.visitors.document.objects.Header.fixedFields.example,examples:mT.visitors.document.objects.Header.fixedFields.examples,content:mT.visitors.document.objects.Header.fixedFields.content}},Tag:{$visitor:class extends Zk{constructor(e){super(e),this.element=new XT}},fixedFields:{name:mT.visitors.document.objects.Tag.fixedFields.name,description:mT.visitors.document.objects.Tag.fixedFields.description,externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"}}},Reference:{$visitor:class extends Kk{constructor(e){super(e),this.element=new qT}},fixedFields:{$ref:mT.visitors.document.objects.Reference.fixedFields.$ref,summary:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"}}},Schema:{$visitor:rF,fixedFields:{$schema:{$ref:"#/visitors/value"},$vocabulary:class extends vA{ObjectElement(e){const t=super.enter(e);return this.element.classes.push("json-schema-$vocabulary"),t}},$id:{$ref:"#/visitors/value"},$anchor:{$ref:"#/visitors/value"},$dynamicAnchor:{$ref:"#/visitors/value"},$dynamicRef:{$ref:"#/visitors/value"},$ref:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("reference-value"),t}},$defs:nF,$comment:{$ref:"#/visitors/value"},allOf:sF,anyOf:iF,oneOf:oF,not:{$ref:"#/visitors/document/objects/Schema"},if:{$ref:"#/visitors/document/objects/Schema"},then:{$ref:"#/visitors/document/objects/Schema"},else:{$ref:"#/visitors/document/objects/Schema"},dependentSchemas:cF,prefixItems:aF,items:{$ref:"#/visitors/document/objects/Schema"},contains:{$ref:"#/visitors/document/objects/Schema"},properties:uF,patternProperties:lF,additionalProperties:{$ref:"#/visitors/document/objects/Schema"},propertyNames:{$ref:"#/visitors/document/objects/Schema"},unevaluatedItems:{$ref:"#/visitors/document/objects/Schema"},unevaluatedProperties:{$ref:"#/visitors/document/objects/Schema"},type:class extends vA{StringElement(e){const t=super.enter(e);return this.element.classes.push("json-schema-type"),t}ArrayElement(e){const t=super.enter(e);return this.element.classes.push("json-schema-type"),t}},enum:class extends vA{ArrayElement(e){const t=super.enter(e);return this.element.classes.push("json-schema-enum"),t}},const:{$ref:"#/visitors/value"},multipleOf:{$ref:"#/visitors/value"},maximum:{$ref:"#/visitors/value"},exclusiveMaximum:{$ref:"#/visitors/value"},minimum:{$ref:"#/visitors/value"},exclusiveMinimum:{$ref:"#/visitors/value"},maxLength:{$ref:"#/visitors/value"},minLength:{$ref:"#/visitors/value"},pattern:{$ref:"#/visitors/value"},maxItems:{$ref:"#/visitors/value"},minItems:{$ref:"#/visitors/value"},uniqueItems:{$ref:"#/visitors/value"},maxContains:{$ref:"#/visitors/value"},minContains:{$ref:"#/visitors/value"},maxProperties:{$ref:"#/visitors/value"},minProperties:{$ref:"#/visitors/value"},required:{$ref:"#/visitors/value"},dependentRequired:class extends vA{ObjectElement(e){const t=super.enter(e);return this.element.classes.push("json-schema-dependentRequired"),t}},title:{$ref:"#/visitors/value"},description:{$ref:"#/visitors/value"},default:{$ref:"#/visitors/value"},deprecated:{$ref:"#/visitors/value"},readOnly:{$ref:"#/visitors/value"},writeOnly:{$ref:"#/visitors/value"},examples:class extends vA{ArrayElement(e){const t=super.enter(e);return this.element.classes.push("json-schema-examples"),t}},format:{$ref:"#/visitors/value"},contentEncoding:{$ref:"#/visitors/value"},contentMediaType:{$ref:"#/visitors/value"},contentSchema:{$ref:"#/visitors/document/objects/Schema"},discriminator:{$ref:"#/visitors/document/objects/Discriminator"},xml:{$ref:"#/visitors/document/objects/XML"},externalDocs:{$ref:"#/visitors/document/objects/ExternalDocumentation"},example:{$ref:"#/visitors/value"}}},Discriminator:{$visitor:class extends hF{constructor(e){super(e),this.element=new xT,this.canSupportSpecificationExtensions=!0}},fixedFields:{propertyName:mT.visitors.document.objects.Discriminator.fixedFields.propertyName,mapping:mT.visitors.document.objects.Discriminator.fixedFields.mapping}},XML:{$visitor:class extends fF{constructor(e){super(e),this.element=new WT}},fixedFields:{name:mT.visitors.document.objects.XML.fixedFields.name,namespace:mT.visitors.document.objects.XML.fixedFields.namespace,prefix:mT.visitors.document.objects.XML.fixedFields.prefix,attribute:mT.visitors.document.objects.XML.fixedFields.attribute,wrapped:mT.visitors.document.objects.XML.fixedFields.wrapped}},SecurityScheme:{$visitor:class extends OF{constructor(e){super(e),this.element=new GT}},fixedFields:{type:mT.visitors.document.objects.SecurityScheme.fixedFields.type,description:mT.visitors.document.objects.SecurityScheme.fixedFields.description,name:mT.visitors.document.objects.SecurityScheme.fixedFields.name,in:mT.visitors.document.objects.SecurityScheme.fixedFields.in,scheme:mT.visitors.document.objects.SecurityScheme.fixedFields.scheme,bearerFormat:mT.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat,flows:{$ref:"#/visitors/document/objects/OAuthFlows"},openIdConnectUrl:mT.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl}},OAuthFlows:{$visitor:class extends SF{constructor(e){super(e),this.element=new IT}},fixedFields:{implicit:{$ref:"#/visitors/document/objects/OAuthFlow"},password:{$ref:"#/visitors/document/objects/OAuthFlow"},clientCredentials:{$ref:"#/visitors/document/objects/OAuthFlow"},authorizationCode:{$ref:"#/visitors/document/objects/OAuthFlow"}}},OAuthFlow:{$visitor:class extends AF{constructor(e){super(e),this.element=new FT}},fixedFields:{authorizationUrl:mT.visitors.document.objects.OAuthFlow.fixedFields.authorizationUrl,tokenUrl:mT.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl,refreshUrl:mT.visitors.document.objects.OAuthFlow.fixedFields.refreshUrl,scopes:mT.visitors.document.objects.OAuthFlow.fixedFields.scopes}},SecurityRequirement:{$visitor:class extends Wk{constructor(e){super(e),this.element=new VT}}}},extension:{$visitor:mT.visitors.document.extension.$visitor}}}},kF=e=>(t,r={})=>((e,{specPath:t=["visitors","document","objects","OpenApi","$visitor"],plugins:r=[]}={})=>{const n=zx(e),s=uE(TF),i=new(pd(t,s))({specObj:s});return Gj(n,i),zj(i.element,r,{toolboxCreator:qk,visitorOptions:{keyMap:ek,nodeTypeGetter:QT}})})(t,{specPath:e,...r});bT.refract=kF(["visitors","document","objects","Callback","$visitor"]),gT.refract=kF(["visitors","document","objects","Components","$visitor"]),wT.refract=kF(["visitors","document","objects","Contact","$visitor"]),ET.refract=kF(["visitors","document","objects","Example","$visitor"]),xT.refract=kF(["visitors","document","objects","Discriminator","$visitor"]),jT.refract=kF(["visitors","document","objects","Encoding","$visitor"]),$T.refract=kF(["visitors","document","objects","ExternalDocumentation","$visitor"]),OT.refract=kF(["visitors","document","objects","Header","$visitor"]),ST.refract=kF(["visitors","document","objects","Info","$visitor"]),AT.refract=kF(["visitors","document","objects","OpenApi","fixedFields","jsonSchemaDialect"]),PT.refract=kF(["visitors","document","objects","License","$visitor"]),TT.refract=kF(["visitors","document","objects","Link","$visitor"]),kT.refract=kF(["visitors","document","objects","MediaType","$visitor"]),FT.refract=kF(["visitors","document","objects","OAuthFlow","$visitor"]),IT.refract=kF(["visitors","document","objects","OAuthFlows","$visitor"]),RT.refract=kF(["visitors","document","objects","OpenApi","fixedFields","openapi"]),DT.refract=kF(["visitors","document","objects","OpenApi","$visitor"]),_T.refract=kF(["visitors","document","objects","Operation","$visitor"]),CT.refract=kF(["visitors","document","objects","Parameter","$visitor"]),MT.refract=kF(["visitors","document","objects","PathItem","$visitor"]),NT.refract=kF(["visitors","document","objects","Paths","$visitor"]),qT.refract=kF(["visitors","document","objects","Reference","$visitor"]),BT.refract=kF(["visitors","document","objects","RequestBody","$visitor"]),LT.refract=kF(["visitors","document","objects","Response","$visitor"]),UT.refract=kF(["visitors","document","objects","Responses","$visitor"]),JT.refract=kF(["visitors","document","objects","Schema","$visitor"]),VT.refract=kF(["visitors","document","objects","SecurityRequirement","$visitor"]),GT.refract=kF(["visitors","document","objects","SecurityScheme","$visitor"]),HT.refract=kF(["visitors","document","objects","Server","$visitor"]),zT.refract=kF(["visitors","document","objects","ServerVariable","$visitor"]),XT.refract=kF(["visitors","document","objects","Tag","$visitor"]),WT.refract=kF(["visitors","document","objects","XML","$visitor"]);class FF extends yE{constructor(e){super({...null!=e?e:{},name:"binary"})}canParse(e){return 0===this.fileExtensions.length||this.fileExtensions.includes(e.extension)}parse(e){try{const t=unescape(encodeURIComponent(e.toString())),r=btoa(t),n=new Yx;if(0!==r.length){const e=new Nx(r);e.classes.push("result"),n.push(e)}return n}catch(t){throw new AE(`Error parsing "${e.uri}"`,{cause:t})}}}class IF extends class{name;constructor({name:e}){this.name=e}}{constructor(e){super({...null!=e?e:{},name:"openapi-3-1"})}canResolve(e,t){const r=t.dereference.strategies.find((e=>"openapi-3-1"===e.name));return void 0!==r&&r.canDereference(e,t)}async resolve(e,t){const r=t.dereference.strategies.find((e=>"openapi-3-1"===e.name));if(void 0===r)throw new vE('"openapi-3-1" dereference strategy is not available.');const n=new Qm,s=nv(t,{resolve:{internal:!1},dereference:{refSet:n}});return await r.dereference(e,s),n}}const{AbortController:RF,AbortSignal:DF}=globalThis;void 0===globalThis.AbortController&&(globalThis.AbortController=RF),void 0===globalThis.AbortSignal&&(globalThis.AbortSignal=DF);class _F extends class extends class{name;constructor({name:e}){this.name=e}}{timeout;redirects;withCredentials;constructor(e){const{name:t="http-resolver",timeout:r=5e3,redirects:n=5,withCredentials:s=!1}=null!=e?e:{};super({name:t}),this.timeout=r,this.redirects=n,this.withCredentials=s}canRead(e){return Um(e.uri)}}{swaggerHTTPClient=_t;swaggerHTTPClientConfig;constructor({swaggerHTTPClient:e=_t,swaggerHTTPClientConfig:t={},...r}={}){super({...r,name:"http-swagger-client"}),this.swaggerHTTPClient=e,this.swaggerHTTPClientConfig=t}getHttpClient(){return this.swaggerHTTPClient}async read(e){const t=this.getHttpClient(),r=new AbortController,{signal:n}=r,s=setTimeout((()=>{r.abort()}),this.timeout),i=this.getHttpClient().withCredentials||this.withCredentials?"include":"same-origin",o=0===this.redirects?"error":"follow",c=this.redirects>0?this.redirects:void 0;try{return(await t({url:e.uri,signal:n,userFetch:async(e,t)=>{let r=await fetch(e,t);try{r.headers.delete("Content-Type")}catch{r=new Response(r.body,{...r,headers:new Headers(r.headers)}),r.headers.delete("Content-Type")}return r},credentials:i,redirect:o,follow:c,...this.swaggerHTTPClientConfig})).text.arrayBuffer()}catch(t){throw new uv(`Error downloading "${e.uri}"`,{cause:t})}finally{clearTimeout(s)}}}class CF extends yE{constructor(e={}){super({name:"json-swagger-client",mediaTypes:["application/json"],...e})}async canParse(e){const t=0===this.fileExtensions.length||this.fileExtensions.includes(e.extension),r=this.mediaTypes.includes(e.mediaType);if(!t)return!1;if(r)return!0;if(!r)try{return JSON.parse(e.toString()),!0}catch(e){return!1}return!1}async parse(e){if(this.sourceMap)throw new AE("json-swagger-client parser plugin doesn't support sourceMaps option");const t=new Yx,r=e.toString();if(this.allowEmpty&&""===r.trim())return t;try{const e=lE(JSON.parse(r));return e.classes.push("result"),t.push(e),t}catch(t){throw new AE(`Error parsing "${e.uri}"`,{cause:t})}}}class MF extends yE{constructor(e={}){super({name:"yaml-1-2-swagger-client",mediaTypes:["text/yaml","application/yaml"],...e})}async canParse(e){const t=0===this.fileExtensions.length||this.fileExtensions.includes(e.extension),r=this.mediaTypes.includes(e.mediaType);if(!t)return!1;if(r)return!0;if(!r)try{return It.load(e.toString(),{schema:xt}),!0}catch(e){return!1}return!1}async parse(e){if(this.sourceMap)throw new AE("yaml-1-2-swagger-client parser plugin doesn't support sourceMaps option");const t=new Yx,r=e.toString();try{const e=It.load(r,{schema:xt});if(this.allowEmpty&&void 0===e)return t;const n=lE(e);return n.classes.push("result"),t.push(n),t}catch(t){throw new AE(`Error parsing "${e.uri}"`,{cause:t})}}}class NF extends yE{detectionRegExp=/"openapi"\s*:\s*"(?<version_json>3\.1\.(?:[1-9]\d*|0))"/;constructor(e={}){super({name:"openapi-json-3-1-swagger-client",mediaTypes:new nO(...sO.filterByFormat("generic"),...sO.filterByFormat("json")),...e})}async canParse(e){const t=0===this.fileExtensions.length||this.fileExtensions.includes(e.extension),r=this.mediaTypes.includes(e.mediaType);if(!t)return!1;if(r)return!0;if(!r)try{const t=e.toString();return JSON.parse(t),this.detectionRegExp.test(t)}catch(e){return!1}return!1}async parse(e){if(this.sourceMap)throw new AE("openapi-json-3-1-swagger-client parser plugin doesn't support sourceMaps option");const t=new Yx,r=e.toString();if(this.allowEmpty&&""===r.trim())return t;try{const e=JSON.parse(r),n=DT.refract(e,this.refractorOpts);return n.classes.push("result"),t.push(n),t}catch(t){throw new AE(`Error parsing "${e.uri}"`,{cause:t})}}}class qF extends yE{detectionRegExp=/(?<YAML>^(["']?)openapi\2\s*:\s*(["']?)(?<version_yaml>3\.1\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"openapi"\s*:\s*"(?<version_json>3\.1\.(?:[1-9]\d*|0))")/m;constructor(e={}){super({name:"openapi-yaml-3-1-swagger-client",mediaTypes:new nO(...sO.filterByFormat("generic"),...sO.filterByFormat("yaml")),...e})}async canParse(e){const t=0===this.fileExtensions.length||this.fileExtensions.includes(e.extension),r=this.mediaTypes.includes(e.mediaType);if(!t)return!1;if(r)return!0;if(!r)try{const t=e.toString();return It.load(t),this.detectionRegExp.test(t)}catch(e){return!1}return!1}async parse(e){if(this.sourceMap)throw new AE("openapi-yaml-3-1-swagger-client parser plugin doesn't support sourceMaps option");const t=new Yx,r=e.toString();try{const e=It.load(r,{schema:xt});if(this.allowEmpty&&void 0===e)return t;const n=DT.refract(e,this.refractorOpts);return n.classes.push("result"),t.push(n),t}catch(t){throw new AE(`Error parsing "${e.uri}"`,{cause:t})}}}const BF=e=>/^[A-Za-z_][A-Za-z_0-9.-]*$/.test(e),LF=e=>{const t=Gm(e);return jm("#",t)},UF=(e,t)=>{const r=(e=>{if(!BF(e))throw new $E(e);return e})(e),n=eE((e=>kk(e)&&oE(e.$anchor)===r),t);if(Id(n))throw new xE(`Evaluation failed on token: "${r}"`);return n},JF=(e,t)=>{if(void 0===t.$ref)return;const r=Gm(oE(t.$ref)),n=oE(t.meta.get("inherited$id"));return`${zf(((e,t)=>Xm(e,Wm(Hm(t)))),e,[...n,oE(t.$ref)])}${"#"===r?"":r}`},VF=e=>{if(VF.cache.has(e))return VF.cache.get(e);const t=JT.refract(e);return VF.cache.set(e,t),t};VF.cache=new WeakMap;const GF=e=>bj(e)?VF(e):e,HF=(e,t)=>{const{cache:r}=HF,n=Hm(e),s=e=>kk(e)&&void 0!==e.$id;if(!r.has(t)){const e=((e,t)=>{const r=new Vj({predicate:e});return Gj(t,r),new _x(r.result)})(s,t);r.set(t,Array.from(e))}const i=r.get(t).find((e=>{const t=((e,t)=>{if(void 0===t.$id)return;const r=oE(t.meta.get("inherited$id"));return zf(((e,t)=>Xm(e,Wm(Hm(t)))),e,[...r,oE(t.$id)])})(n,e);return t===n}));if(Id(i))throw new EE(`Evaluation failed on URI: "${e}"`);let o,c;return BF(LF(e))?(o=UF,c=LF(e)):(o=rO,c=eO(e)),o(c,i)};HF.cache=new WeakMap;const zF=Gj[Symbol.for("nodejs.util.promisify.custom")],XF=new Zj,WF=(e,t,r,n)=>{hj(n)?n.value=e:Array.isArray(n)&&(n[r]=e)};class YF{indirections;namespace;reference;options;ancestors;refractCache;constructor({reference:e,namespace:t,options:r,indirections:n=[],ancestors:s=new bE,refractCache:i=new Map}){this.indirections=n,this.namespace=t,this.reference=e,this.options=r,this.ancestors=new bE(...s),this.refractCache=i}toBaseURI(e){return Xm(this.reference.uri,Wm(Hm(e)))}async toReference(e){if(this.reference.depth>=this.options.resolve.maxDepth)throw new SE(`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file "${this.reference.uri}"`);const t=this.toBaseURI(e),{refSet:r}=this.reference;if(r.has(t))return r.find(yd(t,"uri"));const n=await hv(Ym(t),{...this.options,parse:{...this.options.parse,mediaType:"text/plain"}}),s=new gE({uri:t,value:Cj(n),depth:this.reference.depth+1});if(r.add(s),this.options.dereference.immutable){const e=new gE({uri:`immutable://${t}`,value:n,depth:this.reference.depth+1});r.add(e)}return s}toAncestorLineage(e){const t=new Set(e.filter(sj));return[new bE(...this.ancestors,t),t]}async ReferenceElement(e,t,r,n,s,i){if(this.indirections.includes(e))return!1;const[o,c]=this.toAncestorLineage([...s,r]),a=this.toBaseURI(oE(e.$ref)),u=Hm(this.reference.uri)===a,l=!u;if(!this.options.resolve.internal&&u)return!1;if(!this.options.resolve.external&&l)return!1;const h=await this.toReference(oE(e.$ref)),f=Xm(a,oE(e.$ref));this.indirections.push(e);const p=eO(f);let d=rO(p,h.value.result);if(d.id=XF.identify(d),bj(d)){const t=oE(e.meta.get("referenced-element")),r=`${t}-${oE(XF.identify(d))}`;if(this.refractCache.has(r))d=this.refractCache.get(r);else if(bA(d))d=qT.refract(d),d.setMetaProperty("referenced-element",t),this.refractCache.set(r,d);else{d=this.namespace.getElementClass(t).refract(d),this.refractCache.set(r,d)}}if(e===d)throw new Fh("Recursive Reference Object detected");if(this.indirections.length>this.options.dereference.maxDepth)throw new OE(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);if(o.includes(d)){if(h.refSet.circular=!0,"error"===this.options.dereference.circular)throw new Fh("Circular reference detected");if("replace"===this.options.dereference.circular){var m,v;const t=new Gx(d.id,{type:"reference",uri:h.uri,$ref:oE(e.$ref)}),n=(null!==(m=null===(v=this.options.dereference.strategyOpts["openapi-3-1"])||void 0===v?void 0:v.circularReplacer)&&void 0!==m?m:this.options.dereference.circularReplacer)(t);return i.replaceWith(n,WF),!r&&n}}const y=Hm(h.refSet.rootRef.uri)!==h.uri,b=["error","replace"].includes(this.options.dereference.circular);if((l||y||Sk(d)||b)&&!o.includesCycle(d)){c.add(e);const t=new YF({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.options,refractCache:this.refractCache,ancestors:o});d=await zF(d,t,{keyMap:ek,nodeTypeGetter:QT}),c.delete(e)}this.indirections.pop();const g=qj(d);return g.setMetaProperty("id",XF.generateId()),g.setMetaProperty("ref-fields",{$ref:oE(e.$ref),description:oE(e.description),summary:oE(e.summary)}),g.setMetaProperty("ref-origin",h.uri),g.setMetaProperty("ref-referencing-element-id",Cj(XF.identify(e))),uj(d)&&uj(g)&&(e.hasKey("description")&&"description"in d&&(g.remove("description"),g.set("description",e.get("description"))),e.hasKey("summary")&&"summary"in d&&(g.remove("summary"),g.set("summary",e.get("summary")))),i.replaceWith(g,WF),!r&&g}async PathItemElement(e,t,r,n,s,i){if(!ij(e.$ref))return;if(this.indirections.includes(e))return!1;const[o,c]=this.toAncestorLineage([...s,r]),a=this.toBaseURI(oE(e.$ref)),u=Hm(this.reference.uri)===a,l=!u;if(!this.options.resolve.internal&&u)return;if(!this.options.resolve.external&&l)return;const h=await this.toReference(oE(e.$ref)),f=Xm(a,oE(e.$ref));this.indirections.push(e);const p=eO(f);let d=rO(p,h.value.result);if(d.id=XF.identify(d),bj(d)){const e=`path-item-${oE(XF.identify(d))}`;this.refractCache.has(e)?d=this.refractCache.get(e):(d=MT.refract(d),this.refractCache.set(e,d))}if(e===d)throw new Fh("Recursive Path Item Object reference detected");if(this.indirections.length>this.options.dereference.maxDepth)throw new OE(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);if(o.includes(d)){if(h.refSet.circular=!0,"error"===this.options.dereference.circular)throw new Fh("Circular reference detected");if("replace"===this.options.dereference.circular){var m,v;const t=new Gx(d.id,{type:"path-item",uri:h.uri,$ref:oE(e.$ref)}),n=(null!==(m=null===(v=this.options.dereference.strategyOpts["openapi-3-1"])||void 0===v?void 0:v.circularReplacer)&&void 0!==m?m:this.options.dereference.circularReplacer)(t);return i.replaceWith(n,WF),!r&&n}}const y=Hm(h.refSet.rootRef.uri)!==h.uri,b=["error","replace"].includes(this.options.dereference.circular);if((l||y||$k(d)&&ij(d.$ref)||b)&&!o.includesCycle(d)){c.add(e);const t=new YF({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.options,refractCache:this.refractCache,ancestors:o});d=await zF(d,t,{keyMap:ek,nodeTypeGetter:QT}),c.delete(e)}if(this.indirections.pop(),$k(d)){const t=new MT([...d.content],Cj(d.meta),Cj(d.attributes));t.setMetaProperty("id",XF.generateId()),e.forEach(((e,r,n)=>{t.remove(oE(r)),t.content.push(n)})),t.remove("$ref"),t.setMetaProperty("ref-fields",{$ref:oE(e.$ref)}),t.setMetaProperty("ref-origin",h.uri),t.setMetaProperty("ref-referencing-element-id",Cj(XF.identify(e))),d=t}return i.replaceWith(d,WF),r?void 0:d}async LinkElement(e,t,r,n,s,i){if(!ij(e.operationRef)&&!ij(e.operationId))return;if(ij(e.operationRef)&&ij(e.operationId))throw new Fh("LinkElement operationRef and operationId fields are mutually exclusive.");let o;if(ij(e.operationRef)){var c;const t=eO(oE(e.operationRef)),n=this.toBaseURI(oE(e.operationRef)),s=Hm(this.reference.uri)===n,a=!s;if(!this.options.resolve.internal&&s)return;if(!this.options.resolve.external&&a)return;const u=await this.toReference(oE(e.operationRef));if(o=rO(t,u.value.result),bj(o)){const e=`operation-${oE(XF.identify(o))}`;this.refractCache.has(e)?o=this.refractCache.get(e):(o=_T.refract(o),this.refractCache.set(e,o))}o=qj(o),o.setMetaProperty("ref-origin",u.uri);const l=qj(e);return null===(c=l.operationRef)||void 0===c||c.meta.set("operation",o),i.replaceWith(l,WF),r?void 0:l}if(ij(e.operationId)){var a;const t=oE(e.operationId),n=await this.toReference(Ym(this.reference.uri));if(o=eE((e=>jk(e)&&sj(e.operationId)&&e.operationId.equals(t)),n.value.result),Id(o))throw new Fh(`OperationElement(operationId=${t}) not found.`);const s=qj(e);return null===(a=s.operationId)||void 0===a||a.meta.set("operation",o),i.replaceWith(s,WF),r?void 0:s}}async ExampleElement(e,t,r,n,s,i){if(!ij(e.externalValue))return;if(e.hasKey("value")&&ij(e.externalValue))throw new Fh("ExampleElement value and externalValue fields are mutually exclusive.");const o=this.toBaseURI(oE(e.externalValue)),c=Hm(this.reference.uri)===o,a=!c;if(!this.options.resolve.internal&&c)return;if(!this.options.resolve.external&&a)return;const u=await this.toReference(oE(e.externalValue)),l=qj(u.value.result);l.setMetaProperty("ref-origin",u.uri);const h=qj(e);return h.value=l,i.replaceWith(h,WF),r?void 0:h}async SchemaElement(e,t,r,n,s,i){if(!ij(e.$ref))return;if(this.indirections.includes(e))return!1;const[o,c]=this.toAncestorLineage([...s,r]);let a=await this.toReference(Ym(this.reference.uri)),{uri:u}=a;const l=JF(u,e),h=Hm(l),f=new Km({uri:h}),p=ld((e=>e.canRead(f)),this.options.resolve.resolvers),d=!p;let m,v=Hm(this.reference.uri)===l,y=!v;this.indirections.push(e);try{if(p||d){u=this.toBaseURI(l);const e=l,t=GF(a.value.result);if(m=HF(e,t),m=GF(m),m.id=XF.identify(m),!this.options.resolve.internal&&v)return;if(!this.options.resolve.external&&y)return}else{if(u=this.toBaseURI(l),v=Hm(this.reference.uri)===u,y=!v,!this.options.resolve.internal&&v)return;if(!this.options.resolve.external&&y)return;a=await this.toReference(Ym(l));const e=eO(l),t=GF(a.value.result);m=rO(e,t),m=GF(m),m.id=XF.identify(m)}}catch(e){if(!(d&&e instanceof EE))throw e;if(BF(LF(l))){if(v=Hm(this.reference.uri)===u,y=!v,!this.options.resolve.internal&&v)return;if(!this.options.resolve.external&&y)return;a=await this.toReference(Ym(l));const e=LF(l),t=GF(a.value.result);m=UF(e,t),m=GF(m),m.id=XF.identify(m)}else{if(u=this.toBaseURI(l),v=Hm(this.reference.uri)===u,y=!v,!this.options.resolve.internal&&v)return;if(!this.options.resolve.external&&y)return;a=await this.toReference(Ym(l));const e=eO(l),t=GF(a.value.result);m=rO(e,t),m=GF(m),m.id=XF.identify(m)}}if(e===m)throw new Fh("Recursive Schema Object reference detected");if(this.indirections.length>this.options.dereference.maxDepth)throw new OE(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);if(o.includes(m)){if(a.refSet.circular=!0,"error"===this.options.dereference.circular)throw new Fh("Circular reference detected");if("replace"===this.options.dereference.circular){var b,g;const t=new Gx(m.id,{type:"json-schema",uri:a.uri,$ref:oE(e.$ref)}),n=(null!==(b=null===(g=this.options.dereference.strategyOpts["openapi-3-1"])||void 0===g?void 0:g.circularReplacer)&&void 0!==b?b:this.options.dereference.circularReplacer)(t);return i.replaceWith(n,WF),!r&&n}}const w=Hm(a.refSet.rootRef.uri)!==a.uri,x=["error","replace"].includes(this.options.dereference.circular);if((y||w||kk(m)&&ij(m.$ref)||x)&&!o.includesCycle(m)){c.add(e);const t=new YF({reference:a,namespace:this.namespace,indirections:[...this.indirections],options:this.options,refractCache:this.refractCache,ancestors:o});m=await zF(m,t,{keyMap:ek,nodeTypeGetter:QT}),c.delete(e)}if(this.indirections.pop(),Fk(m)){const t=Cj(m);return t.setMetaProperty("id",XF.generateId()),t.setMetaProperty("ref-fields",{$ref:oE(e.$ref)}),t.setMetaProperty("ref-origin",a.uri),t.setMetaProperty("ref-referencing-element-id",Cj(XF.identify(e))),i.replaceWith(t,WF),!r&&t}if(kk(m)){const t=new JT([...m.content],Cj(m.meta),Cj(m.attributes));t.setMetaProperty("id",XF.generateId()),e.forEach(((e,r,n)=>{t.remove(oE(r)),t.content.push(n)})),t.remove("$ref"),t.setMetaProperty("ref-fields",{$ref:oE(e.$ref)}),t.setMetaProperty("ref-origin",a.uri),t.setMetaProperty("ref-referencing-element-id",Cj(XF.identify(e))),m=t}return i.replaceWith(m,WF),r?void 0:m}}const ZF=Gj[Symbol.for("nodejs.util.promisify.custom")];const KF=e=>{const t=(e=>e.slice(2))(e);return t.reduce(((e,r,n)=>{if(hj(r)){const t=String(oE(r.key));e.push(t)}else if(lj(t[n-2])){const s=t[n-2].content.indexOf(r);e.push(s)}return e}),[])};class QF{modelPropertyMacro;options;SchemaElement={leave:(e,t,r,n,s)=>{void 0!==e.properties&&uj(e.properties)&&e.properties.forEach((t=>{if(uj(t))try{const e=this.modelPropertyMacro(oE(t));t.set("default",e)}catch(t){var n,i;const o=new Error(t,{cause:t});o.fullPath=[...KF([...s,r,e]),"properties"],null===(n=this.options.dereference.dereferenceOpts)||void 0===n||null===(n=n.errors)||void 0===n||null===(i=n.push)||void 0===i||i.call(n,o)}}))}};constructor({modelPropertyMacro:e,options:t}){this.modelPropertyMacro=e,this.options=t}}class eI{options;SchemaElement={leave(e,t,r,n,s){if(void 0===e.allOf)return;if(!lj(e.allOf)){var i,o;const t=new TypeError("allOf must be an array");return t.fullPath=[...KF([...s,r,e]),"allOf"],void(null===(i=this.options.dereference.dereferenceOpts)||void 0===i||null===(i=i.errors)||void 0===i||null===(o=i.push)||void 0===o||o.call(i,t))}if(e.allOf.isEmpty)return void e.remove("allOf");if(!e.allOf.content.every(kk)){var c,a;const t=new TypeError("Elements in allOf must be objects");return t.fullPath=[...KF([...s,r,e]),"allOf"],void(null===(c=this.options.dereference.dereferenceOpts)||void 0===c||null===(c=c.errors)||void 0===c||null===(a=c.push)||void 0===a||a.call(c,t))}for(;e.hasKey("allOf");){const{allOf:t}=e;e.remove("allOf");const r=dE.all([...t.content,e]);if(e.hasKey("$$ref")||r.remove("$$ref"),e.hasKey("example")){const t=r.getMember("example");t&&(t.value=e.get("example"))}if(e.hasKey("examples")){const t=r.getMember("examples");t&&(t.value=e.get("examples"))}e.content=r.content}}};constructor({options:e}){this.options=e}}class tI{parameterMacro;options;#e;OperationElement={enter:e=>{this.#e=e},leave:()=>{this.#e=void 0}};ParameterElement={leave:(e,t,r,n,s)=>{const i=this.#e?oE(this.#e):null,o=oE(e);try{const t=this.parameterMacro(i,o);e.set("default",t)}catch(e){var c,a;const t=new Error(e,{cause:e});t.fullPath=KF([...s,r]),null===(c=this.options.dereference.dereferenceOpts)||void 0===c||null===(c=c.errors)||void 0===c||null===(a=c.push)||void 0===a||a.call(c,t)}}};constructor({parameterMacro:e,options:t}){this.parameterMacro=e,this.options=t}}const rI=e=>{if(null==e.cause)return e;let{cause:t}=e;for(;null!=t.cause;)t=t.cause;return t};class nI extends Ih{}const{wrapError:sI}=m$,iI=Gj[Symbol.for("nodejs.util.promisify.custom")],oI=new Zj,cI=(e,t,r,n)=>{hj(n)?n.value=e:Array.isArray(n)&&(n[r]=e)};class aI extends YF{useCircularStructures;allowMetaPatches;basePath;constructor({allowMetaPatches:e=!0,useCircularStructures:t=!1,basePath:r=null,...n}){super(n),this.allowMetaPatches=e,this.useCircularStructures=t,this.basePath=r}async ReferenceElement(e,t,r,n,s,i){try{if(this.indirections.includes(e))return!1;const[t,n]=this.toAncestorLineage([...s,r]),u=this.toBaseURI(oE(e.$ref)),l=Hm(this.reference.uri)===u,h=!l;if(!this.options.resolve.internal&&l)return!1;if(!this.options.resolve.external&&h)return!1;const f=await this.toReference(oE(e.$ref)),p=Xm(u,oE(e.$ref));this.indirections.push(e);const d=eO(p);let m=rO(d,f.value.result);if(m.id=oI.identify(m),bj(m)){const t=oE(e.meta.get("referenced-element")),r=`${t}-${oE(oI.identify(m))}`;if(this.refractCache.has(r))m=this.refractCache.get(r);else if(bA(m))m=qT.refract(m),m.setMetaProperty("referenced-element",t),this.refractCache.set(r,m);else{m=this.namespace.getElementClass(t).refract(m),this.refractCache.set(r,m)}}if(e===m)throw new Fh("Recursive Reference Object detected");if(this.indirections.length>this.options.dereference.maxDepth)throw new OE(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);if(t.includes(m)){if(f.refSet.circular=!0,"error"===this.options.dereference.circular)throw new Fh("Circular reference detected");if("replace"===this.options.dereference.circular){var o,c;const t=new Gx(m.id,{type:"reference",uri:f.uri,$ref:oE(e.$ref),baseURI:p,referencingElement:e}),n=(null!==(o=null===(c=this.options.dereference.strategyOpts["openapi-3-1"])||void 0===c?void 0:c.circularReplacer)&&void 0!==o?o:this.options.dereference.circularReplacer)(t);return i.replaceWith(t,cI),!r&&n}}const v=Hm(f.refSet.rootRef.uri)!==f.uri,y=["error","replace"].includes(this.options.dereference.circular);if((h||v||Sk(m)||y)&&!t.includesCycle(m)){var a;n.add(e);const i=new aI({reference:f,namespace:this.namespace,indirections:[...this.indirections],options:this.options,refractCache:this.refractCache,ancestors:t,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,basePath:null!==(a=this.basePath)&&void 0!==a?a:[...KF([...s,r,e]),"$ref"]});m=await iI(m,i,{keyMap:ek,nodeTypeGetter:QT}),n.delete(e)}this.indirections.pop();const b=qj(m);if(b.setMetaProperty("ref-fields",{$ref:oE(e.$ref),description:oE(e.description),summary:oE(e.summary)}),b.setMetaProperty("ref-origin",f.uri),b.setMetaProperty("ref-referencing-element-id",Cj(oI.identify(e))),uj(m)&&(e.hasKey("description")&&"description"in m&&(b.remove("description"),b.set("description",e.get("description"))),e.hasKey("summary")&&"summary"in m&&(b.remove("summary"),b.set("summary",e.get("summary")))),this.allowMetaPatches&&uj(b)&&!b.hasKey("$$ref")){const e=Xm(u,p);b.set("$$ref",e)}return i.replaceWith(b,cI),!r&&b}catch(t){var u,l,h;const n=rI(t),i=sI(n,{baseDoc:this.reference.uri,$ref:oE(e.$ref),pointer:eO(oE(e.$ref)),fullPath:null!==(u=this.basePath)&&void 0!==u?u:[...KF([...s,r,e]),"$ref"]});return void(null===(l=this.options.dereference.dereferenceOpts)||void 0===l||null===(l=l.errors)||void 0===l||null===(h=l.push)||void 0===h||h.call(l,i))}}async PathItemElement(e,t,r,n,s,i){try{if(!ij(e.$ref))return;if(this.indirections.includes(e))return!1;if(wj(["cycle"],e.$ref))return!1;const[t,n]=this.toAncestorLineage([...s,r]),u=this.toBaseURI(oE(e.$ref)),l=Hm(this.reference.uri)===u,h=!l;if(!this.options.resolve.internal&&l)return;if(!this.options.resolve.external&&h)return;const f=await this.toReference(oE(e.$ref)),p=Xm(u,oE(e.$ref));this.indirections.push(e);const d=eO(p);let m=rO(d,f.value.result);if(m.id=oI.identify(m),bj(m)){const e=`path-item-${oE(oI.identify(m))}`;this.refractCache.has(e)?m=this.refractCache.get(e):(m=MT.refract(m),this.refractCache.set(e,m))}if(e===m)throw new Fh("Recursive Path Item Object reference detected");if(this.indirections.length>this.options.dereference.maxDepth)throw new OE(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);if(t.includes(m)){if(f.refSet.circular=!0,"error"===this.options.dereference.circular)throw new Fh("Circular reference detected");if("replace"===this.options.dereference.circular){var o,c;const t=new Gx(m.id,{type:"path-item",uri:f.uri,$ref:oE(e.$ref),baseURI:p,referencingElement:e}),n=(null!==(o=null===(c=this.options.dereference.strategyOpts["openapi-3-1"])||void 0===c?void 0:c.circularReplacer)&&void 0!==o?o:this.options.dereference.circularReplacer)(t);return i.replaceWith(t,cI),!r&&n}}const v=Hm(f.refSet.rootRef.uri)!==f.uri,y=["error","replace"].includes(this.options.dereference.circular);if((h||v||$k(m)&&ij(m.$ref)||y)&&!t.includesCycle(m)){var a;n.add(e);const i=new aI({reference:f,namespace:this.namespace,indirections:[...this.indirections],options:this.options,ancestors:t,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,basePath:null!==(a=this.basePath)&&void 0!==a?a:[...KF([...s,r,e]),"$ref"]});m=await iI(m,i,{keyMap:ek,nodeTypeGetter:QT}),n.delete(e)}if(this.indirections.pop(),$k(m)){const t=new MT([...m.content],Cj(m.meta),Cj(m.attributes));if(e.forEach(((e,r,n)=>{t.remove(oE(r)),t.content.push(n)})),t.remove("$ref"),t.setMetaProperty("ref-fields",{$ref:oE(e.$ref)}),t.setMetaProperty("ref-origin",f.uri),t.setMetaProperty("ref-referencing-element-id",Cj(oI.identify(e))),this.allowMetaPatches&&void 0===t.get("$$ref")){const e=Xm(u,p);t.set("$$ref",e)}m=t}return i.replaceWith(m,cI),r?void 0:m}catch(t){var u,l,h;const n=rI(t),i=sI(n,{baseDoc:this.reference.uri,$ref:oE(e.$ref),pointer:eO(oE(e.$ref)),fullPath:null!==(u=this.basePath)&&void 0!==u?u:[...KF([...s,r,e]),"$ref"]});return void(null===(l=this.options.dereference.dereferenceOpts)||void 0===l||null===(l=l.errors)||void 0===l||null===(h=l.push)||void 0===h||h.call(l,i))}}async SchemaElement(e,t,r,n,s,i){try{if(!ij(e.$ref))return;if(this.indirections.includes(e))return!1;const[t,n]=this.toAncestorLineage([...s,r]);let u=await this.toReference(Ym(this.reference.uri)),{uri:l}=u;const h=JF(l,e),f=Hm(h),p=new Km({uri:f}),d=!this.options.resolve.resolvers.some((e=>e.canRead(p))),m=!d;let v,y=Hm(this.reference.uri)===h,b=!y;this.indirections.push(e);try{if(d||m){l=this.toBaseURI(h);const e=h,t=GF(u.value.result);if(v=HF(e,t),v=GF(v),v.id=oI.identify(v),!this.options.resolve.internal&&y)return;if(!this.options.resolve.external&&b)return}else{if(l=this.toBaseURI(h),y=Hm(this.reference.uri)===l,b=!y,!this.options.resolve.internal&&y)return;if(!this.options.resolve.external&&b)return;u=await this.toReference(Ym(h));const e=eO(h),t=GF(u.value.result);v=rO(e,t),v=GF(v),v.id=oI.identify(v)}}catch(e){if(!(m&&e instanceof EE))throw e;if(BF(LF(h))){if(y=Hm(this.reference.uri)===l,b=!y,!this.options.resolve.internal&&y)return;if(!this.options.resolve.external&&b)return;u=await this.toReference(Ym(h));const e=LF(h),t=GF(u.value.result);v=UF(e,t),v=GF(v),v.id=oI.identify(v)}else{if(l=this.toBaseURI(oE(h)),y=Hm(this.reference.uri)===l,b=!y,!this.options.resolve.internal&&y)return;if(!this.options.resolve.external&&b)return;u=await this.toReference(Ym(h));const e=eO(h),t=GF(u.value.result);v=rO(e,t),v=GF(v),v.id=oI.identify(v)}}if(e===v)throw new Fh("Recursive Schema Object reference detected");if(this.indirections.length>this.options.dereference.maxDepth)throw new OE(`Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`);if(t.includes(v)){if(u.refSet.circular=!0,"error"===this.options.dereference.circular)throw new Fh("Circular reference detected");if("replace"===this.options.dereference.circular){var o,c;const t=new Gx(v.id,{type:"json-schema",uri:u.uri,$ref:oE(e.$ref),baseURI:Xm(l,h),referencingElement:e}),n=(null!==(o=null===(c=this.options.dereference.strategyOpts["openapi-3-1"])||void 0===c?void 0:c.circularReplacer)&&void 0!==o?o:this.options.dereference.circularReplacer)(t);return i.replaceWith(n,cI),!r&&n}}const g=Hm(u.refSet.rootRef.uri)!==u.uri,w=["error","replace"].includes(this.options.dereference.circular);if((b||g||kk(v)&&ij(v.$ref)||w)&&!t.includesCycle(v)){var a;n.add(e);const i=new aI({reference:u,namespace:this.namespace,indirections:[...this.indirections],options:this.options,useCircularStructures:this.useCircularStructures,allowMetaPatches:this.allowMetaPatches,ancestors:t,basePath:null!==(a=this.basePath)&&void 0!==a?a:[...KF([...s,r,e]),"$ref"]});v=await iI(v,i,{keyMap:ek,nodeTypeGetter:QT}),n.delete(e)}if(this.indirections.pop(),Fk(v)){const t=Cj(v);return t.setMetaProperty("ref-fields",{$ref:oE(e.$ref)}),t.setMetaProperty("ref-origin",u.uri),t.setMetaProperty("ref-referencing-element-id",Cj(oI.identify(e))),i.replaceWith(t,cI),!r&&t}if(kk(v)){const t=new JT([...v.content],Cj(v.meta),Cj(v.attributes));if(e.forEach(((e,r,n)=>{t.remove(oE(r)),t.content.push(n)})),t.remove("$ref"),t.setMetaProperty("ref-fields",{$ref:oE(e.$ref)}),t.setMetaProperty("ref-origin",u.uri),t.setMetaProperty("ref-referencing-element-id",Cj(oI.identify(e))),this.allowMetaPatches&&void 0===t.get("$$ref")){const e=Xm(l,h);t.set("$$ref",e)}v=t}return i.replaceWith(v,cI),r?void 0:v}catch(t){var u,l,h;const n=rI(t),i=new nI(`Could not resolve reference: ${n.message}`,{baseDoc:this.reference.uri,$ref:oE(e.$ref),fullPath:null!==(u=this.basePath)&&void 0!==u?u:[...KF([...s,r,e]),"$ref"],cause:n});return void(null===(l=this.options.dereference.dereferenceOpts)||void 0===l||null===(l=l.errors)||void 0===l||null===(h=l.push)||void 0===h||h.call(l,i))}}async LinkElement(){}async ExampleElement(e,t,r,n,s,i){try{return await super.ExampleElement(e,t,r,n,s,i)}catch(t){var o,c,a;const n=rI(t),i=sI(n,{baseDoc:this.reference.uri,externalValue:oE(e.externalValue),fullPath:null!==(o=this.basePath)&&void 0!==o?o:[...KF([...s,r,e]),"externalValue"]});return void(null===(c=this.options.dereference.dereferenceOpts)||void 0===c||null===(c=c.errors)||void 0===c||null===(a=c.push)||void 0===a||a.call(c,i))}}}const uI=Fj[Symbol.for("nodejs.util.promisify.custom")];class lI{constructor({parameterMacro:e,modelPropertyMacro:t,mode:r,options:n,...s}){const i=[];i.push(new aI({...s,options:n})),"function"==typeof t&&i.push(new QF({modelPropertyMacro:t,options:n})),"strict"!==r&&i.push(new eI({options:n})),"function"==typeof e&&i.push(new tI({parameterMacro:e,options:n}));const o=uI(i,{nodeTypeGetter:QT});Object.assign(this,o)}}const hI=Gj[Symbol.for("nodejs.util.promisify.custom")];class fI extends class extends class{name;constructor({name:e}){this.name=e}}{constructor(e){super({...null!=e?e:{},name:"openapi-3-1"})}canDereference(e){var t;return"text/plain"!==e.mediaType?sO.includes(e.mediaType):xk(null===(t=e.parseResult)||void 0===t?void 0:t.result)}async dereference(e,t){var r;const n=$j(YT),s=null!==(r=t.dereference.refSet)&&void 0!==r?r:new Qm,i=new Qm;let o,c=s;s.has(e.uri)?o=s.find(yd(e.uri,"uri")):(o=new gE({uri:e.uri,value:e.parseResult}),s.add(o)),t.dereference.immutable&&(s.refs.map((e=>new gE({...e,value:Cj(e.value)}))).forEach((e=>i.add(e))),o=i.find((t=>t.uri===e.uri)),c=i);const a=new YF({reference:o,namespace:n,options:t}),u=await ZF(c.rootRef.value,a,{keyMap:ek,nodeTypeGetter:QT});return t.dereference.immutable&&i.refs.filter((e=>e.uri.startsWith("immutable://"))).map((e=>new gE({...e,uri:e.uri.replace(/^immutable:\/\//,"")}))).forEach((e=>s.add(e))),null===t.dereference.refSet&&s.clean(),i.clean(),u}}{allowMetaPatches;parameterMacro;modelPropertyMacro;mode;ancestors;constructor({allowMetaPatches:e=!1,parameterMacro:t=null,modelPropertyMacro:r=null,mode:n="non-strict",ancestors:s=[],...i}={}){super({...i}),this.name="openapi-3-1-swagger-client",this.allowMetaPatches=e,this.parameterMacro=t,this.modelPropertyMacro=r,this.mode=n,this.ancestors=[...s]}async dereference(e,t){var r;const n=$j(YT),s=null!==(r=t.dereference.refSet)&&void 0!==r?r:new Qm,i=new Qm;let o,c=s;s.has(e.uri)?o=s.find((t=>t.uri===e.uri)):(o=new gE({uri:e.uri,value:e.parseResult}),s.add(o)),t.dereference.immutable&&(s.refs.map((e=>new gE({...e,value:Cj(e.value)}))).forEach((e=>i.add(e))),o=i.find((t=>t.uri===e.uri)),c=i);const a=new lI({reference:o,namespace:n,options:t,allowMetaPatches:this.allowMetaPatches,ancestors:this.ancestors,modelPropertyMacro:this.modelPropertyMacro,mode:this.mode,parameterMacro:this.parameterMacro}),u=await hI(c.rootRef.value,a,{keyMap:ek,nodeTypeGetter:QT});return t.dereference.immutable&&i.refs.filter((e=>e.uri.startsWith("immutable://"))).map((e=>new gE({...e,uri:e.uri.replace(/^immutable:\/\//,"")}))).forEach((e=>s.add(e))),null===t.dereference.refSet&&s.clean(),i.clean(),u}}const pI=e=>{const t=oE(e.meta.get("baseURI")),r=e.meta.get("referencingElement");return new Jx({$ref:t},Cj(r.meta),Cj(r.attributes))},dI=async e=>{const{spec:t,timeout:r,redirects:n,requestInterceptor:s,responseInterceptor:i,pathDiscriminator:o=[],allowMetaPatches:c=!1,useCircularStructures:a=!1,skipNormalization:u=!1,parameterMacro:l=null,modelPropertyMacro:h=null,mode:f="non-strict",strategies:p}=e;try{const{cache:d}=dI,m=p.find((e=>e.match(t))),v=Um(zm())?zm():"https://swagger.io",y=Mt(e),b=Xm(v,y);let g;d.has(t)?g=d.get(t):(g=DT.refract(t),g.classes.push("result"),d.set(t,g));const w=new Yx([g]),x=tO(o),j=""===x?"":`#${x}`,E=rO(x,g),$=new gE({uri:b,value:w}),O=new Qm({refs:[$]});""!==x&&(O.rootRef=void 0);const S=[new Set([E])],A=[],P=((e,t,r)=>new aE({element:r}).transclude(e,t))(E,await PE(E,{resolve:{baseURI:`${b}${j}`,resolvers:[new _F({timeout:r||1e4,redirects:n||10})],resolverOpts:{swaggerHTTPClientConfig:{requestInterceptor:s,responseInterceptor:i}},strategies:[new IF]},parse:{mediaType:sO.latest(),parsers:[new NF({allowEmpty:!1,sourceMap:!1}),new qF({allowEmpty:!1,sourceMap:!1}),new CF({allowEmpty:!1,sourceMap:!1}),new MF({allowEmpty:!1,sourceMap:!1}),new FF({allowEmpty:!1,sourceMap:!1})]},dereference:{maxDepth:100,strategies:[new fI({allowMetaPatches:c,useCircularStructures:a,parameterMacro:l,modelPropertyMacro:h,mode:f,ancestors:S})],refSet:O,dereferenceOpts:{errors:A},immutable:!1,circular:a?"ignore":"replace",circularReplacer:a?ev.dereference.circularReplacer:pI}}),g),T=u?P:m.normalize(P);return{spec:oE(T),errors:A}}catch(e){if(e instanceof W$||e instanceof Z$)return{spec:null,errors:[]};throw e}};dI.cache=new WeakMap;const mI=e=>{if(!uj(e))return e;const t=[ck({operationIdNormalizer:(e,t,r)=>M$({operationId:e},t,r,{v2OperationIdCompatibilityMode:!1})}),rk(),nk(),ak(),uk()];return zj(e,t,{toolboxCreator:qk,visitorOptions:{keyMap:ek,nodeTypeGetter:QT}})},vI={name:"openapi-3-1-apidom",match:e=>U$(e),normalize(e){if(!sj(e)&&em(e)&&!e.$$normalized){const r=(t=mI,e=>{const r=DT.refract(e);r.classes.push("result");const n=t(r),s=oE(n);return dI.cache.set(s,n),oE(n)})(e);return r.$$normalized=!0,r}var t;return sj(e)?mI(e):e},resolve:async e=>dI(e)};function yI(e,t,r){if(!e||"object"!=typeof e||!e.paths||"object"!=typeof e.paths)return null;const{paths:n}=e;for(const s in n)for(const i in n[s]){if("PARAMETERS"===i.toUpperCase())continue;const o=n[s][i];if(!o||"object"!=typeof o)continue;const c={spec:e,pathName:s,method:i.toUpperCase(),operation:o},a=t(c);if(r&&a)return c}}function bI(e,t){return`${t.toLowerCase()}-${e}`}function gI(e,t){return e&&e.paths?function(e,t){return yI(e,t,!0)||null}(e,(({pathName:e,method:r,operation:n})=>{if(!n||"object"!=typeof n)return!1;const s=n.operationId;return[M$(n,e,r),bI(e,r),s].some((e=>e&&e===t))})):null}const{isHttpUrl:wI}=Zm,xI=()=>null,jI={mapTagOperations:function({spec:e,cb:t=xI,defaultTag:r="default",v2OperationIdCompatibilityMode:n}){const s={},i={};return yI(e,(({pathName:o,method:c,operation:a})=>{var u;(a.tags?(u=a.tags,Array.isArray(u)?u:[u]):[r]).forEach((r=>{if("string"!=typeof r)return;i[r]=i[r]||{};const u=i[r],l=M$(a,o,c,{v2OperationIdCompatibilityMode:n}),h=t({spec:e,pathName:o,method:c,operation:a,operationId:l});if(s[l])s[l]+=1,u[`${l}${s[l]}`]=h;else if(void 0!==u[l]){const e=s[l]||1;s[l]=e+1,u[`${l}${s[l]}`]=h;const t=u[l];delete u[l],u[`${l}${e}`]=t}else u[l]=h}))})),i},makeExecute:function(e={}){return({pathName:t,method:r,operationId:n})=>(s,i={})=>{const{requestInterceptor:o,responseInterceptor:c,userFetch:a}=e;return e.execute({spec:e.spec,requestInterceptor:o,responseInterceptor:c,userFetch:a,pathName:t,method:r,parameters:s,operationId:n,...i})}}};var EI={
|
4276 |
|
4277 |
|
4278 |
|
4279 |
|
4280 |
|
4281 |
|
4282 | parse:function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");var r={},n=(t||{}).decode||SI,s=0;for(;s<e.length;){var i=e.indexOf("=",s);if(-1===i)break;var o=e.indexOf(";",s);if(-1===o)o=e.length;else if(o<i){s=e.lastIndexOf(";",i-1)+1;continue}var c=e.slice(s,i).trim();if(void 0===r[c]){var a=e.slice(i+1,o).trim();34===a.charCodeAt(0)&&(a=a.slice(1,-1)),r[c]=PI(a,n)}s=o+1}return r},serialize:function(e,t,r){var n=r||{},s=n.encode||AI;if("function"!=typeof s)throw new TypeError("option encode is invalid");if(!OI.test(e))throw new TypeError("argument name is invalid");var i=s(t);if(i&&!OI.test(i))throw new TypeError("argument val is invalid");var o=e+"="+i;if(null!=n.maxAge){var c=n.maxAge-0;if(isNaN(c)||!isFinite(c))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(c)}if(n.domain){if(!OI.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!OI.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){var a=n.expires;if(!function(e){return"[object Date]"===$I.call(e)||e instanceof Date}(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");o+="; Expires="+a.toUTCString()}n.httpOnly&&(o+="; HttpOnly");n.secure&&(o+="; Secure");n.partitioned&&(o+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():n.priority){case"low":o+="; Priority=Low";break;case"medium":o+="; Priority=Medium";break;case"high":o+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}},$I=Object.prototype.toString,OI=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function SI(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function AI(e){return encodeURIComponent(e)}function PI(e,t){try{return t(e)}catch(t){return e}}const TI=function(){const e=II,t=FI,r=this,n="parser.js: Parser(): ";r.ast=void 0,r.stats=void 0,r.trace=void 0,r.callbacks=[];let s,i,o,c,a,u,l,h=0,f=0,p=0,d=0,m=0,v=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};r.parse=(y,b,w,x)=>{const j=`${n}parse(): `;h=0,f=0,p=0,d=0,m=0,s=void 0,i=void 0,o=void 0,c=void 0,v.refresh(),a=void 0,u=void 0,l=void 0,c=t.stringToChars(w),s=y.rules,i=y.udts;const E=b.toLowerCase();let $;for(const e in s)if(s.hasOwnProperty(e)&&E===s[e].lower){$=s[e].index;break}if(void 0===$)throw new Error(`${j}start rule name '${startRule}' not recognized`);(()=>{const e=`${n}initializeCallbacks(): `;let t,o;for(a=[],u=[],t=0;t<s.length;t+=1)a[t]=void 0;for(t=0;t<i.length;t+=1)u[t]=void 0;const c=[];for(t=0;t<s.length;t+=1)c.push(s[t].lower);for(t=0;t<i.length;t+=1)c.push(i[t].lower);for(const n in r.callbacks)if(r.callbacks.hasOwnProperty(n)){if(t=c.indexOf(n.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${n}' not a rule or udt name`);if(o=r.callbacks[n]?r.callbacks[n]:void 0,"function"!=typeof o&&void 0!==o)throw new Error(`${e}syntax callback[${n}] must be function reference or falsy)`);t<s.length?a[t]=o:u[t-s.length]=o}})(),r.trace&&r.trace.init(s,i,c),r.stats&&r.stats.init(s,i),r.ast&&r.ast.init(s,i,c),l=x,o=[{type:e.RNM,index:$}],g(0,0),o=void 0;let O=!1;switch(v.state){case e.ACTIVE:throw new Error(`${j}final state should never be 'ACTIVE'`);case e.NOMATCH:O=!1;break;case e.EMPTY:case e.MATCH:O=v.phraseLength===c.length;break;default:throw new Error("unrecognized state")}return{success:O,state:v.state,stateName:e.idName(v.state),length:c.length,matched:v.phraseLength,maxMatched:m,maxTreeDepth:p,nodeHits:d}};const y=(t,r,s,i)=>{if(r.phraseLength>s){let e=`${n}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:if(!i)throw new Error(`${n}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:r.phraseLength=0;break;case e.MATCH:0===r.phraseLength&&(r.state=e.EMPTY);break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}},b=(t,a)=>{let f,p,d;const m=o[t],y=i[m.index];v.UdtIndex=y.index,h||(d=r.ast&&r.ast.udtDefined(m.index),d&&(p=s.length+m.index,f=r.ast.getLength(),r.ast.down(p,y.name)));const b=c.length-a;u[m.index](v,c,a,l),((t,r,s)=>{if(r.phraseLength>s){let e=`${n}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:throw new Error(`${n}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.phraseLength=0;break;case e.MATCH:if(0===r.phraseLength){if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.state=e.EMPTY}break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}})(y,v,b),h||d&&(v.state===e.NOMATCH?r.ast.setLength(f):r.ast.up(p,y.name,a,v.phraseLength))},g=(t,i)=>{const u=`${n}opExecute(): `,w=o[t];switch(d+=1,f>p&&(p=f),f+=1,v.refresh(),r.trace&&r.trace.down(w,i),w.type){case e.ALT:((t,r)=>{const n=o[t];for(let t=0;t<n.children.length&&(g(n.children[t],r),v.state===e.NOMATCH);t+=1);})(t,i);break;case e.CAT:((t,n)=>{let s,i,c,a;const u=o[t];r.ast&&(i=r.ast.getLength()),s=!0,c=n,a=0;for(let t=0;t<u.children.length;t+=1){if(g(u.children[t],c),v.state===e.NOMATCH){s=!1;break}c+=v.phraseLength,a+=v.phraseLength}s?(v.state=0===a?e.EMPTY:e.MATCH,v.phraseLength=a):(v.state=e.NOMATCH,v.phraseLength=0,r.ast&&r.ast.setLength(i))})(t,i);break;case e.REP:((t,n)=>{let s,i,a,u;const l=o[t];if(0===l.max)return v.state=e.EMPTY,void(v.phraseLength=0);for(i=n,a=0,u=0,r.ast&&(s=r.ast.getLength());!(i>=c.length)&&(g(t+1,i),v.state!==e.NOMATCH)&&v.state!==e.EMPTY&&(u+=1,a+=v.phraseLength,i+=v.phraseLength,u!==l.max););v.state===e.EMPTY||u>=l.min?(v.state=0===a?e.EMPTY:e.MATCH,v.phraseLength=a):(v.state=e.NOMATCH,v.phraseLength=0,r.ast&&r.ast.setLength(s))})(t,i);break;case e.RNM:((t,n)=>{let i,u,f;const p=o[t],d=s[p.index],m=a[d.index];if(h||(u=r.ast&&r.ast.ruleDefined(p.index),u&&(i=r.ast.getLength(),r.ast.down(p.index,s[p.index].name))),m){const t=c.length-n;m(v,c,n,l),y(d,v,t,!0),v.state===e.ACTIVE&&(f=o,o=d.opcodes,g(0,n),o=f,m(v,c,n,l),y(d,v,t,!1))}else f=o,o=d.opcodes,g(0,n),o=f;h||u&&(v.state===e.NOMATCH?r.ast.setLength(i):r.ast.up(p.index,d.name,n,v.phraseLength))})(t,i);break;case e.TRG:((t,r)=>{const n=o[t];v.state=e.NOMATCH,r<c.length&&n.min<=c[r]&&c[r]<=n.max&&(v.state=e.MATCH,v.phraseLength=1)})(t,i);break;case e.TBS:((t,r)=>{const n=o[t],s=n.string.length;if(v.state=e.NOMATCH,r+s<=c.length){for(let e=0;e<s;e+=1)if(c[r+e]!==n.string[e])return;v.state=e.MATCH,v.phraseLength=s}})(t,i);break;case e.TLS:((t,r)=>{let n;const s=o[t];v.state=e.NOMATCH;const i=s.string.length;if(0!==i){if(r+i<=c.length){for(let e=0;e<i;e+=1)if(n=c[r+e],n>=65&&n<=90&&(n+=32),n!==s.string[e])return;v.state=e.MATCH,v.phraseLength=i}}else v.state=e.EMPTY})(t,i);break;case e.UDT:b(t,i);break;case e.AND:((t,r)=>{switch(h+=1,g(t+1,r),h-=1,v.phraseLength=0,v.state){case e.EMPTY:case e.MATCH:v.state=e.EMPTY;break;case e.NOMATCH:v.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${v.state}`)}})(t,i);break;case e.NOT:((t,r)=>{switch(h+=1,g(t+1,r),h-=1,v.phraseLength=0,v.state){case e.EMPTY:case e.MATCH:v.state=e.NOMATCH;break;case e.NOMATCH:v.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${v.state}`)}})(t,i);break;default:throw new Error(`${u}unrecognized operator`)}h||i+v.phraseLength>m&&(m=i+v.phraseLength),r.stats&&r.stats.collect(w,v),r.trace&&r.trace.up(w,v.state,i,v.phraseLength),f-=1}},kI=function(){const e=II,t=FI,r=this;let n,s,i,o=0;const c=[],a=[],u=[];function l(e){let t="";for(;e-- >0;)t+=" ";return t}r.callbacks=[],r.init=(e,t,l)=>{let h;a.length=0,u.length=0,o=0,n=e,s=t,i=l;const f=[];for(h=0;h<n.length;h+=1)f.push(n[h].lower);for(h=0;h<s.length;h+=1)f.push(s[h].lower);for(o=n.length+s.length,h=0;h<o;h+=1)c[h]=void 0;for(const e in r.callbacks)if(r.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(h=f.indexOf(t),h<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);c[h]=r.callbacks[e]}},r.ruleDefined=e=>!!c[e],r.udtDefined=e=>!!c[n.length+e],r.down=(t,r)=>{const n=u.length;return a.push(n),u.push({name:r,thisIndex:n,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:a.length}),n},r.up=(t,r,n,s)=>{const i=u.length,o=a.pop();return u.push({name:r,thisIndex:i,thatIndex:o,state:e.SEM_POST,callbackIndex:t,phraseIndex:n,phraseLength:s,stack:a.length}),u[o].thatIndex=i,u[o].phraseIndex=n,u[o].phraseLength=s,i},r.translate=t=>{let r,n;for(let s=0;s<u.length;s+=1)n=u[s],r=c[n.callbackIndex],r&&(n.state===e.SEM_PRE?r(e.SEM_PRE,i,n.phraseIndex,n.phraseLength,t):r&&r(e.SEM_POST,i,n.phraseIndex,n.phraseLength,t))},r.setLength=e=>{u.length=e,a.length=e>0?u[e-1].stack:0},r.getLength=()=>u.length,r.toXml=()=>{let r="",n=0;return r+='<?xml version="1.0" encoding="utf-8"?>\n',r+=`<root nodes="${u.length/2}" characters="${i.length}">\n`,r+="\x3c!-- input string --\x3e\n",r+=l(n+2),r+=t.charsToString(i),r+="\n",u.forEach((s=>{s.state===e.SEM_PRE?(n+=1,r+=l(n),r+=`<node name="${s.name}" index="${s.phraseIndex}" length="${s.phraseLength}">\n`,r+=l(n+2),r+=t.charsToString(i,s.phraseIndex,s.phraseLength),r+="\n"):(r+=l(n),r+=`</node>\x3c!-- name="${s.name}" --\x3e\n`,n-=1)})),r+="</root>\n",r}},FI={stringToChars:e=>[...e].map((e=>e.codePointAt(0))),charsToString:(e,t,r)=>{let n=e;for(;!(void 0===t||t<0);){if(void 0===r){n=e.slice(t);break}if(r<=0)return"";n=e.slice(t,t+r);break}return String.fromCodePoint(...n)}},II={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case II.ALT:return"ALT";case II.CAT:return"CAT";case II.REP:return"REP";case II.RNM:return"RNM";case II.TRG:return"TRG";case II.TBS:return"TBS";case II.TLS:return"TLS";case II.UDT:return"UDT";case II.AND:return"AND";case II.NOT:return"NOT";case II.ACTIVE:return"ACTIVE";case II.EMPTY:return"EMPTY";case II.MATCH:return"MATCH";case II.NOMATCH:return"NOMATCH";case II.SEM_PRE:return"SEM_PRE";case II.SEM_POST:return"SEM_POST";case II.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}},RI=(e,t,r,n,s)=>{if(e===II.SEM_PRE){if(!1===Array.isArray(s))throw new Error("parser's user data must be an array");s.push(["server-url-template",FI.charsToString(t,r,n)])}return II.SEM_OK},DI=(e,t,r,n,s)=>{if(e===II.SEM_PRE){if(!1===Array.isArray(s))throw new Error("parser's user data must be an array");s.push(["server-variable",FI.charsToString(t,r,n)])}return II.SEM_OK},_I=(e,t,r,n,s)=>{if(e===II.SEM_PRE){if(!1===Array.isArray(s))throw new Error("parser's user data must be an array");s.push(["server-variable-name",FI.charsToString(t,r,n)])}return II.SEM_OK},CI=(e,t,r,n,s)=>{if(e===II.SEM_PRE){if(!1===Array.isArray(s))throw new Error("parser's user data must be an array");s.push(["literals",FI.charsToString(t,r,n)])}return II.SEM_OK},MI=new function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"server-url-template",lower:"server-url-template",index:0,isBkr:!1},this.rules[1]={name:"server-variable",lower:"server-variable",index:1,isBkr:!1},this.rules[2]={name:"server-variable-name",lower:"server-variable-name",index:2,isBkr:!1},this.rules[3]={name:"literals",lower:"literals",index:3,isBkr:!1},this.rules[4]={name:"ALPHA",lower:"alpha",index:4,isBkr:!1},this.rules[5]={name:"DIGIT",lower:"digit",index:5,isBkr:!1},this.rules[6]={name:"HEXDIG",lower:"hexdig",index:6,isBkr:!1},this.rules[7]={name:"pct-encoded",lower:"pct-encoded",index:7,isBkr:!1},this.rules[8]={name:"unreserved",lower:"unreserved",index:8,isBkr:!1},this.rules[9]={name:"sub-delims",lower:"sub-delims",index:9,isBkr:!1},this.rules[10]={name:"ucschar",lower:"ucschar",index:10,isBkr:!1},this.rules[11]={name:"iprivate",lower:"iprivate",index:11,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:1,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:3},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2,3]},this.rules[1].opcodes[1]={type:7,string:[123]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:7,string:[125]},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:1,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3,4,5,6]},this.rules[2].opcodes[2]={type:4,index:8},this.rules[2].opcodes[3]={type:4,index:7},this.rules[2].opcodes[4]={type:4,index:9},this.rules[2].opcodes[5]={type:7,string:[58]},this.rules[2].opcodes[6]={type:7,string:[64]},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3,4,5,6,7,8,9,10,11,12,13,14]},this.rules[3].opcodes[2]={type:6,string:[33]},this.rules[3].opcodes[3]={type:5,min:35,max:36},this.rules[3].opcodes[4]={type:6,string:[38]},this.rules[3].opcodes[5]={type:5,min:40,max:59},this.rules[3].opcodes[6]={type:6,string:[61]},this.rules[3].opcodes[7]={type:5,min:63,max:91},this.rules[3].opcodes[8]={type:6,string:[93]},this.rules[3].opcodes[9]={type:6,string:[95]},this.rules[3].opcodes[10]={type:5,min:97,max:122},this.rules[3].opcodes[11]={type:6,string:[126]},this.rules[3].opcodes[12]={type:4,index:10},this.rules[3].opcodes[13]={type:4,index:11},this.rules[3].opcodes[14]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:5,min:65,max:90},this.rules[4].opcodes[2]={type:5,min:97,max:122},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:5,min:48,max:57},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[6].opcodes[1]={type:4,index:5},this.rules[6].opcodes[2]={type:7,string:[97]},this.rules[6].opcodes[3]={type:7,string:[98]},this.rules[6].opcodes[4]={type:7,string:[99]},this.rules[6].opcodes[5]={type:7,string:[100]},this.rules[6].opcodes[6]={type:7,string:[101]},this.rules[6].opcodes[7]={type:7,string:[102]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:2,children:[1,2,3]},this.rules[7].opcodes[1]={type:7,string:[37]},this.rules[7].opcodes[2]={type:4,index:6},this.rules[7].opcodes[3]={type:4,index:6},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:1,children:[1,2,3,4,5,6]},this.rules[8].opcodes[1]={type:4,index:4},this.rules[8].opcodes[2]={type:4,index:5},this.rules[8].opcodes[3]={type:7,string:[45]},this.rules[8].opcodes[4]={type:7,string:[46]},this.rules[8].opcodes[5]={type:7,string:[95]},this.rules[8].opcodes[6]={type:7,string:[126]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11]},this.rules[9].opcodes[1]={type:7,string:[33]},this.rules[9].opcodes[2]={type:7,string:[36]},this.rules[9].opcodes[3]={type:7,string:[38]},this.rules[9].opcodes[4]={type:7,string:[39]},this.rules[9].opcodes[5]={type:7,string:[40]},this.rules[9].opcodes[6]={type:7,string:[41]},this.rules[9].opcodes[7]={type:7,string:[42]},this.rules[9].opcodes[8]={type:7,string:[43]},this.rules[9].opcodes[9]={type:7,string:[44]},this.rules[9].opcodes[10]={type:7,string:[59]},this.rules[9].opcodes[11]={type:7,string:[61]},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]},this.rules[10].opcodes[1]={type:5,min:160,max:55295},this.rules[10].opcodes[2]={type:5,min:63744,max:64975},this.rules[10].opcodes[3]={type:5,min:65008,max:65519},this.rules[10].opcodes[4]={type:5,min:65536,max:131069},this.rules[10].opcodes[5]={type:5,min:131072,max:196605},this.rules[10].opcodes[6]={type:5,min:196608,max:262141},this.rules[10].opcodes[7]={type:5,min:262144,max:327677},this.rules[10].opcodes[8]={type:5,min:327680,max:393213},this.rules[10].opcodes[9]={type:5,min:393216,max:458749},this.rules[10].opcodes[10]={type:5,min:458752,max:524285},this.rules[10].opcodes[11]={type:5,min:524288,max:589821},this.rules[10].opcodes[12]={type:5,min:589824,max:655357},this.rules[10].opcodes[13]={type:5,min:655360,max:720893},this.rules[10].opcodes[14]={type:5,min:720896,max:786429},this.rules[10].opcodes[15]={type:5,min:786432,max:851965},this.rules[10].opcodes[16]={type:5,min:851968,max:917501},this.rules[10].opcodes[17]={type:5,min:921600,max:983037},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:1,children:[1,2,3]},this.rules[11].opcodes[1]={type:5,min:57344,max:63743},this.rules[11].opcodes[2]={type:5,min:983040,max:1048573},this.rules[11].opcodes[3]={type:5,min:1048576,max:1114109},this.toString=function(){let e="";return e+="; OpenAPI Server URL templating ABNF syntax\n",e+="server-url-template = 1*( literals / server-variable )\n",e+='server-variable = "{" server-variable-name "}"\n',e+='server-variable-name = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" )\n',e+="literals = 1*( %x21 / %x23-24 / %x26 / %x28-3B / %x3D / %x3F-5B\n",e+=" / %x5D / %x5F / %x61-7A / %x7E / ucschar / iprivate\n",e+=" / pct-encoded)\n",e+=" ; any Unicode character except: CTL, SP,\n",e+=' ; DQUOTE, "\'", "%" (aside from pct-encoded),\n',e+=' ; "<", ">", "\\", "^", "`", "{", "|", "}"\n',e+="\n",e+="; Characters definitions (from RFC 6570)\n",e+="ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n",e+="DIGIT = %x30-39 ; 0-9\n",e+='HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n',e+=" ; case-insensitive\n",e+="\n",e+='pct-encoded = "%" HEXDIG HEXDIG\n',e+='unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\n',e+='sub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n',e+=' / "*" / "+" / "," / ";" / "="\n',e+="\n",e+="ucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF\n",e+=" / %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD\n",e+=" / %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD\n",e+=" / %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD\n",e+=" / %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD\n",e+=" / %xD0000-DFFFD / %xE1000-EFFFD\n",e+="\n",e+="iprivate = %xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD\n",'; OpenAPI Server URL templating ABNF syntax\nserver-url-template = 1*( literals / server-variable )\nserver-variable = "{" server-variable-name "}"\nserver-variable-name = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" )\nliterals = 1*( %x21 / %x23-24 / %x26 / %x28-3B / %x3D / %x3F-5B\n / %x5D / %x5F / %x61-7A / %x7E / ucschar / iprivate\n / pct-encoded)\n ; any Unicode character except: CTL, SP,\n ; DQUOTE, "\'", "%" (aside from pct-encoded),\n ; "<", ">", "\\", "^", "`", "{", "|", "}"\n\n; Characters definitions (from RFC 6570)\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\nDIGIT = %x30-39 ; 0-9\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n ; case-insensitive\n\npct-encoded = "%" HEXDIG HEXDIG\nunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\nsub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n / "*" / "+" / "," / ";" / "="\n\nucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF\n / %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD\n / %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD\n / %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD\n / %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD\n / %xD0000-DFFFD / %xE1000-EFFFD\n\niprivate = %xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD\n'}},NI=e=>{const t=new TI;t.ast=new kI,t.ast.callbacks["server-url-template"]=RI,t.ast.callbacks["server-variable"]=DI,t.ast.callbacks["server-variable-name"]=_I,t.ast.callbacks.literals=CI;return{result:t.parse(MI,"server-url-template",e),ast:t.ast}},qI=e=>(e=>{try{return"string"==typeof e&&decodeURIComponent(e)!==e}catch{return!1}})(e)?e:encodeURIComponent(e).replace(/%5B/g,"[").replace(/%5D/g,"]"),BI=["literals","server-variable-name"];const LI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["slash",FI.charsToString(t,r,n)]),II.SEM_OK),UI=(e,t,r,n,s)=>{if(e===II.SEM_PRE){if(!1===Array.isArray(s))throw new Error("parser's user data must be an array");s.push(["path-template",FI.charsToString(t,r,n)])}return II.SEM_OK},JI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["path",FI.charsToString(t,r,n)]),II.SEM_OK),VI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["path-literal",FI.charsToString(t,r,n)]),II.SEM_OK),GI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["query",FI.charsToString(t,r,n)]),II.SEM_OK),HI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["query-marker",FI.charsToString(t,r,n)]),II.SEM_OK),zI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["fragment",FI.charsToString(t,r,n)]),II.SEM_OK),XI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["fragment-marker",FI.charsToString(t,r,n)]),II.SEM_OK),WI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["template-expression",FI.charsToString(t,r,n)]),II.SEM_OK),YI=(e,t,r,n,s)=>(e===II.SEM_PRE&&s.push(["template-expression-param-name",FI.charsToString(t,r,n)]),II.SEM_OK),ZI=new function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"path-template",lower:"path-template",index:0,isBkr:!1},this.rules[1]={name:"path",lower:"path",index:1,isBkr:!1},this.rules[2]={name:"path-segment",lower:"path-segment",index:2,isBkr:!1},this.rules[3]={name:"query",lower:"query",index:3,isBkr:!1},this.rules[4]={name:"query-literal",lower:"query-literal",index:4,isBkr:!1},this.rules[5]={name:"query-marker",lower:"query-marker",index:5,isBkr:!1},this.rules[6]={name:"fragment",lower:"fragment",index:6,isBkr:!1},this.rules[7]={name:"fragment-literal",lower:"fragment-literal",index:7,isBkr:!1},this.rules[8]={name:"fragment-marker",lower:"fragment-marker",index:8,isBkr:!1},this.rules[9]={name:"slash",lower:"slash",index:9,isBkr:!1},this.rules[10]={name:"path-literal",lower:"path-literal",index:10,isBkr:!1},this.rules[11]={name:"template-expression",lower:"template-expression",index:11,isBkr:!1},this.rules[12]={name:"template-expression-param-name",lower:"template-expression-param-name",index:12,isBkr:!1},this.rules[13]={name:"unreserved",lower:"unreserved",index:13,isBkr:!1},this.rules[14]={name:"pct-encoded",lower:"pct-encoded",index:14,isBkr:!1},this.rules[15]={name:"sub-delims",lower:"sub-delims",index:15,isBkr:!1},this.rules[16]={name:"ALPHA",lower:"alpha",index:16,isBkr:!1},this.rules[17]={name:"DIGIT",lower:"digit",index:17,isBkr:!1},this.rules[18]={name:"HEXDIG",lower:"hexdig",index:18,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2,6]},this.rules[0].opcodes[1]={type:4,index:1},this.rules[0].opcodes[2]={type:3,min:0,max:1},this.rules[0].opcodes[3]={type:2,children:[4,5]},this.rules[0].opcodes[4]={type:4,index:5},this.rules[0].opcodes[5]={type:4,index:3},this.rules[0].opcodes[6]={type:3,min:0,max:1},this.rules[0].opcodes[7]={type:2,children:[8,9]},this.rules[0].opcodes[8]={type:4,index:8},this.rules[0].opcodes[9]={type:4,index:6},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2,6]},this.rules[1].opcodes[1]={type:4,index:9},this.rules[1].opcodes[2]={type:3,min:0,max:1/0},this.rules[1].opcodes[3]={type:2,children:[4,5]},this.rules[1].opcodes[4]={type:4,index:2},this.rules[1].opcodes[5]={type:4,index:9},this.rules[1].opcodes[6]={type:3,min:0,max:1},this.rules[1].opcodes[7]={type:4,index:2},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:1,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3]},this.rules[2].opcodes[2]={type:4,index:10},this.rules[2].opcodes[3]={type:4,index:11},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:0,max:1/0},this.rules[3].opcodes[1]={type:4,index:4},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:3,min:1,max:1/0},this.rules[4].opcodes[1]={type:1,children:[2,3,4,5,6,7,8,9,10]},this.rules[4].opcodes[2]={type:4,index:13},this.rules[4].opcodes[3]={type:4,index:14},this.rules[4].opcodes[4]={type:4,index:15},this.rules[4].opcodes[5]={type:7,string:[58]},this.rules[4].opcodes[6]={type:7,string:[64]},this.rules[4].opcodes[7]={type:7,string:[47]},this.rules[4].opcodes[8]={type:7,string:[63]},this.rules[4].opcodes[9]={type:7,string:[38]},this.rules[4].opcodes[10]={type:7,string:[61]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:7,string:[63]},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:0,max:1/0},this.rules[6].opcodes[1]={type:4,index:7},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:3,min:1,max:1/0},this.rules[7].opcodes[1]={type:1,children:[2,3,4,5,6,7,8]},this.rules[7].opcodes[2]={type:4,index:13},this.rules[7].opcodes[3]={type:4,index:14},this.rules[7].opcodes[4]={type:4,index:15},this.rules[7].opcodes[5]={type:7,string:[58]},this.rules[7].opcodes[6]={type:7,string:[64]},this.rules[7].opcodes[7]={type:7,string:[47]},this.rules[7].opcodes[8]={type:7,string:[63]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:7,string:[35]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:7,string:[47]},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:3,min:1,max:1/0},this.rules[10].opcodes[1]={type:1,children:[2,3,4,5,6]},this.rules[10].opcodes[2]={type:4,index:13},this.rules[10].opcodes[3]={type:4,index:14},this.rules[10].opcodes[4]={type:4,index:15},this.rules[10].opcodes[5]={type:7,string:[58]},this.rules[10].opcodes[6]={type:7,string:[64]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:2,children:[1,2,3]},this.rules[11].opcodes[1]={type:7,string:[123]},this.rules[11].opcodes[2]={type:4,index:12},this.rules[11].opcodes[3]={type:7,string:[125]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:3,min:1,max:1/0},this.rules[12].opcodes[1]={type:1,children:[2,3,4,5,6]},this.rules[12].opcodes[2]={type:4,index:13},this.rules[12].opcodes[3]={type:4,index:14},this.rules[12].opcodes[4]={type:4,index:15},this.rules[12].opcodes[5]={type:7,string:[58]},this.rules[12].opcodes[6]={type:7,string:[64]},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:1,children:[1,2,3,4,5,6]},this.rules[13].opcodes[1]={type:4,index:16},this.rules[13].opcodes[2]={type:4,index:17},this.rules[13].opcodes[3]={type:7,string:[45]},this.rules[13].opcodes[4]={type:7,string:[46]},this.rules[13].opcodes[5]={type:7,string:[95]},this.rules[13].opcodes[6]={type:7,string:[126]},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2,3]},this.rules[14].opcodes[1]={type:7,string:[37]},this.rules[14].opcodes[2]={type:4,index:18},this.rules[14].opcodes[3]={type:4,index:18},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11]},this.rules[15].opcodes[1]={type:7,string:[33]},this.rules[15].opcodes[2]={type:7,string:[36]},this.rules[15].opcodes[3]={type:7,string:[38]},this.rules[15].opcodes[4]={type:7,string:[39]},this.rules[15].opcodes[5]={type:7,string:[40]},this.rules[15].opcodes[6]={type:7,string:[41]},this.rules[15].opcodes[7]={type:7,string:[42]},this.rules[15].opcodes[8]={type:7,string:[43]},this.rules[15].opcodes[9]={type:7,string:[44]},this.rules[15].opcodes[10]={type:7,string:[59]},this.rules[15].opcodes[11]={type:7,string:[61]},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:1,children:[1,2]},this.rules[16].opcodes[1]={type:5,min:65,max:90},this.rules[16].opcodes[2]={type:5,min:97,max:122},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:5,min:48,max:57},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[18].opcodes[1]={type:4,index:17},this.rules[18].opcodes[2]={type:7,string:[97]},this.rules[18].opcodes[3]={type:7,string:[98]},this.rules[18].opcodes[4]={type:7,string:[99]},this.rules[18].opcodes[5]={type:7,string:[100]},this.rules[18].opcodes[6]={type:7,string:[101]},this.rules[18].opcodes[7]={type:7,string:[102]},this.toString=function(){let e="";return e+="; OpenAPI Path Templating ABNF syntax\n",e+="path-template = path [ query-marker query ] [ fragment-marker fragment ]\n",e+="path = slash *( path-segment slash ) [ path-segment ]\n",e+="path-segment = 1*( path-literal / template-expression )\n",e+="query = *( query-literal )\n",e+='query-literal = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" / "/" / "?" / "&" / "=" )\n',e+='query-marker = "?"\n',e+="fragment = *( fragment-literal )\n",e+='fragment-literal = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" / "/" / "?" )\n',e+='fragment-marker = "#"\n',e+='slash = "/"\n',e+='path-literal = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" )\n',e+='template-expression = "{" template-expression-param-name "}"\n',e+='template-expression-param-name = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" )\n',e+="\n",e+="; Characters definitions (from RFC 3986)\n",e+='unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\n',e+='pct-encoded = "%" HEXDIG HEXDIG\n',e+='sub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n',e+=' / "*" / "+" / "," / ";" / "="\n',e+="ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n",e+="DIGIT = %x30-39 ; 0-9\n",e+='HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n','; OpenAPI Path Templating ABNF syntax\npath-template = path [ query-marker query ] [ fragment-marker fragment ]\npath = slash *( path-segment slash ) [ path-segment ]\npath-segment = 1*( path-literal / template-expression )\nquery = *( query-literal )\nquery-literal = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" / "/" / "?" / "&" / "=" )\nquery-marker = "?"\nfragment = *( fragment-literal )\nfragment-literal = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" / "/" / "?" )\nfragment-marker = "#"\nslash = "/"\npath-literal = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" )\ntemplate-expression = "{" template-expression-param-name "}"\ntemplate-expression-param-name = 1*( unreserved / pct-encoded / sub-delims / ":" / "@" )\n\n; Characters definitions (from RFC 3986)\nunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"\npct-encoded = "%" HEXDIG HEXDIG\nsub-delims = "!" / "$" / "&" / "\'" / "(" / ")"\n / "*" / "+" / "," / ";" / "="\nALPHA = %x41-5A / %x61-7A ; A-Z / a-z\nDIGIT = %x30-39 ; 0-9\nHEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"\n'}},KI=e=>{const t=new TI;t.ast=new kI,t.ast.callbacks["path-template"]=UI,t.ast.callbacks.path=JI,t.ast.callbacks.query=GI,t.ast.callbacks["query-marker"]=HI,t.ast.callbacks.fragment=zI,t.ast.callbacks["fragment-marker"]=XI,t.ast.callbacks.slash=LI,t.ast.callbacks["path-literal"]=VI,t.ast.callbacks["template-expression"]=WI,t.ast.callbacks["template-expression-param-name"]=YI;return{result:t.parse(ZI,"path-template",e),ast:t.ast}},QI=e=>(e=>{try{return"string"==typeof e&&decodeURIComponent(e)!==e}catch{return!1}})(e)?e:encodeURIComponent(e).replace(/%5B/g,"[").replace(/%5D/g,"]"),eR=["slash","path-literal","query-marker","query-literal","template-expression-param-name"],tR=(e,t,r={})=>{const n={...{encoder:QI},...r},s=KI(e);if(!s.result.success)return e;const i=[];s.ast.translate(i);const o=i.filter((([e])=>eR.includes(e))).map((([e,r])=>"template-expression-param-name"===e?Object.hasOwn(t,r)?n.encoder(t[r],r):`{${r}}`:r));return o.join("")},rR={body:function({req:e,value:t}){void 0!==t&&(e.body=t)},header:function({req:e,parameter:t,value:r}){e.headers=e.headers||{},void 0!==r&&(e.headers[t.name]=r)},query:function({req:e,value:t,parameter:r}){e.query=e.query||{},!1===t&&"boolean"===r.type&&(t="false");0===t&&["number","integer"].indexOf(r.type)>-1&&(t="0");if(t)e.query[r.name]={collectionFormat:r.collectionFormat,value:t};else if(r.allowEmptyValue&&void 0!==t){const t=r.name;e.query[t]=e.query[t]||{},e.query[t].allowEmptyValue=!0}},path:function({req:e,value:t,parameter:r,baseURL:n}){if(void 0!==t){const s=e.url.replace(n,""),i=tR(s,{[r.name]:t});e.url=n+i}},formData:function({req:e,value:t,parameter:r}){!1===t&&"boolean"===r.type&&(t="false");0===t&&["number","integer"].indexOf(r.type)>-1&&(t="0");if(t)e.form=e.form||{},e.form[r.name]={collectionFormat:r.collectionFormat,value:t};else if(r.allowEmptyValue&&void 0!==t){e.form=e.form||{};const t=r.name;e.form[t]=e.form[t]||{},e.form[t].allowEmptyValue=!0}}};function nR(e,t){return t.includes("application/json")?"string"==typeof e?e:(Array.isArray(e)&&(e=e.map((e=>{try{return JSON.parse(e)}catch(t){return e}}))),JSON.stringify(e)):String(e)}const sR=["accept","authorization","content-type"];const iR=Object.freeze(Object.defineProperty({__proto__:null,cookie:function({req:e,parameter:t,value:r}){e.headers=e.headers||{};const n=typeof r;if(void 0!==r&&t.content){const n=Object.keys(t.content)[0];e.headers.Cookie=`${t.name}=${nR(r,n)}`}else if(void 0!==r&&(!Array.isArray(r)||0!==r.length)){const s="object"===n&&!Array.isArray(r)&&t.explode?"":`${t.name}=`;e.headers.Cookie=s+openapi_parser_f({key:t.name,value:r,escape:!1,style:t.style||"form",explode:void 0!==t.explode&&t.explode})}},header:function({req:e,parameter:t,value:r}){if(e.headers=e.headers||{},!(sR.indexOf(t.name.toLowerCase())>-1))if(void 0!==r&&t.content){const n=Object.keys(t.content)[0];e.headers[t.name]=nR(r,n)}else void 0===r||Array.isArray(r)&&0===r.length||(e.headers[t.name]=openapi_parser_f({key:t.name,value:r,style:t.style||"simple",explode:void 0!==t.explode&&t.explode,escape:!1}))},path:function({req:e,value:t,parameter:r,baseURL:n}){const{name:s,style:i,explode:o,content:c}=r;if(void 0===t)return;const a=e.url.replace(n,"");let u;if(c){const e=Object.keys(c)[0];u=tR(a,{[s]:t},{encoder:t=>openapi_parser_h(nR(t,e))})}else u=tR(a,{[s]:t},{encoder:e=>openapi_parser_f({key:r.name,value:e,style:i||"simple",explode:o||!1,escape:"reserved"})});e.url=n+u},query:function({req:e,value:t,parameter:r}){if(e.query=e.query||{},void 0!==t&&r.content){const n=nR(t,Object.keys(r.content)[0]);if(n)e.query[r.name]=n;else if(r.allowEmptyValue){const t=r.name;e.query[t]=e.query[t]||{},e.query[t].allowEmptyValue=!0}}else if(!1===t&&(t="false"),0===t&&(t="0"),t){const{style:n,explode:s,allowReserved:i}=r;e.query[r.name]={value:t,serializationOption:{style:n,explode:s,allowReserved:i}}}else if(r.allowEmptyValue&&void 0!==t){const t=r.name;e.query[t]=e.query[t]||{},e.query[t].allowEmptyValue=!0}}},Symbol.toStringTag,{value:"Module"})),oR="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window,{btoa:cR}=oR;function aR(e,t){const{operation:r,requestBody:n,securities:s,spec:i,attachContentTypeForEmptyPayload:o}=e;let{requestContentType:c}=e;t=function({request:e,securities:t={},operation:r={},spec:n}){var s;const i={...e},{authorized:o={}}=t,c=r.security||n.security||[],a=o&&!!Object.keys(o).length,u=(null==n||null===(s=n.components)||void 0===s?void 0:s.securitySchemes)||{};if(i.headers=i.headers||{},i.query=i.query||{},!Object.keys(t).length||!a||!c||Array.isArray(r.security)&&!r.security.length)return e;return c.forEach((e=>{Object.keys(e).forEach((e=>{const t=o[e],r=u[e];if(!t)return;const n=t.value||t,{type:s}=r;if(t)if("apiKey"===s)"query"===r.in&&(i.query[r.name]=n),"header"===r.in&&(i.headers[r.name]=n),"cookie"===r.in&&(i.cookies[r.name]=n);else if("http"===s){if(/^basic$/i.test(r.scheme)){const e=n.username||"",t=n.password||"",r=cR(`${e}:${t}`);i.headers.Authorization=`Basic ${r}`}/^bearer$/i.test(r.scheme)&&(i.headers.Authorization=`Bearer ${n}`)}else if("oauth2"===s||"openIdConnect"===s){const e=t.token||{},n=e[r["x-tokenName"]||"access_token"];let s=e.token_type;s&&"bearer"!==s.toLowerCase()||(s="Bearer"),i.headers.Authorization=`${s} ${n}`}}))})),i}({request:t,securities:s,operation:r,spec:i});const a=r.requestBody||{},u=Object.keys(a.content||{}),l=c&&u.indexOf(c)>-1;if(n||o){if(c&&l)t.headers["Content-Type"]=c;else if(!c){const e=u[0];e&&(t.headers["Content-Type"]=e,c=e)}}else c&&l&&(t.headers["Content-Type"]=c);if(!e.responseContentType&&r.responses){const e=Object.entries(r.responses).filter((([e,t])=>{const r=parseInt(e,10);return r>=200&&r<300&&em(t.content)})).reduce(((e,[,t])=>e.concat(Object.keys(t.content))),[]);e.length>0&&(t.headers.accept=e.join(", "))}if(n)if(c){if(u.indexOf(c)>-1)if("application/x-www-form-urlencoded"===c||"multipart/form-data"===c)if("object"==typeof n){var h,f;const e=null!==(h=null===(f=a.content[c])||void 0===f?void 0:f.encoding)&&void 0!==h?h:{};t.form={},Object.keys(n).forEach((r=>{let s;try{s=JSON.parse(n[r])}catch{s=n[r]}t.form[r]={value:s,encoding:e[r]||{}}}))}else if("string"==typeof n){var p,d;const e=null!==(p=null===(d=a.content[c])||void 0===d?void 0:d.encoding)&&void 0!==p?p:{};try{t.form={};const r=JSON.parse(n);Object.entries(r).forEach((([r,n])=>{t.form[r]={value:n,encoding:e[r]||{}}}))}catch{t.form=n}}else t.form=n;else t.body=n}else t.body=n;return t}function uR(e,t){const{spec:r,operation:n,securities:s,requestContentType:i,responseContentType:o,attachContentTypeForEmptyPayload:c}=e;if(t=function({request:e,securities:t={},operation:r={},spec:n}){const s={...e},{authorized:i={},specSecurity:o=[]}=t,c=r.security||o,a=i&&!!Object.keys(i).length,u=n.securityDefinitions;if(s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!a||!c||Array.isArray(r.security)&&!r.security.length)return e;return c.forEach((e=>{Object.keys(e).forEach((e=>{const t=i[e];if(!t)return;const{token:r}=t,n=t.value||t,o=u[e],{type:c}=o,a=o["x-tokenName"]||"access_token",l=r&&r[a];let h=r&&r.token_type;if(t)if("apiKey"===c){const e="query"===o.in?"query":"headers";s[e]=s[e]||{},s[e][o.name]=n}else if("basic"===c)if(n.header)s.headers.authorization=n.header;else{const e=n.username||"",t=n.password||"";n.base64=cR(`${e}:${t}`),s.headers.authorization=`Basic ${n.base64}`}else"oauth2"===c&&l&&(h=h&&"bearer"!==h.toLowerCase()?h:"Bearer",s.headers.authorization=`${h} ${l}`)}))})),s}({request:t,securities:s,operation:n,spec:r}),t.body||t.form||c)i?t.headers["Content-Type"]=i:Array.isArray(n.consumes)?[t.headers["Content-Type"]]=n.consumes:Array.isArray(r.consumes)?[t.headers["Content-Type"]]=r.consumes:n.parameters&&n.parameters.filter((e=>"file"===e.type)).length?t.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter((e=>"formData"===e.in)).length&&(t.headers["Content-Type"]="application/x-www-form-urlencoded");else if(i){const e=n.parameters&&n.parameters.filter((e=>"body"===e.in)).length>0,r=n.parameters&&n.parameters.filter((e=>"formData"===e.in)).length>0;(e||r)&&(t.headers["Content-Type"]=i)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(t.headers.accept=n.produces.join(", ")),t}const lR=e=>Array.isArray(e)?e:[],hR=e=>{try{return new URL(e)}catch{const t=new URL(e,"https://swagger.io"),r=String(e).startsWith("/")?t.pathname:t.pathname.substring(1);return{hash:t.hash,host:"",hostname:"",href:"",origin:"",password:"",pathname:r,port:"",protocol:"",search:t.search,searchParams:t.searchParams}}};class fR extends Ih{}const pR={buildRequest:dR};function dR(e){const{spec:t,operationId:r,responseContentType:n,scheme:s,requestInterceptor:i,responseInterceptor:o,contextUrl:c,userFetch:a,server:u,serverVariables:l,http:h,signal:f,serverVariableEncoder:p}=e;let{parameters:d,parameterBuilders:m}=e;const v=J$(t);m||(m=v?iR:rR);let y={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};f&&(y.signal=f),i&&(y.requestInterceptor=i),o&&(y.responseInterceptor=o),a&&(y.userFetch=a);const b=gI(t,r);if(!b)throw new fR(`Operation ${r} not found`);const{operation:w={},method:x,pathName:j}=b,E=vR({spec:t,scheme:s,contextUrl:c,server:u,serverVariables:l,pathName:j,method:x,serverVariableEncoder:p});if(y.url+=E,!r)return delete y.cookies,y;y.url+=j,y.method=`${x}`.toUpperCase(),d=d||{};const $=t.paths[j]||{};n&&(y.headers.accept=n);const O=(e=>{const t={};e.forEach((e=>{t[e.in]||(t[e.in]={}),t[e.in][e.name]=e}));const r=[];return Object.keys(t).forEach((e=>{Object.keys(t[e]).forEach((n=>{r.push(t[e][n])}))})),r})([].concat(lR(w.parameters)).concat(lR($.parameters)));O.forEach((e=>{const r=m[e.in];let n;if("body"===e.in&&e.schema&&e.schema.properties&&(n=d),n=e&&e.name&&d[e.name],void 0===n?n=e&&e.name&&d[`${e.in}.${e.name}`]:((e,t)=>t.filter((t=>t.name===e)))(e.name,O).length>1&&console.warn(`Parameter '${e.name}' is ambiguous because the defined spec has more than one parameter with the name: '${e.name}' and the passed-in parameter values did not define an 'in' value.`),null!==n){if(void 0!==e.default&&void 0===n&&(n=e.default),void 0===n&&e.required&&!e.allowEmptyValue)throw new Error(`Required parameter ${e.name} is not provided`);if(v&&e.schema&&"object"===e.schema.type&&"string"==typeof n)try{n=JSON.parse(n)}catch(e){throw new Error("Could not parse object parameter value string as JSON")}r&&r({req:y,parameter:e,value:n,operation:w,spec:t,baseURL:E})}}));const S={...e,operation:w};if(y=v?aR(S,y):uR(S,y),y.cookies&&Object.keys(y.cookies).length){const e=Object.keys(y.cookies).reduce(((e,t)=>{const r=y.cookies[t];return e+(e?"&":"")+EI.serialize(t,r)}),"");y.headers.Cookie=e}return y.cookies&&delete y.cookies,openapi_parser_g(y)}const mR=e=>e?e.replace(/\W/g,""):null;function vR(t){return J$(t.spec)?function({spec:t,pathName:r,method:n,server:s,contextUrl:i,serverVariables:o={},serverVariableEncoder:c}){var a,u;let l,h=[],f="";const p=null==t||null===(a=t.paths)||void 0===a||null===(a=a[r])||void 0===a||null===(a=a[(n||"").toLowerCase()])||void 0===a?void 0:a.servers,d=null==t||null===(u=t.paths)||void 0===u||null===(u=u[r])||void 0===u?void 0:u.servers,m=null==t?void 0:t.servers;h=yR(p)?p:yR(d)?d:yR(m)?m:[openapi_parser_e],s&&(l=h.find((e=>e.url===s)),l&&(f=s));f||([l]=h,f=l.url);if(((e,{strict:t=!1}={})=>{try{const r=NI(e);if(!r.result.success)return!1;const n=[];r.ast.translate(n);const s=n.some((([e])=>"server-variable"===e));if(!t&&!s)try{return new URL(e,"https://vladimirgorej.com"),!0}catch{return!1}return!t||s}catch{return!1}})(f,{strict:!0})){const e=Object.entries({...l.variables}).reduce(((e,[t,r])=>(e[t]=r.default,e)),{});f=((e,t,r={})=>{const n={encoder:qI,...r},s=NI(e);if(!s.result.success)return e;const i=[];s.ast.translate(i);const o=i.filter((([e])=>BI.includes(e))).map((([e,r])=>"server-variable-name"===e?Object.hasOwn(t,r)?n.encoder(t[r],r):`{${r}}`:r));return o.join("")})(f,{...e,...o},{encoder:"function"==typeof c?c:jp})}return function(e="",t=""){const r=hR(e&&t?Xm(t,e):e),n=hR(t),s=mR(r.protocol)||mR(n.protocol),i=r.host||n.host,o=r.pathname;let c;c=s&&i?`${s}://${i+o}`:o;return"/"===c[c.length-1]?c.slice(0,-1):c}(f,i)}(t):function({spec:e,scheme:t,contextUrl:r=""}){const n=hR(r),s=Array.isArray(e.schemes)?e.schemes[0]:null,i=t||s||mR(n.protocol)||"http",o=e.host||n.host||"",c=e.basePath||"";let a;a=i&&o?`${i}://${o+c}`:c;return"/"===a[a.length-1]?a.slice(0,-1):a}(t)}const yR=e=>Array.isArray(e)&&e.length>0;function bR(e,t={}){if("string"==typeof e?t.url=e:t=e,!(this instanceof bR))return new bR(t);Object.assign(this,t);const r=this.resolve().then((()=>(this.disableInterfaces||Object.assign(this,bR.makeApisTagOperation(this)),this)));return r.client=this,r}bR.http=_t,bR.makeHttp=function(e,t,r){return r=r||(e=>e),t=t||(e=>e),n=>("string"==typeof n&&(n={url:n}),n=openapi_parser_g(n),n=t(n),r(e(n)))}.bind(null,bR.http),bR.resolveStrategies={"openapi-3-1-apidom":vI,"openapi-3-0":G$,"openapi-2-0":V$,generic:q$},bR.resolve=H$({strategies:[bR.resolveStrategies["openapi-3-1-apidom"],bR.resolveStrategies["openapi-3-0"],bR.resolveStrategies["openapi-2-0"],bR.resolveStrategies.generic]}),bR.resolveSubtree=(e=>async(t,r,n={})=>(async(e,t,r={})=>{const{returnEntireTree:n,baseDoc:s,requestInterceptor:i,responseInterceptor:o,parameterMacro:c,modelPropertyMacro:a,useCircularStructures:u,strategies:l}=r,h={spec:e,pathDiscriminator:t,baseDoc:s,requestInterceptor:i,responseInterceptor:o,parameterMacro:c,modelPropertyMacro:a,useCircularStructures:u,strategies:l},f=l.find((t=>t.match(e))).normalize(e),p=await z$({spec:f,...h,allowMetaPatches:!0,skipNormalization:!U$(e)});return!n&&Array.isArray(t)&&t.length&&(p.spec=t.reduce(((e,t)=>null==e?void 0:e[t]),p.spec)||null),p})(t,r,{...e,...n}))({strategies:[bR.resolveStrategies["openapi-3-1-apidom"],bR.resolveStrategies["openapi-3-0"],bR.resolveStrategies["openapi-2-0"],bR.resolveStrategies.generic]}),bR.execute=function({http:e,fetch:t,spec:r,operationId:n,pathName:s,method:i,parameters:o,securities:c,...a}){const u=e||t||_t;s&&i&&!n&&(n=bI(s,i));const l=pR.buildRequest({spec:r,operationId:n,parameters:o,securities:c,http:u,...a});return l.body&&(em(l.body)||Array.isArray(l.body))&&(l.body=JSON.stringify(l.body)),u(l)},bR.serializeRes=Dt,bR.serializeHeaders=Rt,bR.clearCache=function(){D$.refs.clearCache()},bR.makeApisTagOperation=function(e={}){const t=jI.makeExecute(e);return{apis:jI.mapTagOperations({v2OperationIdCompatibilityMode:e.v2OperationIdCompatibilityMode,spec:e.spec,cb:t})}},bR.buildRequest=dR,bR.helpers={opId:M$},bR.getBaseUrl=vR,bR.apidom={resolve:{resolvers:{HTTPResolverSwaggerClient:_F}},parse:{parsers:{JsonParser:CF,YamlParser:MF,OpenApiJson3_1Parser:NF,OpenApiYaml3_1Parser:qF}},dereference:{strategies:{OpenApi3_1SwaggerClientDereferenceStrategy:fI}}},bR.prototype={http:_t,execute(e){return this.applyDefaults(),bR.execute({spec:this.spec,http:this.http,securities:{authorized:this.authorizations},contextUrl:"string"==typeof this.url?this.url:void 0,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,...e})},resolve(e={}){return bR.resolve({spec:this.spec,url:this.url,http:this.http||this.fetch,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,skipNormalization:this.skipNormalization||!1,...e}).then((e=>(this.originalSpec=this.spec,this.spec=e.spec,this.errors=e.errors,this)))}},bR.prototype.applyDefaults=function(){const{spec:t}=this,r=this.url;if(B$(t)&&wI(r)){const e=new URL(r);t.host||(t.host=e.host),t.schemes||(t.schemes=[e.protocol.replace(":","")]),t.basePath||(t.basePath="/")}else if(J$(t)){const r=Array.isArray(t.servers)&&0===t.servers.length;t.servers&&!r||(t.servers=[openapi_parser_e])}};function gR(e){const t=(e=e.replace("[]","Array")).split("/");return t[0]=t[0].replace(/[^A-Za-z0-9_\-\.]+|\s+/gm,"_"),t.join("/")}const wR={parameterTypeProperties:["format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minLength","maxLength","multipleOf","minItems","maxItems","uniqueItems","minProperties","maxProperties","additionalProperties","pattern","enum","default"],arrayProperties:["items","minItems","maxItems","uniqueItems"],httpMethods:["get","post","put","delete","patch","head","options","trace"],uniqueOnly:function(e,t,r){return r.indexOf(e)===t},createHash:function(e){let t,r=0;if(0===e.length)return r;for(let n=0;n<e.length;n++)t=e.charCodeAt(n),r=(r<<5)-r+t,r|=0;return r},sanitise:gR,sanitiseAll:function(e){return gR(e.split("/").join("_"))},camelize:function(e){return e.toLowerCase().replace(/[-_ \/\.](.)/g,((e,t)=>t.toUpperCase()))},clone:function(e){return JSON.parse(JSON.stringify(e))},circularClone:function e(t,r=null){if(r||(r=new WeakMap),Object(t)!==t||t instanceof Function)return t;if(r.has(t))return r.get(t);let n;try{n=new t.constructor}catch(e){n=Object.create(Object.getPrototypeOf(t))}return r.set(t,n),Object.assign(n,...Object.keys(t).map((n=>({[n]:e(t[n],r)}))))}};function xR(){return{depth:0,seen:new WeakMap,top:!0,combine:!1,allowRefSiblings:!1}}const jR={getDefaultState:xR,walkSchema:function e(t,r,n,s){if(void 0===n.depth&&(n=xR()),null==t)return t;if(n.combine&&(t.allOf&&Array.isArray(t.allOf)&&1===t.allOf.length&&delete(t={...t.allOf[0],...t})?.allOf,t?.anyOf&&Array.isArray(t.anyOf)&&1===t.anyOf.length&&delete(t={...t.anyOf[0],...t})?.anyOf,t?.oneOf&&Array.isArray(t.oneOf)&&1===t.oneOf.length&&delete(t={...t.oneOf[0],...t})?.oneOf),s(t,r,n),n.seen.has(t))return t;if("object"==typeof t&&null!==t&&n.seen.set(t,!0),n.top=!1,n.depth++,void 0!==t?.items&&(n.property="items",e(t.items,t,n,s)),t?.additionalItems&&"object"==typeof t.additionalItems&&(n.property="additionalItems",e(t.additionalItems,t,n,s)),t?.additionalProperties&&"object"==typeof t.additionalProperties&&(n.property="additionalProperties",e(t.additionalProperties,t,n,s)),t?.properties)for(const r in t.properties){const i=t.properties[r];n.property=`properties/${r}`,e(i,t,n,s)}if(t?.patternProperties)for(const r in t.patternProperties){const i=t.patternProperties[r];n.property=`patternProperties/${r}`,e(i,t,n,s)}if(t?.allOf)for(const r in t.allOf){const i=t.allOf[r];n.property=`allOf/${r}`,e(i,t,n,s)}if(t?.anyOf)for(const r in t.anyOf){const i=t.anyOf[r];n.property=`anyOf/${r}`,e(i,t,n,s)}if(t?.oneOf)for(const r in t.oneOf){const i=t.oneOf[r];n.property=`oneOf/${r}`,e(i,t,n,s)}return t?.not&&(n.property="not",e(t.not,t,n,s)),n.depth--,t}};function ER(e,t,r){if(t||(t={depth:0}),t.depth||(t={path:"#",depth:0,pkey:"",parent:{},payload:{},seen:new WeakMap,identity:!1,identityDetection:!1,...t}),"object"!=typeof e)return;const n=t.path;for(const s in e){if(t.key=s,t.path=`${t.path}/${encodeURIComponent(s)}`,t.identityPath=t.seen.get(e[s]),t.identity=void 0!==t.identityPath,e.hasOwnProperty(s)&&r(e,s,t),"object"==typeof e[s]&&!t.identity){t.identityDetection&&!Array.isArray(e[s])&&null!==e[s]&&t.seen.set(e[s],t.path);const n={};n.parent=e,n.path=t.path,n.depth=t.depth?t.depth+1:1,n.pkey=s,n.payload=t.payload,n.seen=t.seen,n.identity=!1,n.identityDetection=t.identityDetection,ER(e[s],n,r)}t.path=n}}let $R;function OR(e,t){for(const r in e)r.startsWith("x-")&&!r.startsWith("x-s2o")&&(t[r]=e[r])}function SR(e,t){jR.walkSchema(e,{},{},((e,r)=>{!function(e){if(e["x-required"]&&Array.isArray(e["x-required"])&&(e.required||(e.required=[]),e.required=e.required.concat(e["x-required"]),delete e["x-required"]),e["x-anyOf"]&&(e.anyOf=e["x-anyOf"],delete e["x-anyOf"]),e["x-oneOf"]&&(e.oneOf=e["x-oneOf"],delete e["x-oneOf"]),e["x-not"]&&(e.not=e["x-not"],delete e["x-not"]),"boolean"==typeof e["x-nullable"]&&(e.nullable=e["x-nullable"],delete e["x-nullable"]),"object"==typeof e["x-discriminator"]&&"string"==typeof e["x-discriminator"].propertyName){e.discriminator=e["x-discriminator"],delete e["x-discriminator"];for(const t in e.discriminator.mapping){const r=e.discriminator.mapping[t];r.startsWith("#/definitions/")&&(e.discriminator.mapping[t]=r.replace("#/definitions/","#/components/schemas/"))}}}(e),function(e,t,r){if(e.nullable&&r.patches++,e.discriminator&&"string"==typeof e.discriminator&&(e.discriminator={propertyName:e.discriminator}),e.items&&Array.isArray(e.items)&&(0===e.items.length?e.items={}:1===e.items.length?e.items=e.items[0]:e.items={anyOf:e.items}),e.type&&Array.isArray(e.type)){if(r.patches++,r.warnings.push("(Patchable) schema type must not be an array"),0===e.type.length)delete e.type;else{e.oneOf||(e.oneOf=[]);for(const t of e.type){const r={};if("null"===t)e.nullable=!0;else{r.type=t;for(const t of wR.arrayProperties)void 0!==e.prop&&(r[t]=e[t],delete e[t])}r.type&&e.oneOf.push(r)}delete e.type,0===e.oneOf.length?delete e.oneOf:e.oneOf.length<2&&(e.type=e.oneOf[0].type,Object.keys(e.oneOf[0]).length>1&&(r.patches++,r.warnings.push("Lost properties from oneOf")),delete e.oneOf)}e.type&&Array.isArray(e.type)&&1===e.type.length&&(e.type=e.type[0])}e.type&&"null"===e.type&&(delete e.type,e.nullable=!0),"array"!==e.type||e.items||(e.items={}),"file"===e.type&&(e.type="string",e.format="binary"),"boolean"==typeof e.required&&(e.required&&e.name&&(void 0===t.required&&(t.required=[]),Array.isArray(t.required)&&t.required.push(e.name)),delete e.required),e.xml&&"string"==typeof e.xml.namespace&&(e.xml.namespace||delete e.xml.namespace),e.allowEmptyValue&&(delete e.allowEmptyValue,r.patches++,r.warnings.push("(Patchable): deleted schema.allowEmptyValue"))}(e,r,t)}))}function AR(e){for(const t in e)for(const r in e[t]){const n=wR.sanitise(r);r!==n&&(e[t][n]=e[t][r],delete e[t][r])}}function PR(e,t){if("basic"===e.type&&(e.type="http",e.scheme="basic"),"oauth2"===e.type){const r={};let n=e.flow;"application"===e.flow&&(n="clientCredentials"),"accessCode"===e.flow&&(n="authorizationCode"),"string"==typeof e.authorizationUrl&&(r.authorizationUrl=e.authorizationUrl.split("?")[0].trim()||"/"),"string"==typeof e.tokenUrl&&(r.tokenUrl=e.tokenUrl.split("?")[0].trim()||"/"),r.scopes=e.scopes||{},e.flows={},e.flows[n]=r,delete e.flow,delete e.authorizationUrl,delete e.tokenUrl,delete e.scopes,e.name&&(delete e.name,t.patches++,t.warnings.push("(Patchable) oauth2 securitySchemes should not have name property"))}}function TR(e){return e&&!e["x-s2o-delete"]}function kR(e,t){if(e.type&&!e.schema&&(e.schema={}),e.type&&(e.schema.type=e.type),e.items&&"array"!==e.items.type){if(e.items.collectionFormat!==e.collectionFormat)return t.errCount++,void t.errors.push({message:"Nested collectionFormats are not supported",pointer:"/.../responses/header"});delete e.items.collectionFormat}"array"===e.type?("ssv"===e.collectionFormat?(t.patches++,t.warnings.push("collectionFormat:ssv is no longer supported for headers")):"pipes"===e.collectionFormat?(t.patches++,t.warnings.push("collectionFormat:pipes is no longer supported for headers")):"multi"===e.collectionFormat?e.explode=!0:"tsv"===e.collectionFormat?(e["x-collectionFormat"]="tsv",t.patches++,t.warnings.push("collectionFormat:tsv is no longer supported")):e.style="simple",delete e.collectionFormat):e.collectionFormat&&(delete e.collectionFormat,t.patches++,t.warnings.push("(Patchable) collectionFormat is only applicable to header.type array")),delete e.type;for(const t of wR.parameterTypeProperties)void 0!==e[t]&&(e.schema[t]=e[t],delete e[t]);for(const t of wR.arrayProperties)void 0!==e[t]&&(e.schema[t]=e[t],delete e[t])}function FR(e,t,r,n,s,i,o){const c={};let a,u=!0;t&&t.consumes&&"string"==typeof t.consumes&&(t.consumes=[t.consumes],o.patches++,o.warnings.push("(Patchable) operation.consumes must be an array")),Array.isArray(i.consumes)||delete i.consumes;const l=((t?t.consumes:null)||i.consumes||[]).filter(wR.uniqueOnly);if(e&&(e.name||e.in)){"boolean"==typeof e["x-deprecated"]&&(e.deprecated=e["x-deprecated"],delete e["x-deprecated"]),void 0!==e["x-example"]&&(e.example=e["x-example"],delete e["x-example"]),"body"===e.in||e.type||(e.type="string",o.patches++,o.warnings.push("(Patchable) parameter.type is mandatory for non-body parameters")),"file"===e.type&&(e["x-s2o-originalType"]=e.type,a=e.type),null===e.description&&delete e.description;let t=e.collectionFormat;if("array"!==e.type||t||(t="csv"),t&&("array"!==e.type&&(delete e.collectionFormat,o.patches++,o.warnings.push("(Patchable) collectionFormat is only applicable to param.type array")),"csv"!==t||"query"!==e.in&&"cookie"!==e.in||(e.style="form",e.explode=!1),"csv"!==t||"path"!==e.in&&"header"!==e.in||(e.style="simple"),"ssv"===t&&("query"===e.in?e.style="spaceDelimited":o.warnings.push(`${e.name} collectionFormat:ssv is no longer supported except for in:query parameters`)),"pipes"===t&&("query"===e.in?e.style="pipeDelimited":o.warnings.push(`${e.name} collectionFormat:pipes is no longer supported except for in:query parameters`)),"multi"===t&&(e.explode=!0),"tsv"===t&&(o.warnings.push("collectionFormat:tsv is no longer supported"),e["x-collectionFormat"]="tsv"),delete e.collectionFormat),e.type&&"body"!==e.type&&"formData"!==e.in)if(e.items&&e.schema)o.warnings.push(`${e.name} parameter has array,items and schema`);else{e.schema&&o.patches++,e.schema&&"object"==typeof e.schema||(e.schema={}),e.schema.type=e.type,e.items&&(e.schema.items=e.items,delete e.items,ER(e.schema.items,null,((r,n)=>{"collectionFormat"===n&&"string"==typeof r[n]&&(t&&r[n]!==t&&o.warnings.push(`${e.name} Nested collectionFormats are not supported`),delete r[n])})));for(const t of wR.parameterTypeProperties)void 0!==e[t]&&(e.schema[t]=e[t]),delete e[t]}e.schema&&SR(e.schema,o),e["x-ms-skip-url-encoding"]&&"query"===e.in&&(e.allowReserved=!0,delete e["x-ms-skip-url-encoding"])}if(e&&"formData"===e.in){u=!1,c.content={};let t="application/x-www-form-urlencoded";if(l.length&&l.indexOf("multipart/form-data")>=0&&(t="multipart/form-data"),c.content[t]={},e.schema)c.content[t].schema=e.schema;else{c.content[t].schema={},c.content[t].schema.type="object",c.content[t].schema.properties={},c.content[t].schema.properties[e.name]={};const r=c.content[t].schema,n=c.content[t].schema.properties[e.name];e.description&&(n.description=e.description),e.example&&(n.example=e.example),e.type&&(n.type=e.type);for(const t of wR.parameterTypeProperties)void 0!==e[t]&&(n[t]=e[t]);!0===e.required&&(r.required||(r.required=[]),r.required.push(e.name),c.required=!0),void 0!==e.default&&(n.default=e.default),n.properties&&(n.properties=e.properties),e.allOf&&(n.allOf=e.allOf),"array"===e.type&&e.items&&(n.items=e.items,n.items.collectionFormat&&delete n.items.collectionFormat),"file"!==a&&"file"!==e["x-s2o-originalType"]||(n.type="string",n.format="binary"),OR(e,n)}}else e&&"file"===e.type&&(e.required&&(c.required=e.required),c.content={},c.content["application/octet-stream"]={},c.content["application/octet-stream"].schema={},c.content["application/octet-stream"].schema.type="string",c.content["application/octet-stream"].schema.format="binary",OR(e,c));if(e&&"body"===e.in){c.content={},e.name&&(c["x-s2o-name"]=(t&&t.operationId?wR.sanitiseAll(t.operationId):"")+wR.camelize(`_${e.name}`)),e.description&&(c.description=e.description),e.required&&(c.required=e.required),l.length||l.push("application/json");for(const t of l)c.content[t]={},c.content[t].schema=wR.clone(e.schema||{}),SR(c.content[t].schema,o);OR(e,c)}if(Object.keys(c).length>0&&(e["x-s2o-delete"]=!0,t))if(t.requestBody&&u){t.requestBody["x-s2o-overloaded"]=!0;const e=t.operationId||s;o.warnings.push(`Operation ${e} has multiple requestBodies`)}else t.requestBody||(t=function(e,t){const r={};for(const n of Object.keys(e))r[n]=e[n],"parameters"===n&&(r.requestBody={},t.rbname&&(r[t.rbname]=""));return r.requestBody={},r}(t,o),r[n]=t),t.requestBody.content&&t.requestBody.content["multipart/form-data"]&&t.requestBody.content["multipart/form-data"].schema&&t.requestBody.content["multipart/form-data"].schema.properties&&c.content["multipart/form-data"]&&c.content["multipart/form-data"].schema&&c.content["multipart/form-data"].schema.properties?(t.requestBody.content["multipart/form-data"].schema.properties=Object.assign(t.requestBody.content["multipart/form-data"].schema.properties,c.content["multipart/form-data"].schema.properties),t.requestBody.content["multipart/form-data"].schema.required=(t.requestBody.content["multipart/form-data"].schema.required||[]).concat(c.content["multipart/form-data"].schema.required||[]),t.requestBody.content["multipart/form-data"].schema.required.length||delete t.requestBody.content["multipart/form-data"].schema.required):t.requestBody.content&&t.requestBody.content["application/x-www-form-urlencoded"]&&t.requestBody.content["application/x-www-form-urlencoded"].schema&&t.requestBody.content["application/x-www-form-urlencoded"].schema.properties&&c.content["application/x-www-form-urlencoded"]&&c.content["application/x-www-form-urlencoded"].schema&&c.content["application/x-www-form-urlencoded"].schema.properties?(t.requestBody.content["application/x-www-form-urlencoded"].schema.properties=Object.assign(t.requestBody.content["application/x-www-form-urlencoded"].schema.properties,c.content["application/x-www-form-urlencoded"].schema.properties),t.requestBody.content["application/x-www-form-urlencoded"].schema.required=(t.requestBody.content["application/x-www-form-urlencoded"].schema.required||[]).concat(c.content["application/x-www-form-urlencoded"].schema.required||[]),t.requestBody.content["application/x-www-form-urlencoded"].schema.required.length||delete t.requestBody.content["application/x-www-form-urlencoded"].schema.required):(t.requestBody=Object.assign(t.requestBody,c),t.requestBody["x-s2o-name"]||t.operationId&&(t.requestBody["x-s2o-name"]=wR.sanitiseAll(t.operationId)));if(e&&!e["x-s2o-delete"]){delete e.type;for(const t of wR.parameterTypeProperties)delete e[t];"path"!==e.in||void 0!==e.required&&!0===e.required||(e.required=!0,o.patches++,o.warnings.push(`(Patchable) path parameters must be required:true [${e.name} in ${s}]`))}return t}function IR(e,t,r,n){if(!e)return!1;if(e.description||"object"!=typeof e||Array.isArray(e)||(n.patches++,n.warnings.push("(Patchable) response.description is mandatory")),void 0!==e.schema){SR(e.schema,n),t&&t.produces&&"string"==typeof t.produces&&(t.produces=[t.produces],n.patches++,n.warnings.push("(Patchable) operation.produces must be an array")),r.produces&&!Array.isArray(r.produces)&&delete r.produces;const s=((t?t.produces:null)||r.produces||[]).filter(wR.uniqueOnly);s.length||s.push("*/*"),e.content={};for(const t of s){if(e.content[t]={},e.content[t].schema=wR.clone(e.schema),e.examples&&e.examples[t]){const r={};r.value=e.examples[t],e.content[t].examples={},e.content[t].examples.response=r,delete e.examples[t]}"file"===e.content[t].schema.type&&(e.content[t].schema={type:"string",format:"binary"})}delete e.schema}for(const t in e.examples)e.content||(e.content={}),e.content[t]||(e.content[t]={}),e.content[t].examples={},e.content[t].examples.response={},e.content[t].examples.response.value=e.examples[t];if(delete e.examples,e.headers)for(const t in e.headers)"status code"===t.toLowerCase()?(delete e.headers[t],n.patches++,n.warnings.push('(Patchable) "Status Code" is not a valid header')):kR(e.headers[t],n)}function RR(e,t,r,n,s){for(const i in e){const o=e[i];o&&o["x-trace"]&&"object"==typeof o["x-trace"]&&(o.trace=o["x-trace"],delete o["x-trace"]),o&&o["x-summary"]&&"string"==typeof o["x-summary"]&&(o.summary=o["x-summary"],delete o["x-summary"]),o&&o["x-description"]&&"string"==typeof o["x-description"]&&(o.description=o["x-description"],delete o["x-description"]),o&&o["x-servers"]&&Array.isArray(o["x-servers"])&&(o.servers=o["x-servers"],delete o["x-servers"]);for(const e in o)if(wR.httpMethods.indexOf(e)>=0||"x-amazon-apigateway-any-method"===e){let c=o[e];if(c&&c.parameters&&Array.isArray(c.parameters)){if(o.parameters)for(const t of o.parameters){c.parameters.find((e=>e.name===t.name&&e.in===t.in))||"formData"!==t.in&&"body"!==t.in&&"file"!==t.type||(c=FR(t,c,o,e,i,s,r))}for(const t of c.parameters)c=FR(t,c,o,e,`${e}: ${i}`,s,r);c.parameters&&(c.parameters=c.parameters.filter(TR))}if(c&&c.security&&AR(c.security),"object"==typeof c){if(!c.responses){const e={description:"Default response"};c.responses={default:e}}for(const e in c.responses){IR(c.responses[e],c,s,r)}}if(c&&c["x-servers"]&&Array.isArray(c["x-servers"]))c.servers=c["x-servers"],delete c["x-servers"];else if(c&&c.schemes&&c.schemes.length)for(const e of c.schemes)if((!s.schemes||s.schemes.indexOf(e)<0)&&(c.servers||(c.servers=[]),Array.isArray(s.servers)))for(const e of s.servers){const t=wR.clone(e);c.servers.push(t)}if(c){if(delete c.consumes,delete c.produces,delete c.schemes,c["x-ms-examples"]){for(const e in c["x-ms-examples"]){const t=c["x-ms-examples"][e],r=wR.sanitiseAll(e);if(t.parameters)for(const r in t.parameters){const n=t.parameters[r];for(const t of(c.parameters||[]).concat(o.parameters||[]))t.name!==r||t.example||(t.examples||(t.examples={}),t.examples[e]={value:n})}if(t.responses)for(const n in t.responses){if(t.responses[n].headers)for(const e in t.responses[n].headers){const r=t.responses[n].headers[e];for(const t in c.responses[n].headers)if(t===e){c.responses[n].headers[t].example=r}}if(t.responses[n].body&&(s.components.examples[r]={value:wR.clone(t.responses[n].body)},c.responses[n]&&c.responses[n].content))for(const t in c.responses[n].content){const s=c.responses[n].content[t];s.examples||(s.examples={}),s.examples[e]={$ref:`#/components/examples/${r}`}}}}delete c["x-ms-examples"]}if(c.parameters&&0===c.parameters.length&&delete c.parameters,c.requestBody){const r=c.operationId?wR.sanitiseAll(c.operationId):wR.camelize(wR.sanitiseAll(e+i)),s=wR.sanitise(c.requestBody["x-s2o-name"]||r||"");delete c.requestBody["x-s2o-name"];const o=JSON.stringify(c.requestBody),a=wR.createHash(o);if(!n[a]){const e={};e.name=s,e.body=c.requestBody,e.refs=[],n[a]=e}const u=`#/${t}/${encodeURIComponent(i)}/${e}/requestBody`;n[a].refs.push(u)}}}if(o&&o.parameters){for(const e in o.parameters){FR(o.parameters[e],null,o,null,i,s,r)}Array.isArray(o.parameters)&&(o.parameters=o.parameters.filter(TR))}}}function DR(e){return e&&e.url&&"string"==typeof e.url?(e.url=e.url.split("{{").join("{"),e.url=e.url.split("}}").join("}"),e.url.replace(/\{(.+?)\}/g,((t,r)=>{e.variables||(e.variables={}),e.variables[r]={default:"unknown"}})),e):e}function _R(e,t){void 0!==e.info&&null!==e.info||(e.info={version:"",title:""},t.patches++,t.warnings.push("(Patchable) info object is mandatory")),("object"!=typeof e.info||Array.isArray(e.info))&&(t.errCount++,t.errors.push({message:"info must be an object",pointer:"/info"})),e.info&&(void 0===e.info.title&&(t.patches++,e.info.title="",t.warnings.push({message:"(Patchable) info.title cannot be null",pointer:"/info/title",patchable:!0})),void 0===e.info.version?(t.patches++,e.info.version="",t.warnings.push("(Patchable) info.version cannot be null")):"string"!=typeof e.info.version&&(t.patches++,e.info.version=e.info.version.toString(),t.warnings.push("(Patchable) info.version must be a string")))}function CR(e,t){e.paths||(t.patches++,e.paths={},t.warnings.push("(Patchable) paths object is mandatory"))}function MR(e={}){const t={original:e,openapi:{},patches:0,warnings:[],errCount:0,errors:[]};if(e.openapi&&"string"==typeof e.openapi&&e.openapi.startsWith("3."))return t.openapi=wR.circularClone(e),_R(t.openapi,t),CR(t.openapi,t),t;if("2.0"!==e.swagger)return t.errCount++,t.errors.push({message:`Unsupported swagger/OpenAPI version: ${e.openapi?e.openapi:e.swagger}`,pointer:"/swagger"}),t;if(t.openapi=wR.circularClone(e),t.openapi.openapi="3.0.0",delete t.openapi.swagger,ER(t.openapi,{},((e,t,r)=>{null===e[t]&&!t.startsWith("x-")&&"default"!==t&&r.path.indexOf("/example")<0&&delete e[t]})),e.host)(e.schemes||[]).forEach((r=>{const n={},s=(e.basePath||"").replace(/\/$/,"");n.url=`${r?`${r}:`:""}//${e.host}${s}`,DR(n),t.openapi.servers||(t.openapi.servers=[]),t.openapi.servers.push(n)}));else if(e.basePath){const r={};r.url=e.basePath,DR(r),t.openapi.servers||(t.openapi.servers=[]),t.openapi.servers.push(r)}if(delete t.openapi.host,delete t.openapi.basePath,e["x-ms-parameterized-host"]){const r=e["x-ms-parameterized-host"],n={};n.url=r.hostTemplate+(e.basePath?e.basePath:""),n.variables={};const s=n.url.match(/\{\w+\}/g);for(const e in r.parameters){const t=r.parameters[e];e.startsWith("x-")||(delete t.required,delete t.type,delete t.in,void 0===t.default&&(t.enum?t.default=t.enum[0]:t.default="none"),t.name||(t.name=s[e].replace("{","").replace("}","")),n.variables[t.name]=t,delete t.name)}t.openapi.servers||(t.openapi.servers=[]),!1===r.useSchemePrefix?t.openapi.servers.push(n):e.schemes.forEach((e=>{t.openapi.servers.push({...n,url:`${e}://${n.url}`})})),delete t.openapi["x-ms-parameterized-host"]}return _R(t.openapi,t),CR(t.openapi,t),"string"==typeof t.openapi.consumes&&(t.openapi.consumes=[t.openapi.consumes]),"string"==typeof t.openapi.produces&&(t.openapi.produces=[t.openapi.produces]),t.openapi.components={},t.openapi["x-callbacks"]&&(t.openapi.components.callbacks=t.openapi["x-callbacks"],delete t.openapi["x-callbacks"]),t.openapi.components.examples={},t.openapi.components.headers={},t.openapi["x-links"]&&(t.openapi.components.links=t.openapi["x-links"],delete t.openapi["x-links"]),t.openapi.components.parameters=t.openapi.parameters||{},t.openapi.components.responses=t.openapi.responses||{},t.openapi.components.requestBodies={},t.openapi.components.securitySchemes=t.openapi.securityDefinitions||{},t.openapi.components.schemas=t.openapi.definitions||{},delete t.openapi.definitions,delete t.openapi.responses,delete t.openapi.parameters,delete t.openapi.securityDefinitions,function(e){const t=e.openapi,r={};$R={schemas:{}},t.security&&AR(t.security);for(const r in t.components.securitySchemes){const n=wR.sanitise(r);if(r!==n){if(t.components.securitySchemes[n])return e.errCount++,e.errors.push({message:`Duplicate sanitised securityScheme name ${n}`,pointer:`/components/securitySchemes/${n}`}),e;t.components.securitySchemes[n]=t.components.securitySchemes[r],delete t.components.securitySchemes[r]}PR(t.components.securitySchemes[n],e)}for(const r in t.components.schemas){const n=wR.sanitiseAll(r);let s=0;if(r!==n){for(;t.components.schemas[n+s];)s=s?++s:2;t.components.schemas[n+s]=t.components.schemas[r],delete t.components.schemas[r]}$R.schemas[r]=n+s,SR(t.components.schemas[`${n}${s}`],e)}for(const r in t.components.parameters){const n=wR.sanitise(r);if(r!==n){if(t.components.parameters[n])return e.errCount++,e.errors.push({message:`Duplicate sanitised parameter name ${n}`,pointer:`/components/parameters/${n}`}),e;t.components.parameters[n]=t.components.parameters[r],delete t.components.parameters[r]}FR(t.components.parameters[n],null,null,null,n,t,e)}for(const r in t.components.responses){const n=wR.sanitise(r);if(r!==n){if(t.components.responses[n])return e.errCount++,e.errors.push({message:`Duplicate sanitised response name ${n}`,pointer:`/components/responses/${n}`}),e;t.components.responses[n]=t.components.responses[r],delete t.components.responses[r]}const s=t.components.responses[n];if(IR(s,null,t,e),s.headers)for(const t in s.headers)"status code"===t.toLowerCase()?(delete s.headers[t],e.patches++,e.warnings.push('(Patchable) "Status Code" is not a valid header')):kR(s.headers[t],e)}for(const e in t.components.requestBodies){const n=t.components.requestBodies[e],s=JSON.stringify(n),i=wR.createHash(s),o={};o.name=e,o.body=n,o.refs=[],r[i]=o}RR(t.paths,"paths",e,r,t),t["x-ms-paths"]&&RR(t["x-ms-paths"],"x-ms-paths",e,r,t);for(const e in t.components.parameters)t.components.parameters[e]["x-s2o-delete"]&&delete t.components.parameters[e];return delete t.consumes,delete t.produces,delete t.schemes,t.components.requestBodies={},t.components.responses&&0===Object.keys(t.components.responses).length&&delete t.components.responses,t.components.parameters&&0===Object.keys(t.components.parameters).length&&delete t.components.parameters,t.components.examples&&0===Object.keys(t.components.examples).length&&delete t.components.examples,t.components.requestBodies&&0===Object.keys(t.components.requestBodies).length&&delete t.components.requestBodies,t.components.securitySchemes&&0===Object.keys(t.components.securitySchemes).length&&delete t.components.securitySchemes,t.components.headers&&0===Object.keys(t.components.headers).length&&delete t.components.headers,t.components.schemas&&0===Object.keys(t.components.schemas).length&&delete t.components.schemas,t.components&&0===Object.keys(t.components).length&&delete t.components,e}(t)}function NR(e){return e.ok&&e.text&&e.parseError&&"YAMLException"===e.parseError.name&&(!e.headers["content-type"]||e.headers["content-type"].match("text/plain"))&&(e.body=e.text),e}const qR={convertObj:MR,resolve:function(e){return new Promise((async t=>{try{const r=await bR.resolve(e,NR);if(r.errors&&r.errors.length>0)t(r);else{r.spec.openapi&&(r.resolvedSpec=r.spec,t(r));const e=MR(r.spec);e.errors&&e.errors.length>0&&(Array.isArray(r.errors)?r.errors.concat(r.errors):r.errors=e.errors),e.warnings&&e.warnings.length>0&&(r.warnings=e.warnings),r.resolvedSpec=r.spec,r.spec=e.openapi,t(r)}}catch(e){t(e)}}))}};
|
4283 |
|
4284 | ;
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 | async function ProcessSpec(specUrl, generateMissingTags = false, sortTags = false, sortSchemas = false, sortEndpointsBy = '', attrApiKey = '', attrApiKeyLocation = '', attrApiKeyValue = '', serverUrl = '', matchPaths = '', matchType = '', removeEndpointsWithBadgeLabelAs = '') {
|
4290 | var _jsonParsedSpec$info, _jsonParsedSpec$compo;
|
4291 | let jsonParsedSpec;
|
4292 | try {
|
4293 | var _specMeta$resolvedSpe, _specMeta$resolvedSpe2;
|
4294 | this.requestUpdate();
|
4295 | let specMeta;
|
4296 | if (typeof specUrl === 'string') {
|
4297 | specMeta = await qR.resolve({
|
4298 | url: specUrl,
|
4299 | allowMetaPatches: false
|
4300 | });
|
4301 | } else {
|
4302 | specMeta = await qR.resolve({
|
4303 | spec: specUrl,
|
4304 | allowMetaPatches: false
|
4305 | });
|
4306 | }
|
4307 | await sleep(0);
|
4308 |
|
4309 |
|
4310 | if ((_specMeta$resolvedSpe = specMeta.resolvedSpec) !== null && _specMeta$resolvedSpe !== void 0 && _specMeta$resolvedSpe.jsonSchemaViewer && (_specMeta$resolvedSpe2 = specMeta.resolvedSpec) !== null && _specMeta$resolvedSpe2 !== void 0 && _specMeta$resolvedSpe2.schemaAndExamples) {
|
4311 | this.dispatchEvent(new CustomEvent('before-render', {
|
4312 | detail: {
|
4313 | spec: specMeta.resolvedSpec
|
4314 | }
|
4315 | }));
|
4316 | const schemaAndExamples = Object.entries(specMeta.resolvedSpec.schemaAndExamples).map(v => ({
|
4317 | show: true,
|
4318 | expanded: true,
|
4319 | selectedExample: null,
|
4320 | name: v[0],
|
4321 | elementId: v[0].replace(invalidCharsRegEx, '-'),
|
4322 | ...v[1]
|
4323 | }));
|
4324 | const parsedSpec = {
|
4325 | specLoadError: false,
|
4326 | isSpecLoading: false,
|
4327 | info: specMeta.resolvedSpec.info,
|
4328 | schemaAndExamples
|
4329 | };
|
4330 | return parsedSpec;
|
4331 | }
|
4332 |
|
4333 |
|
4334 | if (specMeta.spec && (specMeta.spec.components || specMeta.spec.info || specMeta.spec.servers || specMeta.spec.tags || specMeta.spec.paths)) {
|
4335 | jsonParsedSpec = filterPaths(specMeta.spec, matchPaths, matchType, removeEndpointsWithBadgeLabelAs);
|
4336 | this.dispatchEvent(new CustomEvent('before-render', {
|
4337 | detail: {
|
4338 | spec: jsonParsedSpec
|
4339 | }
|
4340 | }));
|
4341 | } else {
|
4342 | var _specMeta$response, _specMeta$response2, _specMeta$response3, _specMeta$response4;
|
4343 | console.info('RapiDoc: %c There was an issue while parsing the spec %o ', 'color:orangered', specMeta);
|
4344 | return {
|
4345 | specLoadError: true,
|
4346 | isSpecLoading: false,
|
4347 | info: {
|
4348 | title: 'Error loading the spec',
|
4349 | description: (_specMeta$response = specMeta.response) !== null && _specMeta$response !== void 0 && _specMeta$response.url ? `${(_specMeta$response2 = specMeta.response) === null || _specMeta$response2 === void 0 ? void 0 : _specMeta$response2.url} ┃ ${(_specMeta$response3 = specMeta.response) === null || _specMeta$response3 === void 0 ? void 0 : _specMeta$response3.status} ${(_specMeta$response4 = specMeta.response) === null || _specMeta$response4 === void 0 ? void 0 : _specMeta$response4.statusText}` : 'Unable to load the Spec',
|
4350 | version: ' '
|
4351 | },
|
4352 | tags: []
|
4353 | };
|
4354 | }
|
4355 | } catch (err) {
|
4356 | console.info('RapiDoc: %c There was an issue while parsing the spec %o ', 'color:orangered', err);
|
4357 | }
|
4358 |
|
4359 |
|
4360 |
|
4361 |
|
4362 | const tags = groupByTags(jsonParsedSpec, sortEndpointsBy, generateMissingTags, sortTags);
|
4363 |
|
4364 |
|
4365 | const components = getComponents(jsonParsedSpec, sortSchemas);
|
4366 |
|
4367 |
|
4368 | const infoDescriptionHeaders = (_jsonParsedSpec$info = jsonParsedSpec.info) !== null && _jsonParsedSpec$info !== void 0 && _jsonParsedSpec$info.description ? getHeadersFromMarkdown(jsonParsedSpec.info.description) : [];
|
4369 |
|
4370 |
|
4371 | const securitySchemes = [];
|
4372 | if ((_jsonParsedSpec$compo = jsonParsedSpec.components) !== null && _jsonParsedSpec$compo !== void 0 && _jsonParsedSpec$compo.securitySchemes) {
|
4373 | const securitySchemeSet = new Set();
|
4374 | Object.entries(jsonParsedSpec.components.securitySchemes).forEach(kv => {
|
4375 | if (!securitySchemeSet.has(kv[0])) {
|
4376 | securitySchemeSet.add(kv[0]);
|
4377 | const securityObj = {
|
4378 | securitySchemeId: kv[0],
|
4379 | ...kv[1]
|
4380 | };
|
4381 | securityObj.value = '';
|
4382 | securityObj.finalKeyValue = '';
|
4383 | if (kv[1].type === 'apiKey' || kv[1].type === 'http') {
|
4384 | securityObj.in = kv[1].in || 'header';
|
4385 | securityObj.name = kv[1].name || 'Authorization';
|
4386 | securityObj.user = '';
|
4387 | securityObj.password = '';
|
4388 | } else if (kv[1].type === 'oauth2') {
|
4389 | securityObj.in = 'header';
|
4390 | securityObj.name = 'Authorization';
|
4391 | securityObj.clientId = '';
|
4392 | securityObj.clientSecret = '';
|
4393 | }
|
4394 | securitySchemes.push(securityObj);
|
4395 | }
|
4396 | });
|
4397 | }
|
4398 | if (attrApiKey && attrApiKeyLocation && attrApiKeyValue) {
|
4399 | securitySchemes.push({
|
4400 | securitySchemeId: rapidocApiKey,
|
4401 | description: 'api-key provided in rapidoc element attributes',
|
4402 | type: 'apiKey',
|
4403 | oAuthFlow: '',
|
4404 | name: attrApiKey,
|
4405 | in: attrApiKeyLocation,
|
4406 | value: attrApiKeyValue,
|
4407 | finalKeyValue: attrApiKeyValue
|
4408 | });
|
4409 | }
|
4410 |
|
4411 |
|
4412 | securitySchemes.forEach(v => {
|
4413 | if (v.type === 'http') {
|
4414 | v.typeDisplay = v.scheme === 'basic' ? 'HTTP Basic' : 'HTTP Bearer';
|
4415 | } else if (v.type === 'apiKey') {
|
4416 | v.typeDisplay = `API Key (${v.name})`;
|
4417 | } else if (v.type === 'oauth2') {
|
4418 | v.typeDisplay = `OAuth (${v.securitySchemeId})`;
|
4419 | } else {
|
4420 | v.typeDisplay = v.type || 'None';
|
4421 | }
|
4422 | });
|
4423 |
|
4424 |
|
4425 | let servers = [];
|
4426 | if (jsonParsedSpec.servers && Array.isArray(jsonParsedSpec.servers) && jsonParsedSpec.servers.length > 0) {
|
4427 | jsonParsedSpec.servers.forEach(v => {
|
4428 | let computedUrl = v.url.trim();
|
4429 | if (!(computedUrl.startsWith('http') || computedUrl.startsWith('//') || computedUrl.startsWith('{'))) {
|
4430 | if (window.location.origin.startsWith('http')) {
|
4431 | v.url = window.location.origin + v.url;
|
4432 | computedUrl = v.url;
|
4433 | }
|
4434 | }
|
4435 |
|
4436 | if (v.variables) {
|
4437 | Object.entries(v.variables).forEach(kv => {
|
4438 | const regex = new RegExp(`{${kv[0]}}`, 'g');
|
4439 | computedUrl = computedUrl.replace(regex, kv[1].default || '');
|
4440 | kv[1].value = kv[1].default || '';
|
4441 | });
|
4442 | }
|
4443 | v.computedUrl = computedUrl;
|
4444 | });
|
4445 | if (serverUrl) {
|
4446 | jsonParsedSpec.servers.push({
|
4447 | url: serverUrl,
|
4448 | computedUrl: serverUrl
|
4449 | });
|
4450 | }
|
4451 | } else if (serverUrl) {
|
4452 | jsonParsedSpec.servers = [{
|
4453 | url: serverUrl,
|
4454 | computedUrl: serverUrl
|
4455 | }];
|
4456 | } else if (window.location.origin.startsWith('http')) {
|
4457 | jsonParsedSpec.servers = [{
|
4458 | url: window.location.origin,
|
4459 | computedUrl: window.location.origin
|
4460 | }];
|
4461 | } else {
|
4462 | jsonParsedSpec.servers = [{
|
4463 | url: 'http://localhost',
|
4464 | computedUrl: 'http://localhost'
|
4465 | }];
|
4466 | }
|
4467 | servers = jsonParsedSpec.servers;
|
4468 | const parsedSpec = {
|
4469 | specLoadError: false,
|
4470 | isSpecLoading: false,
|
4471 | info: jsonParsedSpec.info,
|
4472 | infoDescriptionHeaders,
|
4473 | tags,
|
4474 | components,
|
4475 | externalDocs: jsonParsedSpec.externalDocs,
|
4476 | securitySchemes,
|
4477 | servers
|
4478 | };
|
4479 | return parsedSpec;
|
4480 | }
|
4481 | function filterPaths(openApiObject, matchPaths = '', matchType = '', removeEndpointsWithBadgeLabelAs = '') {
|
4482 | const filteredPaths = {};
|
4483 |
|
4484 |
|
4485 | const labelsToRemove = removeEndpointsWithBadgeLabelAs.split(',').map(label => label.trim().toLowerCase()).filter(Boolean);
|
4486 |
|
4487 |
|
4488 | function pathMatches(pathsKey, httpMethod) {
|
4489 | if (!matchPaths) {
|
4490 | return true;
|
4491 | }
|
4492 | const fullPath = `${httpMethod} ${pathsKey}`.toLowerCase();
|
4493 | if (matchType === 'regex') {
|
4494 | const regex = new RegExp(matchPaths, 'i');
|
4495 | return regex.test(matchPaths.toLowerCase());
|
4496 | }
|
4497 | return fullPath.includes(matchPaths.toLowerCase());
|
4498 | }
|
4499 |
|
4500 |
|
4501 | function containsLabelToRemove(badges) {
|
4502 | return badges.some(badge => labelsToRemove.includes(badge === null || badge === void 0 ? void 0 : badge.label.toLowerCase()));
|
4503 | }
|
4504 |
|
4505 |
|
4506 | Object.entries(openApiObject.paths).forEach(([pathsKey, methods]) => {
|
4507 | const filteredMethods = {};
|
4508 | Object.entries(methods).forEach(([httpMethod, methodDetails]) => {
|
4509 | const badges = methodDetails['x-badges'];
|
4510 |
|
4511 |
|
4512 | if (pathMatches(pathsKey, httpMethod)) {
|
4513 | if (badges && Array.isArray(badges)) {
|
4514 |
|
4515 | if (!containsLabelToRemove(badges)) {
|
4516 | filteredMethods[httpMethod] = methodDetails;
|
4517 | }
|
4518 | } else {
|
4519 |
|
4520 | filteredMethods[httpMethod] = methodDetails;
|
4521 | }
|
4522 | }
|
4523 | });
|
4524 | if (Object.keys(filteredMethods).length > 0) {
|
4525 | filteredPaths[pathsKey] = filteredMethods;
|
4526 | }
|
4527 | });
|
4528 | openApiObject.paths = filteredPaths;
|
4529 | return openApiObject;
|
4530 | }
|
4531 | function getHeadersFromMarkdown(markdownContent) {
|
4532 | const tokens = marked.lexer(markdownContent);
|
4533 | const headers = tokens.filter(v => v.type === 'heading' && v.depth <= 2);
|
4534 | return headers || [];
|
4535 | }
|
4536 | function getComponents(openApiSpec, sortSchemas = false) {
|
4537 | if (!openApiSpec.components) {
|
4538 | return [];
|
4539 | }
|
4540 | const components = [];
|
4541 | for (const component in openApiSpec.components) {
|
4542 | const subComponents = [];
|
4543 | for (const sComponent in openApiSpec.components[component]) {
|
4544 | const scmp = {
|
4545 | show: true,
|
4546 | id: `${component.toLowerCase()}-${sComponent.toLowerCase()}`.replace(invalidCharsRegEx, '-'),
|
4547 | name: sComponent,
|
4548 | component: openApiSpec.components[component][sComponent]
|
4549 | };
|
4550 | subComponents.push(scmp);
|
4551 | }
|
4552 | let cmpDescription = component;
|
4553 | let cmpName = component;
|
4554 | switch (component) {
|
4555 | case 'schemas':
|
4556 | if (sortSchemas) {
|
4557 | subComponents.sort((c1, c2) => c1.name.localeCompare(c2.name));
|
4558 | }
|
4559 | cmpName = 'Schemas';
|
4560 | cmpDescription = 'Schemas allows the definition of input and output data types. These types can be objects, but also primitives and arrays.';
|
4561 | break;
|
4562 | case 'responses':
|
4563 | cmpName = 'Responses';
|
4564 | cmpDescription = 'Describes responses from an API Operation, including design-time, static links to operations based on the response.';
|
4565 | break;
|
4566 | case 'parameters':
|
4567 | cmpName = 'Parameters';
|
4568 | cmpDescription = 'Describes operation parameters. A unique parameter is defined by a combination of a name and location.';
|
4569 | break;
|
4570 | case 'examples':
|
4571 | cmpName = 'Examples';
|
4572 | cmpDescription = 'List of Examples for operations, can be requests, responses and objects examples.';
|
4573 | break;
|
4574 | case 'requestBodies':
|
4575 | cmpName = 'Request Bodies';
|
4576 | cmpDescription = 'Describes common request bodies that are used across the API operations.';
|
4577 | break;
|
4578 | case 'headers':
|
4579 | cmpName = 'Headers';
|
4580 | cmpDescription = 'Headers follows the structure of the Parameters but they are explicitly in "header"';
|
4581 | break;
|
4582 | case 'securitySchemes':
|
4583 | cmpName = 'Security Schemes';
|
4584 |
|
4585 | cmpDescription = 'Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), OAuth2\'s common flows(implicit, password, client credentials and authorization code) as defined in RFC6749, and OpenID Connect Discovery.';
|
4586 | break;
|
4587 | case 'links':
|
4588 | cmpName = 'Links';
|
4589 | cmpDescription = 'Links represent a possible design-time link for a response. The presence of a link does not guarantee the caller\'s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.';
|
4590 | break;
|
4591 | case 'callbacks':
|
4592 | cmpName = 'Callbacks';
|
4593 |
|
4594 | cmpDescription = 'A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.';
|
4595 | break;
|
4596 | default:
|
4597 | cmpName = component;
|
4598 | cmpDescription = component;
|
4599 | break;
|
4600 | }
|
4601 | const cmp = {
|
4602 | show: true,
|
4603 | name: cmpName,
|
4604 | description: cmpDescription,
|
4605 | subComponents
|
4606 | };
|
4607 | components.push(cmp);
|
4608 | }
|
4609 | return components || [];
|
4610 | }
|
4611 | function groupByTags(openApiSpec, sortEndpointsBy, generateMissingTags = false, sortTags = false) {
|
4612 | const supportedMethods = ['get', 'put', 'post', 'delete', 'patch', 'head', 'options'];
|
4613 | const tags = openApiSpec.tags && Array.isArray(openApiSpec.tags) && openApiSpec.tags.length > 0 ? openApiSpec.tags.map(v => ({
|
4614 | show: true,
|
4615 | elementId: `tag--${v.name.replace(invalidCharsRegEx, '-')}`,
|
4616 | name: v.name,
|
4617 | displayName: v['x-displayName'] || v.name,
|
4618 | description: v.description || '',
|
4619 | headers: v.description ? getHeadersFromMarkdown(v.description) : [],
|
4620 | paths: [],
|
4621 | expanded: v['x-tag-expanded'] !== false
|
4622 | })) : [];
|
4623 | const pathsAndWebhooks = openApiSpec.paths || {};
|
4624 | if (openApiSpec.webhooks) {
|
4625 | for (const [key, value] of Object.entries(openApiSpec.webhooks)) {
|
4626 | value._type = 'webhook';
|
4627 | pathsAndWebhooks[key] = value;
|
4628 | }
|
4629 | }
|
4630 |
|
4631 | for (const pathOrHookName in pathsAndWebhooks) {
|
4632 | const commonParams = pathsAndWebhooks[pathOrHookName].parameters;
|
4633 | const commonPathProp = {
|
4634 | servers: pathsAndWebhooks[pathOrHookName].servers || [],
|
4635 | parameters: pathsAndWebhooks[pathOrHookName].parameters || []
|
4636 | };
|
4637 | const isWebhook = pathsAndWebhooks[pathOrHookName]._type === 'webhook';
|
4638 | supportedMethods.forEach(methodName => {
|
4639 | if (pathsAndWebhooks[pathOrHookName][methodName]) {
|
4640 | const pathOrHookObj = openApiSpec.paths[pathOrHookName][methodName];
|
4641 |
|
4642 | const pathTags = pathOrHookObj.tags || [];
|
4643 | if (pathTags.length === 0) {
|
4644 | if (generateMissingTags) {
|
4645 | const pathOrHookNameKey = pathOrHookName.replace(/^\/+|\/+$/g, '');
|
4646 | const firstWordEndIndex = pathOrHookNameKey.indexOf('/');
|
4647 | if (firstWordEndIndex === -1) {
|
4648 | pathTags.push(pathOrHookNameKey);
|
4649 | } else {
|
4650 |
|
4651 | pathTags.push(pathOrHookNameKey.substring(0, firstWordEndIndex));
|
4652 | }
|
4653 | } else {
|
4654 | pathTags.push('General ⦂');
|
4655 | }
|
4656 | }
|
4657 | pathTags.forEach(tag => {
|
4658 | let tagObj;
|
4659 | let specTagsItem;
|
4660 | if (openApiSpec.tags) {
|
4661 | specTagsItem = openApiSpec.tags.find(v => v.name.toLowerCase() === tag.toLowerCase());
|
4662 | }
|
4663 | tagObj = tags.find(v => v.name === tag);
|
4664 | if (!tagObj) {
|
4665 | var _specTagsItem, _specTagsItem2;
|
4666 | tagObj = {
|
4667 | show: true,
|
4668 | elementId: `tag--${tag.replace(invalidCharsRegEx, '-')}`,
|
4669 | name: tag,
|
4670 | description: ((_specTagsItem = specTagsItem) === null || _specTagsItem === void 0 ? void 0 : _specTagsItem.description) || '',
|
4671 | headers: (_specTagsItem2 = specTagsItem) !== null && _specTagsItem2 !== void 0 && _specTagsItem2.description ? getHeadersFromMarkdown(specTagsItem.description) : [],
|
4672 | paths: [],
|
4673 | expanded: specTagsItem ? specTagsItem['x-tag-expanded'] !== false : true
|
4674 | };
|
4675 | tags.push(tagObj);
|
4676 | }
|
4677 |
|
4678 |
|
4679 | let shortSummary = (pathOrHookObj.summary || pathOrHookObj.description || `${methodName.toUpperCase()} ${pathOrHookName}`).trim();
|
4680 | if (shortSummary.length > 100) {
|
4681 | [shortSummary] = shortSummary.split(/[.|!|?]\s|[\r?\n]/);
|
4682 | }
|
4683 |
|
4684 | let finalParameters = [];
|
4685 | if (commonParams) {
|
4686 | if (pathOrHookObj.parameters) {
|
4687 | finalParameters = commonParams.filter(commonParam => {
|
4688 | if (!pathOrHookObj.parameters.some(param => commonParam.name === param.name && commonParam.in === param.in)) {
|
4689 | return commonParam;
|
4690 | }
|
4691 | }).concat(pathOrHookObj.parameters);
|
4692 | } else {
|
4693 | finalParameters = commonParams.slice(0);
|
4694 | }
|
4695 | } else {
|
4696 | finalParameters = pathOrHookObj.parameters ? pathOrHookObj.parameters.slice(0) : [];
|
4697 | }
|
4698 |
|
4699 |
|
4700 | if (pathOrHookObj.callbacks) {
|
4701 | for (const [callbackName, callbackConfig] of Object.entries(pathOrHookObj.callbacks)) {
|
4702 | const filteredCallbacks = Object.entries(callbackConfig).filter(entry => typeof entry[1] === 'object') || [];
|
4703 | pathOrHookObj.callbacks[callbackName] = Object.fromEntries(filteredCallbacks);
|
4704 | }
|
4705 | }
|
4706 |
|
4707 |
|
4708 | tagObj.paths.push({
|
4709 | show: true,
|
4710 | expanded: false,
|
4711 | isWebhook,
|
4712 | expandedAtLeastOnce: false,
|
4713 | summary: pathOrHookObj.summary || '',
|
4714 | description: pathOrHookObj.description || '',
|
4715 | externalDocs: pathOrHookObj.externalDocs,
|
4716 | shortSummary,
|
4717 | method: methodName,
|
4718 | path: pathOrHookName,
|
4719 | operationId: pathOrHookObj.operationId,
|
4720 | elementId: `${methodName}-${pathOrHookName.replace(invalidCharsRegEx, '-')}`,
|
4721 | servers: pathOrHookObj.servers ? commonPathProp.servers.concat(pathOrHookObj.servers) : commonPathProp.servers,
|
4722 | parameters: finalParameters,
|
4723 | requestBody: pathOrHookObj.requestBody,
|
4724 | responses: pathOrHookObj.responses,
|
4725 | callbacks: pathOrHookObj.callbacks,
|
4726 | deprecated: pathOrHookObj.deprecated,
|
4727 | security: pathOrHookObj.security,
|
4728 |
|
4729 |
|
4730 | xBadges: pathOrHookObj['x-badges'] || undefined,
|
4731 | xCodeSamples: pathOrHookObj['x-codeSamples'] || pathOrHookObj['x-code-samples'] || ''
|
4732 | });
|
4733 | });
|
4734 | }
|
4735 | });
|
4736 | }
|
4737 | const tagsWithSortedPaths = tags.filter(tag => tag.paths && tag.paths.length > 0);
|
4738 | tagsWithSortedPaths.forEach(tag => {
|
4739 | if (sortEndpointsBy === 'method') {
|
4740 | tag.paths.sort((a, b) => supportedMethods.indexOf(a.method).toString().localeCompare(supportedMethods.indexOf(b.method)));
|
4741 | } else if (sortEndpointsBy === 'summary') {
|
4742 | tag.paths.sort((a, b) => a.shortSummary.localeCompare(b.shortSummary));
|
4743 | } else if (sortEndpointsBy === 'path') {
|
4744 | tag.paths.sort((a, b) => a.path.localeCompare(b.path));
|
4745 | } else if (sortEndpointsBy === 'none') {
|
4746 |
|
4747 | }
|
4748 | tag.firstPathId = tag.paths[0].elementId;
|
4749 | });
|
4750 | return sortTags ? tagsWithSortedPaths.sort((a, b) => a.name.localeCompare(b.name)) : tagsWithSortedPaths;
|
4751 | }
|
4752 | ;
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 | const directive_t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},directive_e=t=>(...e)=>({_$litDirective$:t,values:e});class directive_i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this.t=t,this._$AM=e,this.i=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
4759 |
|
4760 |
|
4761 | ;
|
4762 |
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 | class unsafe_html_le extends directive_i{constructor(i){if(super(i),this.it=D,i.type!==directive_t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this._t=void 0,this.it=t;if(t===R)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const i=[t];return i.raw=i,this._t={_$litType$:this.constructor.resultType,strings:i,values:[]}}}unsafe_html_le.directiveName="unsafeHTML",unsafe_html_le.resultType=1;const unsafe_html_ae=directive_e(unsafe_html_le);
|
4768 |
|
4769 |
|
4770 | ;
|
4771 |
|
4772 |
|
4773 |
|
4774 | ;
|
4775 | var Buffer = __webpack_require__(287)["hp"];
|
4776 |
|
4777 |
|
4778 |
|
4779 |
|
4780 | const codeVerifier = '731DB1C3F7EA533B85E29492D26AA-1234567890-1234567890';
|
4781 | const codeChallenge = '4FatVDBJKPAo4JgLLaaQFMUcQPn5CrPRvLlaob9PTYc';
|
4782 |
|
4783 | const localStorageKey = 'rapidoc';
|
4784 | function applyApiKey(securitySchemeId, username = '', password = '', providedApikeyVal = '') {
|
4785 | var _this$resolvedSpec$se, _securityObj$scheme;
|
4786 | const securityObj = (_this$resolvedSpec$se = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se === void 0 ? void 0 : _this$resolvedSpec$se.find(v => v.securitySchemeId === securitySchemeId);
|
4787 | if (!securityObj) {
|
4788 | return false;
|
4789 | }
|
4790 | let finalApiKeyValue = '';
|
4791 | if (((_securityObj$scheme = securityObj.scheme) === null || _securityObj$scheme === void 0 ? void 0 : _securityObj$scheme.toLowerCase()) === 'basic') {
|
4792 | if (username) {
|
4793 | finalApiKeyValue = `Basic ${Buffer.from(`${username}:${password}`, 'utf8').toString('base64')}`;
|
4794 | }
|
4795 | } else if (providedApikeyVal) {
|
4796 | var _securityObj$scheme2;
|
4797 | securityObj.value = providedApikeyVal;
|
4798 | finalApiKeyValue = `${((_securityObj$scheme2 = securityObj.scheme) === null || _securityObj$scheme2 === void 0 ? void 0 : _securityObj$scheme2.toLowerCase()) === 'bearer' ? 'Bearer ' : ''}${providedApikeyVal}`;
|
4799 | }
|
4800 | if (finalApiKeyValue) {
|
4801 | securityObj.finalKeyValue = finalApiKeyValue;
|
4802 | this.requestUpdate();
|
4803 | return true;
|
4804 | }
|
4805 | return false;
|
4806 | }
|
4807 | function onClearAllApiKeys() {
|
4808 | var _this$resolvedSpec$se2;
|
4809 | (_this$resolvedSpec$se2 = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se2 === void 0 || _this$resolvedSpec$se2.forEach(v => {
|
4810 | v.user = '';
|
4811 | v.password = '';
|
4812 | v.value = '';
|
4813 | v.finalKeyValue = '';
|
4814 | });
|
4815 | this.requestUpdate();
|
4816 | }
|
4817 | function getPersistedApiKeys() {
|
4818 | return JSON.parse(localStorage.getItem(localStorageKey)) || {};
|
4819 | }
|
4820 | function setPersistedApiKeys(obj) {
|
4821 | localStorage.setItem(localStorageKey, JSON.stringify(obj));
|
4822 | }
|
4823 | function recoverPersistedApiKeys() {
|
4824 | const rapidocLs = getPersistedApiKeys.call(this);
|
4825 | Object.values(rapidocLs).forEach(p => {
|
4826 | applyApiKey.call(this, p.securitySchemeId, p.username, p.password, p.value);
|
4827 | });
|
4828 | }
|
4829 | function onApiKeyChange(securitySchemeId) {
|
4830 | let apiKeyValue = '';
|
4831 | const securityObj = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === securitySchemeId);
|
4832 | if (securityObj) {
|
4833 | const trEl = this.shadowRoot.getElementById(`security-scheme-${securitySchemeId}`);
|
4834 | if (trEl) {
|
4835 | if (securityObj.type && securityObj.scheme && securityObj.type === 'http' && securityObj.scheme.toLowerCase() === 'basic') {
|
4836 | const userVal = trEl.querySelector('.api-key-user').value.trim();
|
4837 | const passwordVal = trEl.querySelector('.api-key-password').value.trim();
|
4838 | applyApiKey.call(this, securitySchemeId, userVal, passwordVal);
|
4839 | } else {
|
4840 | apiKeyValue = trEl.querySelector('.api-key-input').value.trim();
|
4841 | applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
|
4842 | }
|
4843 | if (this.persistAuth === 'true') {
|
4844 | const rapidocLs = getPersistedApiKeys.call(this);
|
4845 | rapidocLs[securitySchemeId] = securityObj;
|
4846 | setPersistedApiKeys.call(this, rapidocLs);
|
4847 | }
|
4848 | }
|
4849 | }
|
4850 | }
|
4851 |
|
4852 |
|
4853 | function updateOAuthKey(securitySchemeId, accessToken, tokenType = 'Bearer') {
|
4854 | const securityObj = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === securitySchemeId);
|
4855 | securityObj.finalKeyValue = `${tokenType.toLowerCase() === 'bearer' ? 'Bearer' : tokenType.toLowerCase() === 'mac' ? 'MAC' : tokenType} ${accessToken}`;
|
4856 | this.requestUpdate();
|
4857 | }
|
4858 |
|
4859 |
|
4860 |
|
4861 | async function fetchAccessToken(tokenUrl, clientId, clientSecret, redirectUrl, grantType, authCode, securitySchemeId, authFlowDivEl, sendClientSecretIn = 'header', scopes = null, username = null, password = null) {
|
4862 | const respDisplayEl = authFlowDivEl ? authFlowDivEl.querySelector('.oauth-resp-display') : undefined;
|
4863 | const urlFormParams = new URLSearchParams();
|
4864 | const headers = new Headers();
|
4865 | urlFormParams.append('grant_type', grantType);
|
4866 | if (grantType === 'authorization_code') {
|
4867 | urlFormParams.append('client_id', clientId);
|
4868 | urlFormParams.append('client_secret', clientSecret);
|
4869 | }
|
4870 | if (grantType !== 'client_credentials' && grantType !== 'password') {
|
4871 | urlFormParams.append('redirect_uri', redirectUrl);
|
4872 | }
|
4873 | if (authCode) {
|
4874 | urlFormParams.append('code', authCode);
|
4875 | urlFormParams.append('code_verifier', codeVerifier);
|
4876 | }
|
4877 | if (sendClientSecretIn === 'header') {
|
4878 | headers.set('Authorization', `Basic ${Buffer.from(`${clientId}:${clientSecret}`, 'utf8').toString('base64')}`);
|
4879 | } else if (grantType !== 'authorization_code') {
|
4880 | urlFormParams.append('client_id', clientId);
|
4881 | urlFormParams.append('client_secret', clientSecret);
|
4882 | }
|
4883 | if (grantType === 'password') {
|
4884 | urlFormParams.append('username', username);
|
4885 | urlFormParams.append('password', password);
|
4886 | }
|
4887 | if (scopes) {
|
4888 | urlFormParams.append('scope', scopes);
|
4889 | }
|
4890 | try {
|
4891 | const resp = await fetch(tokenUrl, {
|
4892 | method: 'POST',
|
4893 | headers,
|
4894 | body: urlFormParams
|
4895 | });
|
4896 | const tokenResp = await resp.json();
|
4897 | if (resp.ok) {
|
4898 | if (tokenResp.token_type && tokenResp.access_token) {
|
4899 | updateOAuthKey.call(this, securitySchemeId, tokenResp.access_token, tokenResp.token_type);
|
4900 | if (respDisplayEl) {
|
4901 | respDisplayEl.innerHTML = '<span style="color:var(--green)">Access Token Received</span>';
|
4902 | }
|
4903 | return true;
|
4904 | }
|
4905 | } else {
|
4906 | if (respDisplayEl) {
|
4907 | respDisplayEl.innerHTML = `<span style="color:var(--red)">${tokenResp.error_description || tokenResp.error_description || 'Unable to get access token'}</span>`;
|
4908 | }
|
4909 | return false;
|
4910 | }
|
4911 | } catch {
|
4912 | if (respDisplayEl) {
|
4913 | respDisplayEl.innerHTML = '<span style="color:var(--red)">Failed to get access token</span>';
|
4914 | }
|
4915 | return false;
|
4916 | }
|
4917 | }
|
4918 |
|
4919 |
|
4920 | async function onWindowMessageEvent(msgEvent, winObj, tokenUrl, clientId, clientSecret, redirectUrl, grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl) {
|
4921 | sessionStorage.removeItem('winMessageEventActive');
|
4922 | winObj.close();
|
4923 | if (msgEvent.data.fake) {
|
4924 | return;
|
4925 | }
|
4926 | if (!msgEvent.data) {
|
4927 | console.warn('RapiDoc: Received no data with authorization message');
|
4928 | }
|
4929 | if (msgEvent.data.error) {
|
4930 | console.warn('RapiDoc: Error while receiving data');
|
4931 | }
|
4932 | if (msgEvent.data) {
|
4933 | if (msgEvent.data.responseType === 'code') {
|
4934 |
|
4935 | fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrl, grantType, msgEvent.data.code, securitySchemeId, authFlowDivEl, sendClientSecretIn);
|
4936 | } else if (msgEvent.data.responseType === 'token') {
|
4937 |
|
4938 | updateOAuthKey.call(this, securitySchemeId, msgEvent.data.access_token, msgEvent.data.token_type);
|
4939 | }
|
4940 | }
|
4941 | }
|
4942 |
|
4943 |
|
4944 |
|
4945 |
|
4946 |
|
4947 |
|
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 | async function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl, e) {
|
4958 | const authFlowDivEl = e.target.closest('.oauth-flow');
|
4959 | const clientId = authFlowDivEl.querySelector('.oauth-client-id') ? authFlowDivEl.querySelector('.oauth-client-id').value.trim() : '';
|
4960 | const clientSecret = authFlowDivEl.querySelector('.oauth-client-secret') ? authFlowDivEl.querySelector('.oauth-client-secret').value.trim() : '';
|
4961 | const username = authFlowDivEl.querySelector('.api-key-user') ? authFlowDivEl.querySelector('.api-key-user').value.trim() : '';
|
4962 | const password = authFlowDivEl.querySelector('.api-key-password') ? authFlowDivEl.querySelector('.api-key-password').value.trim() : '';
|
4963 | const sendClientSecretIn = authFlowDivEl.querySelector('.oauth-send-client-secret-in') ? authFlowDivEl.querySelector('.oauth-send-client-secret-in').value.trim() : 'header';
|
4964 | const checkedScopeEls = [...authFlowDivEl.querySelectorAll('.scope-checkbox:checked')];
|
4965 | const pkceCheckboxEl = authFlowDivEl.querySelector(`#${securitySchemeId}-pkce`);
|
4966 | const state = `${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`;
|
4967 | const nonce = `${Math.random().toString(36).slice(2, 9)}random${Math.random().toString(36).slice(2, 9)}`;
|
4968 |
|
4969 | const redirectUrlObj = new URL(`${window.location.origin}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'))}/${this.oauthReceiver}`);
|
4970 | let grantType = '';
|
4971 | let responseType = '';
|
4972 | let newWindow;
|
4973 |
|
4974 |
|
4975 | const errEls = [...authFlowDivEl.parentNode.querySelectorAll('.oauth-resp-display')];
|
4976 | errEls.forEach(v => {
|
4977 | v.innerHTML = '';
|
4978 | });
|
4979 | if (flowType === 'authorizationCode' || flowType === 'implicit') {
|
4980 | const authUrlObj = new URL(authUrl);
|
4981 | if (flowType === 'authorizationCode') {
|
4982 | grantType = 'authorization_code';
|
4983 | responseType = 'code';
|
4984 | } else if (flowType === 'implicit') {
|
4985 | responseType = 'token';
|
4986 | }
|
4987 | const authCodeParams = new URLSearchParams(authUrlObj.search);
|
4988 | const selectedScopes = checkedScopeEls.map(v => v.value).join(' ');
|
4989 | if (selectedScopes) {
|
4990 | authCodeParams.set('scope', selectedScopes);
|
4991 | }
|
4992 | authCodeParams.set('client_id', clientId);
|
4993 | authCodeParams.set('redirect_uri', redirectUrlObj.toString());
|
4994 | authCodeParams.set('response_type', responseType);
|
4995 | authCodeParams.set('state', state);
|
4996 | authCodeParams.set('nonce', nonce);
|
4997 | if (pkceCheckboxEl && pkceCheckboxEl.checked) {
|
4998 | authCodeParams.set('code_challenge', codeChallenge);
|
4999 | authCodeParams.set('code_challenge_method', 'S256');
|
5000 | }
|
5001 | authCodeParams.set('show_dialog', true);
|
5002 | authUrlObj.search = authCodeParams.toString();
|
5003 |
|
5004 | if (sessionStorage.getItem('winMessageEventActive') === 'true') {
|
5005 | window.postMessage({
|
5006 | fake: true
|
5007 | }, this);
|
5008 | }
|
5009 | setTimeout(() => {
|
5010 | newWindow = window.open(authUrlObj.toString());
|
5011 | if (!newWindow) {
|
5012 | console.error(`RapiDoc: Unable to open ${authUrlObj.toString()} in a new window`);
|
5013 | } else {
|
5014 | sessionStorage.setItem('winMessageEventActive', 'true');
|
5015 | window.addEventListener('message', msgEvent => onWindowMessageEvent.call(this, msgEvent, newWindow, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, sendClientSecretIn, securitySchemeId, authFlowDivEl), {
|
5016 | once: true
|
5017 | });
|
5018 | }
|
5019 | }, 10);
|
5020 | } else if (flowType === 'clientCredentials') {
|
5021 | grantType = 'client_credentials';
|
5022 | const selectedScopes = checkedScopeEls.map(v => v.value).join(' ');
|
5023 | fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes);
|
5024 | } else if (flowType === 'password') {
|
5025 | grantType = 'password';
|
5026 | const selectedScopes = checkedScopeEls.map(v => v.value).join(' ');
|
5027 | fetchAccessToken.call(this, tokenUrl, clientId, clientSecret, redirectUrlObj.toString(), grantType, '', securitySchemeId, authFlowDivEl, sendClientSecretIn, selectedScopes, username, password);
|
5028 | }
|
5029 | }
|
5030 |
|
5031 |
|
5032 |
|
5033 |
|
5034 | function oAuthFlowTemplate(flowName, clientId, clientSecret, securitySchemeId, authFlow, defaultScopes = [], receiveTokenIn = 'header', receiveTokenInOptions = undefined) {
|
5035 | var _this$selectedServer;
|
5036 | let {
|
5037 | authorizationUrl,
|
5038 | tokenUrl,
|
5039 | refreshUrl
|
5040 | } = authFlow;
|
5041 | const pkceOnly = authFlow['x-pkce-only'] || false;
|
5042 | const isUrlAbsolute = url => url.indexOf('://') > 0 || url.indexOf('//') === 0;
|
5043 |
|
5044 | const url = new URL((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl);
|
5045 | const baseUrl = url.origin;
|
5046 | if (refreshUrl && !isUrlAbsolute(refreshUrl)) {
|
5047 | refreshUrl = `${baseUrl}/${refreshUrl.replace(/^\//, '')}`;
|
5048 | }
|
5049 | if (tokenUrl && !isUrlAbsolute(tokenUrl)) {
|
5050 | tokenUrl = `${baseUrl}/${tokenUrl.replace(/^\//, '')}`;
|
5051 | }
|
5052 | if (authorizationUrl && !isUrlAbsolute(authorizationUrl)) {
|
5053 | authorizationUrl = `${baseUrl}/${authorizationUrl.replace(/^\//, '')}`;
|
5054 | }
|
5055 | let flowNameDisplay;
|
5056 | if (flowName === 'authorizationCode') {
|
5057 | flowNameDisplay = 'Authorization Code Flow';
|
5058 | } else if (flowName === 'clientCredentials') {
|
5059 | flowNameDisplay = 'Client Credentials Flow';
|
5060 | } else if (flowName === 'implicit') {
|
5061 | flowNameDisplay = 'Implicit Flow';
|
5062 | } else if (flowName === 'password') {
|
5063 | flowNameDisplay = 'Password Flow';
|
5064 | } else {
|
5065 | flowNameDisplay = flowName;
|
5066 | }
|
5067 | return ke`
|
5068 | <div class="oauth-flow ${flowName}" style="padding: 12px 0; margin-bottom:12px;">
|
5069 | <div class="tiny-title upper" style="margin-bottom:8px;">${flowNameDisplay}</div>
|
5070 | ${authorizationUrl ? ke`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Auth URL</span> <span class="mono-font"> ${authorizationUrl} </span></div>` : ''}
|
5071 | ${tokenUrl ? ke`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Token URL</span> <span class="mono-font">${tokenUrl}</span></div>` : ''}
|
5072 | ${refreshUrl ? ke`<div style="margin-bottom:5px"><span style="width:75px; display: inline-block;">Refresh URL</span> <span class="mono-font">${refreshUrl}</span></div>` : ''}
|
5073 | ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password' ? ke`
|
5074 | ${authFlow.scopes ? ke`
|
5075 | <span> Scopes </span>
|
5076 | <div class= "oauth-scopes" part="section-auth-scopes" style = "width:100%; display:flex; flex-direction:column; flex-wrap:wrap; margin:0 0 10px 24px">
|
5077 | ${Object.entries(authFlow.scopes).map((scopeAndDescr, index) => ke`
|
5078 | <div class="m-checkbox" style="display:inline-flex; align-items:center">
|
5079 | <input type="checkbox" part="checkbox checkbox-auth-scope" class="scope-checkbox" id="${securitySchemeId}${flowName}${index}" ?checked="${defaultScopes.includes(scopeAndDescr[0])}" value="${scopeAndDescr[0]}">
|
5080 | <label for="${securitySchemeId}${flowName}${index}" style="margin-left:5px; cursor:pointer">
|
5081 | <span class="mono-font">${scopeAndDescr[0]}</span>
|
5082 | ${scopeAndDescr[0] !== scopeAndDescr[1] ? ` - ${scopeAndDescr[1] || ''}` : ''}
|
5083 | </label>
|
5084 | </div>
|
5085 | `)}
|
5086 | </div>
|
5087 | ` : ''}
|
5088 | ${flowName === 'password' ? ke`
|
5089 | <div style="margin:5px 0">
|
5090 | <input type="text" value = "" placeholder="username" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} api-key-user" part="textbox textbox-username" id="input-${securitySchemeId}-${flowName}-api-key-user">
|
5091 | <input type="password" value = "" placeholder="password" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} api-key-password" style = "margin:0 5px;" part="textbox textbox-password" id="input-${securitySchemeId}-${flowName}-api-key-password">
|
5092 | </div>` : ''}
|
5093 | <div>
|
5094 | ${flowName === 'authorizationCode' ? ke`
|
5095 | <div style="margin: 16px 0 4px">
|
5096 | <input type="checkbox" part="checkbox checkbox-auth-scope" id="${securitySchemeId}-pkce" checked ?disabled=${pkceOnly}>
|
5097 | <label for="${securitySchemeId}-pkce" style="margin:0 16px 0 4px; line-height:24px; cursor:pointer">
|
5098 | Send Proof Key for Code Exchange (PKCE)
|
5099 | </label>
|
5100 | </div>
|
5101 | ` : ''}
|
5102 | <input type="text" part="textbox textbox-auth-client-id" value = "${clientId || ''}" placeholder="client-id" spellcheck="false" class="oauth2 ${flowName} ${securitySchemeId} oauth-client-id">
|
5103 | ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'password' ? ke`
|
5104 | <input
|
5105 | id="${securitySchemeId}-${flowName}-oauth-client-secret"
|
5106 | type="password" part="textbox textbox-auth-client-secret"
|
5107 | value = "${clientSecret || ''}" placeholder="client-secret" spellcheck="false"
|
5108 | class="oauth2 ${flowName} ${securitySchemeId}
|
5109 | oauth-client-secret"
|
5110 | style = "margin:0 5px;${pkceOnly ? 'display:none;' : ''}"
|
5111 | >
|
5112 | <select style="margin-right:5px;${pkceOnly ? 'display:none;' : ''}" class="${flowName} ${securitySchemeId} oauth-send-client-secret-in">
|
5113 | ${!receiveTokenInOptions || receiveTokenInOptions.includes('header') ? ke`<option value = 'header' .selected = ${receiveTokenIn === 'header'} > Authorization Header </option>` : ''}
|
5114 | ${!receiveTokenInOptions || receiveTokenInOptions.includes('request-body') ? ke` <option value = 'request-body' .selected = ${receiveTokenIn === 'request-body'}> Request Body </option>` : ''}
|
5115 | </select>` : ''}
|
5116 | ${flowName === 'authorizationCode' || flowName === 'clientCredentials' || flowName === 'implicit' || flowName === 'password' ? ke`
|
5117 | <button class="m-btn thin-border" part="btn btn-outline"
|
5118 | @click="${e => {
|
5119 | onInvokeOAuthFlow.call(this, securitySchemeId, flowName, authorizationUrl, tokenUrl, e);
|
5120 | }}"
|
5121 | > GET TOKEN </button>` : ''}
|
5122 | </div>
|
5123 | <div class="oauth-resp-display red-text small-font-size"></div>
|
5124 | ` : ''}
|
5125 | </div>
|
5126 | `;
|
5127 | }
|
5128 | function removeApiKey(securitySchemeId) {
|
5129 | var _this$resolvedSpec$se3;
|
5130 | const securityObj = (_this$resolvedSpec$se3 = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se3 === void 0 ? void 0 : _this$resolvedSpec$se3.find(v => v.securitySchemeId === securitySchemeId);
|
5131 | securityObj.user = '';
|
5132 | securityObj.password = '';
|
5133 | securityObj.value = '';
|
5134 | securityObj.finalKeyValue = '';
|
5135 | if (this.persistAuth === 'true') {
|
5136 | const rapidocLs = getPersistedApiKeys.call(this);
|
5137 | delete rapidocLs[securityObj.securitySchemeId];
|
5138 | setPersistedApiKeys.call(this, rapidocLs);
|
5139 | }
|
5140 | this.requestUpdate();
|
5141 | }
|
5142 | function securitySchemeTemplate() {
|
5143 | var _this$resolvedSpec$se4;
|
5144 | if (!this.resolvedSpec) {
|
5145 | return '';
|
5146 | }
|
5147 | const providedApiKeys = (_this$resolvedSpec$se4 = this.resolvedSpec.securitySchemes) === null || _this$resolvedSpec$se4 === void 0 ? void 0 : _this$resolvedSpec$se4.filter(v => v.finalKeyValue);
|
5148 | if (!providedApiKeys) {
|
5149 | return;
|
5150 | }
|
5151 | return ke`
|
5152 | <section id='auth' part="section-auth" style="text-align:left; direction:ltr; margin-top:24px; margin-bottom:24px;" class = 'observe-me ${'read focused'.includes(this.renderStyle) ? 'section-gap--read-mode' : 'section-gap '}'>
|
5153 | <div class='sub-title regular-font'> AUTHENTICATION </div>
|
5154 |
|
5155 | <div class="small-font-size" style="display:flex; align-items: center; min-height:30px">
|
5156 | ${providedApiKeys.length > 0 ? ke`
|
5157 | <div class="blue-text"> ${providedApiKeys.length} API key applied </div>
|
5158 | <div style="flex:1"></div>
|
5159 | <button class="m-btn thin-border" part="btn btn-outline" @click=${() => {
|
5160 | onClearAllApiKeys.call(this);
|
5161 | }}>CLEAR ALL API KEYS</button>` : ke`<div class="red-text">No API key applied</div>`}
|
5162 | </div>
|
5163 | ${this.resolvedSpec.securitySchemes && this.resolvedSpec.securitySchemes.length > 0 ? ke`
|
5164 | <table role="presentation" id="auth-table" class='m-table padded-12' style="width:100%;">
|
5165 | ${this.resolvedSpec.securitySchemes.filter(v => v.type).map(v => {
|
5166 | var _v$scheme, _v$scheme2;
|
5167 | return ke`
|
5168 | <tr id="security-scheme-${v.securitySchemeId}" class="${v.type.toLowerCase()}">
|
5169 | <td style="max-width:500px; overflow-wrap: break-word;">
|
5170 | <div style="line-height:28px; margin-bottom:5px;">
|
5171 | <span style="font-weight:bold; font-size:var(--font-size-regular)">${v.typeDisplay}</span>
|
5172 | ${v.finalKeyValue ? ke`
|
5173 | <span class='blue-text'> ${v.finalKeyValue ? 'Key Applied' : ''} </span>
|
5174 | <button class="m-btn thin-border small" part="btn btn-outline" @click=${() => {
|
5175 | removeApiKey.call(this, v.securitySchemeId);
|
5176 | }}>REMOVE</button>
|
5177 | ` : ''}
|
5178 | </div>
|
5179 | ${v.description ? ke`
|
5180 | <div class="m-markdown">
|
5181 | ${unsafe_html_ae(marked(v.description || ''))}
|
5182 | </div>` : ''}
|
5183 |
|
5184 | ${v.type.toLowerCase() === 'apikey' || v.type.toLowerCase() === 'http' && ((_v$scheme = v.scheme) === null || _v$scheme === void 0 ? void 0 : _v$scheme.toLowerCase()) === 'bearer' ? ke`
|
5185 | <div style="margin-bottom:5px">
|
5186 | ${v.type.toLowerCase() === 'apikey' ? ke`Send <code>${v.name}</code> in <code>${v.in}</code>` : ke`Send <code>Authorization</code> in <code>header</code> containing the word <code>Bearer</code> followed by a space and a Token String.`}
|
5187 | </div>
|
5188 | <div style="max-height:28px;">
|
5189 | ${v.in !== 'cookie' ? ke`
|
5190 | <input type = "text" value = "${v.value}" class="${v.type} ${v.securitySchemeId} api-key-input" placeholder = "api-token" spellcheck = "false" id = "${v.type}-${v.securitySchemeId}-api-key-input">
|
5191 | <button class="m-btn thin-border" style = "margin-left:5px;"
|
5192 | part = "btn btn-outline"
|
5193 | @click="${e => {
|
5194 | onApiKeyChange.call(this, v.securitySchemeId, e);
|
5195 | }}">
|
5196 | ${v.finalKeyValue ? 'UPDATE' : 'SET'}
|
5197 | </button>` : ke`<span class="gray-text" style="font-size::var(--font-size-small)"> cookies cannot be set from here</span>`}
|
5198 | </div>` : ''}
|
5199 | ${v.type.toLowerCase() === 'http' && ((_v$scheme2 = v.scheme) === null || _v$scheme2 === void 0 ? void 0 : _v$scheme2.toLowerCase()) === 'basic' ? ke`
|
5200 | <div style="margin-bottom:5px">
|
5201 | Send <code>Authorization</code> in <code>header</code> containing the word <code>Basic</code> followed by a space and a base64 encoded string of <code>username:password</code>.
|
5202 | </div>
|
5203 | <div>
|
5204 | <input type="text" value = "${v.user}" placeholder="username" spellcheck="false" class="${v.type} ${v.securitySchemeId} api-key-user" style="width:100px" id = "input-${v.type}-${v.securitySchemeId}-api-key-user">
|
5205 | <input type="password" value = "${v.password}" placeholder="password" spellcheck="false" class="${v.type} ${v.securitySchemeId} api-key-password" style = "width:100px; margin:0 5px;" id = "input-${v.type}-${v.securitySchemeId}-api-key-password">
|
5206 | <button class="m-btn thin-border"
|
5207 | @click="${e => {
|
5208 | onApiKeyChange.call(this, v.securitySchemeId, e);
|
5209 | }}"
|
5210 | part = "btn btn-outline"
|
5211 | >
|
5212 | ${v.finalKeyValue ? 'UPDATE' : 'SET'}
|
5213 | </button>
|
5214 | </div>` : ''}
|
5215 | </td>
|
5216 | </tr>
|
5217 | ${v.type.toLowerCase() === 'oauth2' ? ke`
|
5218 | <tr>
|
5219 | <td style="border:none; padding-left:48px">
|
5220 | ${Object.keys(v.flows).map(f => oAuthFlowTemplate.call(this, f, v.flows[f]['x-client-id'] || v['x-client-id'] || '', v.flows[f]['x-client-secret'] || v['x-client-secret'] || '', v.securitySchemeId, v.flows[f], v.flows[f]['x-default-scopes'] || v['x-default-scopes'], v.flows[f]['x-receive-token-in'] || v['x-receive-token-in'], v.flows[f]['x-receive-token-in-options'] || v['x-receive-token-in-options']))}
|
5221 | </td>
|
5222 | </tr>
|
5223 | ` : ''}
|
5224 | `;
|
5225 | })}
|
5226 | </table>` : ''}
|
5227 | <slot name="auth"></slot>
|
5228 | </section>
|
5229 | `;
|
5230 | }
|
5231 | function pathSecurityTemplate(pathSecurity) {
|
5232 | if (this.resolvedSpec.securitySchemes && pathSecurity) {
|
5233 | const orSecurityKeys1 = [];
|
5234 | if (Array.isArray(pathSecurity)) {
|
5235 | if (pathSecurity.length === 0) {
|
5236 | return '';
|
5237 | }
|
5238 | } else {
|
5239 | return '';
|
5240 | }
|
5241 | pathSecurity.forEach(pSecurity => {
|
5242 | const andSecurityKeys1 = [];
|
5243 | const andKeyTypes = [];
|
5244 | if (Object.keys(pSecurity).length === 0) {
|
5245 | orSecurityKeys1.push({
|
5246 | securityTypes: 'None',
|
5247 | securityDefs: []
|
5248 | });
|
5249 | } else {
|
5250 | Object.keys(pSecurity).forEach(pathSecurityKey => {
|
5251 | let pathScopes = '';
|
5252 | const s = this.resolvedSpec.securitySchemes.find(ss => ss.securitySchemeId === pathSecurityKey);
|
5253 | if (pSecurity[pathSecurityKey] && Array.isArray(pSecurity[pathSecurityKey])) {
|
5254 | pathScopes = pSecurity[pathSecurityKey].join(', ');
|
5255 | }
|
5256 | if (s) {
|
5257 | andKeyTypes.push(s.typeDisplay);
|
5258 | andSecurityKeys1.push({
|
5259 | ...s,
|
5260 | ...{
|
5261 | scopes: pathScopes
|
5262 | }
|
5263 | });
|
5264 | }
|
5265 | });
|
5266 | orSecurityKeys1.push({
|
5267 | securityTypes: andKeyTypes.length > 1 ? `${andKeyTypes[0]} + ${andKeyTypes.length - 1} more` : andKeyTypes[0],
|
5268 | securityDefs: andSecurityKeys1
|
5269 | });
|
5270 | }
|
5271 | });
|
5272 | return ke`<div style="position:absolute; top:3px; right:2px; font-size:var(--font-size-small); line-height: 1.5;">
|
5273 | <div style="position:relative; display:flex; min-width:350px; max-width:700px; justify-content: flex-end;">
|
5274 | <svg width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" fill="none" style="stroke:var(--fg3)"> <rect x="5" y="11" width="14" height="10" rx="2" /> <circle cx="12" cy="16" r="1" /> <path d="M8 11v-4a4 4 0 0 1 8 0v4" /></svg>
|
5275 | ${orSecurityKeys1.map((orSecurityItem1, i) => ke`
|
5276 | ${orSecurityItem1.securityTypes ? ke`
|
5277 | ${i !== 0 ? ke`<div style="padding:3px 4px;"> OR </div>` : ''}
|
5278 | <div class="tooltip">
|
5279 | <div style = "padding:2px 4px; white-space:nowrap; text-overflow:ellipsis;max-width:150px; overflow:hidden;">
|
5280 | ${this.updateRoute === 'true' && this.allowAuthentication === 'true' ? ke`<a part="anchor anchor-operation-security" href="#auth"> ${orSecurityItem1.securityTypes} </a>` : ke`${orSecurityItem1.securityTypes}`}
|
5281 | </div>
|
5282 | <div class="tooltip-text" style="position:absolute; color: var(--fg); top:26px; right:0; border:1px solid var(--border-color);padding:2px 4px; display:block;">
|
5283 | ${orSecurityItem1.securityDefs.length > 1 ? ke`<div>Requires <b>all</b> of the following </div>` : ''}
|
5284 | <div style="padding-left: 8px">
|
5285 | ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => {
|
5286 | const scopeHtml = ke`${andSecurityItem.scopes !== '' ? ke`
|
5287 | <div>
|
5288 | <b>Required scopes:</b>
|
5289 | <br/>
|
5290 | <div style="margin-left:8px">
|
5291 | ${andSecurityItem.scopes.split(',').map((scope, cnt) => ke`${cnt === 0 ? '' : '┃'}<span>${scope}</span>`)}
|
5292 | </div>
|
5293 | </div>` : ''}`;
|
5294 | return ke`
|
5295 | ${andSecurityItem.type === 'oauth2' ? ke`
|
5296 | <div>
|
5297 | ${orSecurityItem1.securityDefs.length > 1 ? ke`<b>${j + 1}.</b> ` : 'Needs'}
|
5298 | OAuth Token <span style="font-family:var(--font-mono); color:var(--primary-color);">${andSecurityItem.securitySchemeId}</span> in <b>Authorization header</b>
|
5299 | ${scopeHtml}
|
5300 | </div>` : andSecurityItem.type === 'http' ? ke`
|
5301 | <div>
|
5302 | ${orSecurityItem1.securityDefs.length > 1 ? ke`<b>${j + 1}.</b> ` : ke`Requires`}
|
5303 | ${andSecurityItem.scheme === 'basic' ? 'Base 64 encoded username:password' : 'Bearer Token'} in <b>Authorization header</b>
|
5304 | ${scopeHtml}
|
5305 | </div>` : ke`
|
5306 | <div>
|
5307 | ${orSecurityItem1.securityDefs.length > 1 ? ke`<b>${j + 1}.</b> ` : ke`Requires`}
|
5308 | Token in <b>${andSecurityItem.name} ${andSecurityItem.in}</b>
|
5309 | ${scopeHtml}
|
5310 | </div>`}`;
|
5311 | })}
|
5312 | </div>
|
5313 | </div>
|
5314 | </div>
|
5315 | ` : ''}
|
5316 | `)}
|
5317 | </div>
|
5318 | </div>
|
5319 | `;
|
5320 | }
|
5321 | return '';
|
5322 | }
|
5323 |
|
5324 |
|
5325 | ;
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 | function codeSamplesTemplate(xCodeSamples) {
|
5333 | return ke`
|
5334 | <section class="table-title" style="margin-top:24px;">CODE SAMPLES</div>
|
5335 | <div part="tab-panel" class="tab-panel col"
|
5336 | @click="${e => {
|
5337 | if (!e.target.classList.contains('tab-btn')) {
|
5338 | return;
|
5339 | }
|
5340 | const clickedTab = e.target.dataset.tab;
|
5341 | const tabButtons = [...e.currentTarget.querySelectorAll('.tab-btn')];
|
5342 | const tabContents = [...e.currentTarget.querySelectorAll('.tab-content')];
|
5343 | tabButtons.forEach(tabBtnEl => tabBtnEl.classList[tabBtnEl.dataset.tab === clickedTab ? 'add' : 'remove']('active'));
|
5344 | tabContents.forEach(tabBodyEl => {
|
5345 | tabBodyEl.style.display = tabBodyEl.dataset.tab === clickedTab ? 'block' : 'none';
|
5346 | });
|
5347 | }}">
|
5348 | <div part="tab-btn-row" class="tab-buttons row" style="width:100; overflow">
|
5349 | ${xCodeSamples.map((v, i) => ke`<button part="tab-btn" class="tab-btn ${i === 0 ? 'active' : ''}" data-tab = '${v.lang}${i}'> ${v.label || v.lang} </button>`)}
|
5350 | </div>
|
5351 | ${xCodeSamples.map((v, i) => {
|
5352 | var _v$lang, _v$lang2, _v$lang3;
|
5353 | return ke`
|
5354 | <div class="tab-content m-markdown" style= "display:${i === 0 ? 'block' : 'none'}" data-tab = '${v.lang}${i}'>
|
5355 | <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${e => {
|
5356 | copyToClipboard(v.source, e);
|
5357 | }}'> Copy </button>
|
5358 | <pre><code class="language">${(prism_default()).languages[(_v$lang = v.lang) === null || _v$lang === void 0 ? void 0 : _v$lang.toLowerCase()] ? unsafe_html_ae(prism_default().highlight(v.source, (prism_default()).languages[(_v$lang2 = v.lang) === null || _v$lang2 === void 0 ? void 0 : _v$lang2.toLowerCase()], (_v$lang3 = v.lang) === null || _v$lang3 === void 0 ? void 0 : _v$lang3.toLowerCase())) : v.source}</code></pre>
|
5359 | </div>`;
|
5360 | })}
|
5361 | </div>
|
5362 | </section>`;
|
5363 | }
|
5364 |
|
5365 | ;
|
5366 |
|
5367 |
|
5368 |
|
5369 | function callbackTemplate(callbacks) {
|
5370 | return ke`
|
5371 | <div class="req-res-title" style="margin-top:12px">CALLBACKS</div>
|
5372 | ${Object.entries(callbacks).map(kv => ke`
|
5373 | <div class="tiny-title" style="padding: 12px; border:1px solid var(--light-border-color)">
|
5374 | ${kv[0]}
|
5375 | ${Object.entries(kv[1]).map(pathObj => ke`
|
5376 | <div class="mono-font small-font-size" style="display:flex; margin-left:16px;">
|
5377 | <div style="width:100%">
|
5378 | ${Object.entries(pathObj[1]).map(method => {
|
5379 | var _method$, _method$2, _method$3;
|
5380 | return ke`
|
5381 | <div>
|
5382 | <div style="margin-top:12px;">
|
5383 | <div class="method method-fg ${method[0]}" style="width:70px; border:none; margin:0; padding:0; line-height:20px; vertical-align: baseline;text-align:left">
|
5384 | <span style="font-size:20px;"> ⥄ </span>
|
5385 | ${method[0]}
|
5386 | </div>
|
5387 | <span style="line-height:20px; vertical-align: baseline;">${pathObj[0]} </span>
|
5388 | </div>
|
5389 | <div class='expanded-req-resp-container'>
|
5390 | <api-request
|
5391 | class = "${this.renderStyle}-mode callback"
|
5392 | style = "width:100%;"
|
5393 | callback = "true"
|
5394 | method = "${method[0] || ''}",
|
5395 | path = "${pathObj[0] || ''}"
|
5396 | .parameters = "${((_method$ = method[1]) === null || _method$ === void 0 ? void 0 : _method$.parameters) || ''}"
|
5397 | .request_body = "${((_method$2 = method[1]) === null || _method$2 === void 0 ? void 0 : _method$2.requestBody) || ''}"
|
5398 | fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
5399 | allow-try = "false"
|
5400 | render-style="${this.renderStyle}"
|
5401 | schema-style = "${this.schemaStyle}"
|
5402 | active-schema-tab = "${this.defaultSchemaTab}"
|
5403 | schema-expand-level = "${this.schemaExpandLevel}"
|
5404 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
5405 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
5406 | schema-hide-read-only = "false"
|
5407 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : 'true'}"
|
5408 | fetch-credentials = "${this.fetchCredentials}"
|
5409 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
5410 | tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
|
5411 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
5412 | anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
5413 | > </api-request>
|
5414 |
|
5415 | <api-response
|
5416 | style = "width:100%;"
|
5417 | class = "${this.renderStyle}-mode"
|
5418 | callback = "true"
|
5419 | .responses="${(_method$3 = method[1]) === null || _method$3 === void 0 ? void 0 : _method$3.responses}"
|
5420 | render-style="${this.renderStyle}"
|
5421 | schema-style="${this.schemaStyle}"
|
5422 | active-schema-tab = "${this.defaultSchemaTab}"
|
5423 | schema-expand-level = "${this.schemaExpandLevel}"
|
5424 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
5425 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
5426 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : 'true'}"
|
5427 | schema-hide-write-only = "false"
|
5428 | exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
|
5429 | tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
|
5430 | schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
5431 | > </api-response>
|
5432 | </div>
|
5433 | </div>
|
5434 | `;
|
5435 | })}
|
5436 | </div>
|
5437 | </div>
|
5438 | `)}
|
5439 | </div>
|
5440 | `)}
|
5441 | `;
|
5442 | }
|
5443 |
|
5444 | ;
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 | const guard_Vt={},guard_It=directive_e(class extends directive_i{constructor(){super(...arguments),this.ot=guard_Vt}render(r,t){return t()}update(r,[t,s]){if(Array.isArray(t)){if(Array.isArray(this.ot)&&this.ot.length===t.length&&t.every(((r,t)=>r===this.ot[t])))return R}else if(this.ot===t)return R;return this.ot=Array.isArray(t)?Array.from(t):t,this.render(t,s)}});
|
5452 |
|
5453 |
|
5454 | ;
|
5455 |
|
5456 |
|
5457 |
|
5458 | ;
|
5459 |
|
5460 |
|
5461 |
|
5462 |
|
5463 |
|
5464 | const{I:directive_helpers_et}=si,directive_helpers_st=o=>null===o||"object"!=typeof o&&"function"!=typeof o,directive_helpers_no={HTML:1,SVG:2,MATHML:3},directive_helpers_nt=(o,t)=>void 0===t?void 0!==o?._$litType$:o?._$litType$===t,directive_helpers_ot=o=>null!=o?._$litType$?.h,directive_helpers_eo=o=>void 0!==o?._$litDirective$,directive_helpers_lo=o=>o?._$litDirective$,directive_helpers_rt=o=>void 0===o.strings,directive_helpers_lt=()=>document.createComment(""),directive_helpers_at=(o,t,i)=>{const n=o._$AA.parentNode,e=void 0===t?o._$AB:t._$AA;if(void 0===i){const t=n.insertBefore(directive_helpers_lt(),e),l=n.insertBefore(directive_helpers_lt(),e);i=new directive_helpers_et(t,l,o,o.options)}else{const t=i._$AB.nextSibling,l=i._$AM,c=l!==o;if(c){let t;i._$AQ?.(o),i._$AM=o,void 0!==i._$AP&&(t=o._$AU)!==l._$AU&&i._$AP(t)}if(t!==e||c){let o=i._$AA;for(;o!==t;){const t=o.nextSibling;n.insertBefore(o,e),o=t}}}return i},directive_helpers_ct=(o,t,i=o)=>(o._$AI(t,i),o),directive_helpers_ht={},directive_helpers_dt=(o,t=directive_helpers_ht)=>o._$AH=t,directive_helpers_ut=o=>o._$AH,directive_helpers_pt=o=>{o._$AP?.(!1,!0);let t=o._$AA;const i=o._$AB.nextSibling;for(;t!==i;){const o=t.nextSibling;t.remove(),t=o}},directive_helpers_ft=o=>{o._$AR()};
|
5465 |
|
5466 |
|
5467 | ;
|
5468 |
|
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 | const live_Ft=directive_e(class extends directive_i{constructor(r){if(super(r),r.type!==directive_t.PROPERTY&&r.type!==directive_t.ATTRIBUTE&&r.type!==directive_t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!directive_helpers_rt(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===R||e===D)return e;const i=r.element,n=r.name;if(r.type===directive_t.PROPERTY){if(e===i[n])return R}else if(r.type===directive_t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(n))return R}else if(r.type===directive_t.ATTRIBUTE&&i.getAttribute(n)===e+"")return R;return directive_helpers_dt(r),e}});
|
5474 |
|
5475 |
|
5476 | ;
|
5477 |
|
5478 |
|
5479 |
|
5480 | ;
|
5481 |
|
5482 |
|
5483 |
|
5484 |
|
5485 |
|
5486 | const if_defined_to=t=>t??D;
|
5487 |
|
5488 |
|
5489 | ;
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 | var dist = __webpack_require__(657);
|
5495 | var dist_default = __webpack_require__.n(dist);
|
5496 | ;
|
5497 |
|
5498 | const border_styles = (i`
|
5499 | .border-top {
|
5500 | border-top:1px solid var(--border-color);
|
5501 | }
|
5502 | .border{
|
5503 | border:1px solid var(--border-color);
|
5504 | border-radius: var(--border-radius);
|
5505 | }
|
5506 | .light-border{
|
5507 | border:1px solid var(--light-border-color);
|
5508 | border-radius: var(--border-radius);
|
5509 | }
|
5510 | .pad-8-16{
|
5511 | padding: 8px 16px;
|
5512 | }
|
5513 | .pad-top-8 {
|
5514 | padding-top: 8px;
|
5515 | }
|
5516 | .mar-top-8 {
|
5517 | margin-top: 8px;
|
5518 | }
|
5519 | `);
|
5520 |
|
5521 | var randexp = __webpack_require__(859);
|
5522 | var randexp_default = __webpack_require__.n(randexp);
|
5523 | ;
|
5524 |
|
5525 |
|
5526 |
|
5527 | (randexp_default()).prototype.randInt = from => from;
|
5528 |
|
5529 |
|
5530 | function getPrintableVal(val) {
|
5531 | if (val === undefined) {
|
5532 | return '';
|
5533 | }
|
5534 | if (val === null) {
|
5535 | return 'null';
|
5536 | }
|
5537 | if (val === '') {
|
5538 | return '∅';
|
5539 | }
|
5540 | if (typeof val === 'boolean' || typeof val === 'number') {
|
5541 | return `${val}`;
|
5542 | }
|
5543 | if (Array.isArray(val)) {
|
5544 | return val.map(v => v === null ? 'null' : v === '' ? '∅' : v.toString().replace(/^ +| +$/g, m => '●'.repeat(m.length)) || '').join(', ');
|
5545 | }
|
5546 | if (typeof val === 'object') {
|
5547 | const keys = Object.keys(val);
|
5548 | return `{ ${keys[0]}:${val[keys[0]]}${keys.length > 1 ? ',' : ''} ... }`;
|
5549 | }
|
5550 | return val.toString().replace(/^ +| +$/g, m => '●'.repeat(m.length)) || '';
|
5551 | }
|
5552 |
|
5553 |
|
5554 | function getTypeInfo(schema) {
|
5555 | if (!schema) {
|
5556 | return;
|
5557 | }
|
5558 | let dataType = '';
|
5559 | let constrain = '';
|
5560 |
|
5561 |
|
5562 | if (schema.$ref) {
|
5563 | const n = schema.$ref.lastIndexOf('/');
|
5564 | const schemaNode = schema.$ref.substring(n + 1);
|
5565 | dataType = `{recursive: ${schemaNode}} `;
|
5566 | } else if (schema.type) {
|
5567 | dataType = Array.isArray(schema.type) ? schema.type.join(schema.length === 2 ? ' or ' : '┃') : schema.type;
|
5568 | if (schema.format || schema.enum || schema.const) {
|
5569 | dataType = dataType.replace('string', schema.enum ? 'enum' : schema.const ? 'const' : schema.format);
|
5570 | }
|
5571 | if (schema.nullable) {
|
5572 | dataType += '┃null';
|
5573 | }
|
5574 | } else if (schema.const) {
|
5575 | dataType = 'const';
|
5576 | } else if (Object.keys(schema).length === 0) {
|
5577 | dataType = 'any';
|
5578 | } else {
|
5579 | dataType = '{missing-type-info}';
|
5580 | }
|
5581 | const info = {
|
5582 | type: dataType,
|
5583 | format: schema.format || '',
|
5584 | pattern: schema.pattern && !schema.enum ? schema.pattern : '',
|
5585 | readOrWriteOnly: schema.readOnly ? '🆁' : schema.writeOnly ? '🆆' : '',
|
5586 | deprecated: schema.deprecated ? '❌' : '',
|
5587 | examples: schema.examples || schema.example,
|
5588 | default: getPrintableVal(schema.default),
|
5589 | description: schema.description || '',
|
5590 | constrain: '',
|
5591 | allowedValues: '',
|
5592 | arrayType: '',
|
5593 | html: ''
|
5594 | };
|
5595 | if (info.type === '{recursive}') {
|
5596 | info.description = schema.$ref.substring(schema.$ref.lastIndexOf('/') + 1);
|
5597 | } else if (info.type === '{missing-type-info}' || info.type === 'any') {
|
5598 | info.description = info.description || '';
|
5599 | }
|
5600 |
|
5601 | info.allowedValues = schema.const ? schema.const : Array.isArray(schema.enum) ? schema.enum.map(v => getPrintableVal(v)).join('┃') : '';
|
5602 | if (dataType === 'array' && schema.items) {
|
5603 | var _schema$items, _schema$items2;
|
5604 | const arrayItemType = (_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.type;
|
5605 | const arrayItemDefault = getPrintableVal(schema.items.default);
|
5606 | info.arrayType = `${schema.type} of ${Array.isArray(arrayItemType) ? arrayItemType.join('') : arrayItemType}`;
|
5607 | info.default = arrayItemDefault;
|
5608 | info.allowedValues = schema.items.const ? schema.const : Array.isArray((_schema$items2 = schema.items) === null || _schema$items2 === void 0 ? void 0 : _schema$items2.enum) ? schema.items.enum.map(v => getPrintableVal(v)).join('┃') : '';
|
5609 | }
|
5610 | if (dataType.match(/integer|number/g)) {
|
5611 | if (schema.minimum !== undefined || schema.exclusiveMinimum !== undefined) {
|
5612 | constrain += schema.minimum !== undefined ? `Min ${schema.minimum}` : `More than ${schema.exclusiveMinimum}`;
|
5613 | }
|
5614 | if (schema.maximum !== undefined || schema.exclusiveMaximum !== undefined) {
|
5615 | constrain += schema.maximum !== undefined ? `${constrain ? '┃' : ''}Max ${schema.maximum}` : `${constrain ? '┃' : ''}Less than ${schema.exclusiveMaximum}`;
|
5616 | }
|
5617 | if (schema.multipleOf !== undefined) {
|
5618 | constrain += `${constrain ? '┃' : ''} multiple of ${schema.multipleOf}`;
|
5619 | }
|
5620 | }
|
5621 | if (dataType.match(/string/g)) {
|
5622 | if (schema.minLength !== undefined && schema.maxLength !== undefined) {
|
5623 | constrain += `${constrain ? '┃' : ''}${schema.minLength} to ${schema.maxLength} chars`;
|
5624 | } else if (schema.minLength !== undefined) {
|
5625 | constrain += `${constrain ? '┃' : ''}Min ${schema.minLength} chars`;
|
5626 | } else if (schema.maxLength !== undefined) {
|
5627 | constrain += `Max ${constrain ? '┃' : ''}${schema.maxLength} chars`;
|
5628 | }
|
5629 | }
|
5630 | info.constrain = constrain;
|
5631 | info.html = `${info.type}~|~${info.readOrWriteOnly}~|~${info.constrain}~|~${info.default}~|~${info.allowedValues}~|~${info.pattern}~|~${info.description}~|~${schema.title || ''}~|~${info.deprecated ? 'deprecated' : ''}`;
|
5632 | return info;
|
5633 | }
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 | function standardizeExample(ex) {
|
5675 | if (typeof ex === 'object' && !Array.isArray(ex)) {
|
5676 | if (ex.value !== undefined) {
|
5677 |
|
5678 | return {
|
5679 | Example: {
|
5680 | ...ex
|
5681 | }
|
5682 | };
|
5683 | }
|
5684 |
|
5685 | const filteredEntries = Object.entries(ex).filter(([_, obj]) => obj.value !== undefined);
|
5686 |
|
5687 | if (filteredEntries.length === 0) {
|
5688 | return undefined;
|
5689 | }
|
5690 | return Object.fromEntries(filteredEntries);
|
5691 | }
|
5692 | if (Array.isArray(ex)) {
|
5693 |
|
5694 | return ex.reduce((acc, value, index) => {
|
5695 | acc[`Example${index + 1}`] = {
|
5696 | value
|
5697 | };
|
5698 | return acc;
|
5699 | }, {});
|
5700 | }
|
5701 |
|
5702 | return ex ? {
|
5703 | Example: {
|
5704 | value: ex
|
5705 | }
|
5706 | } : undefined;
|
5707 | }
|
5708 |
|
5709 |
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 |
|
5715 |
|
5716 |
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 | function normalizeExamples(examples, dataType = 'string') {
|
5722 | if (!examples) {
|
5723 | return {
|
5724 | exampleVal: '',
|
5725 | exampleList: []
|
5726 | };
|
5727 | }
|
5728 | if (examples.constructor === Object) {
|
5729 | const exampleList = Object.values(examples).filter(v => v['x-example-show-value'] !== false).map(v => ({
|
5730 | value: typeof v.value === 'boolean' || typeof v.value === 'number' ? `${v.value}` : v.value || '',
|
5731 | printableValue: getPrintableVal(v.value),
|
5732 | summary: v.summary || '',
|
5733 | description: v.description || ''
|
5734 | }));
|
5735 | const exampleVal = exampleList.length > 0 ? exampleList[0].value : '';
|
5736 | return {
|
5737 | exampleVal,
|
5738 | exampleList
|
5739 | };
|
5740 | }
|
5741 |
|
5742 |
|
5743 | if (!Array.isArray(examples)) {
|
5744 | examples = examples ? [examples] : [];
|
5745 | }
|
5746 | if (examples.length === 0) {
|
5747 | return {
|
5748 | exampleVal: '',
|
5749 | exampleList: []
|
5750 | };
|
5751 | }
|
5752 | if (dataType === 'array') {
|
5753 | const [exampleVal] = examples;
|
5754 | const exampleList = examples.map(v => ({
|
5755 | value: v,
|
5756 | printableValue: getPrintableVal(v)
|
5757 | }));
|
5758 | return {
|
5759 | exampleVal,
|
5760 | exampleList
|
5761 | };
|
5762 | }
|
5763 | const exampleVal = examples[0].toString();
|
5764 | const exampleList = examples.map(v => ({
|
5765 | value: v.toString(),
|
5766 | printableValue: getPrintableVal(v)
|
5767 | }));
|
5768 | return {
|
5769 | exampleVal,
|
5770 | exampleList
|
5771 | };
|
5772 | }
|
5773 | function anyExampleWithSummaryOrDescription(examples) {
|
5774 | return examples.some(x => {
|
5775 | var _x$summary, _x$description;
|
5776 | return ((_x$summary = x.summary) === null || _x$summary === void 0 ? void 0 : _x$summary.length) > 0 || ((_x$description = x.description) === null || _x$description === void 0 ? void 0 : _x$description.length) > 0;
|
5777 | });
|
5778 | }
|
5779 | function getSampleValueByType(schemaObj) {
|
5780 | const example = schemaObj.examples ? schemaObj.examples[0] : schemaObj.example === null ? null : schemaObj.example || undefined;
|
5781 | if (example === '') {
|
5782 | return '';
|
5783 | }
|
5784 | if (example === null) {
|
5785 | return null;
|
5786 | }
|
5787 | if (example === 0) {
|
5788 | return 0;
|
5789 | }
|
5790 | if (example === false) {
|
5791 | return false;
|
5792 | }
|
5793 | if (example instanceof Date) {
|
5794 | switch (schemaObj.format.toLowerCase()) {
|
5795 | case 'date':
|
5796 | return example.toISOString().split('T')[0];
|
5797 | case 'time':
|
5798 | return example.toISOString().split('T')[1];
|
5799 | default:
|
5800 | return example.toISOString();
|
5801 | }
|
5802 | }
|
5803 | if (example) {
|
5804 | return example;
|
5805 | }
|
5806 | if (Object.keys(schemaObj).length === 0) {
|
5807 | return null;
|
5808 | }
|
5809 | if (schemaObj.$ref) {
|
5810 |
|
5811 | return {};
|
5812 | }
|
5813 | if (schemaObj.const === false || schemaObj.const === 0 || schemaObj.const === null || schemaObj.const === '') {
|
5814 | return schemaObj.const;
|
5815 | }
|
5816 | if (schemaObj.const) {
|
5817 | return schemaObj.const;
|
5818 | }
|
5819 | if (schemaObj.default) {
|
5820 | return schemaObj.default;
|
5821 | }
|
5822 | const typeValue = Array.isArray(schemaObj.type) ? schemaObj.type[0] : schemaObj.type;
|
5823 | if (!typeValue) {
|
5824 | return null;
|
5825 | }
|
5826 | if (typeValue.match(/^integer|^number/g)) {
|
5827 | const multipleOf = Number.isNaN(Number(schemaObj.multipleOf)) ? undefined : Number(schemaObj.multipleOf);
|
5828 | const maximum = Number.isNaN(Number(schemaObj.maximum)) ? undefined : Number(schemaObj.maximum);
|
5829 | const minimumPossibleVal = Number.isNaN(Number(schemaObj.minimum)) ? Number.isNaN(Number(schemaObj.exclusiveMinimum)) ? maximum || 0 : Number(schemaObj.exclusiveMinimum) + (typeValue.startsWith('integer') ? 1 : 0.001) : Number(schemaObj.minimum);
|
5830 | const finalVal = multipleOf ? multipleOf >= minimumPossibleVal ? multipleOf : minimumPossibleVal % multipleOf === 0 ? minimumPossibleVal : Math.ceil(minimumPossibleVal / multipleOf) * multipleOf : minimumPossibleVal;
|
5831 | return finalVal;
|
5832 | }
|
5833 | if (typeValue.match(/^boolean/g)) {
|
5834 | return false;
|
5835 | }
|
5836 | if (typeValue.match(/^null/g)) {
|
5837 | return null;
|
5838 | }
|
5839 | if (typeValue.match(/^string/g)) {
|
5840 | if (schemaObj.enum) {
|
5841 | return schemaObj.enum[0];
|
5842 | }
|
5843 | if (schemaObj.const) {
|
5844 | return schemaObj.const;
|
5845 | }
|
5846 | if (schemaObj.pattern) {
|
5847 | try {
|
5848 | return new (randexp_default())(schemaObj.pattern).gen();
|
5849 | } catch {
|
5850 | return schemaObj.pattern;
|
5851 | }
|
5852 | }
|
5853 | if (schemaObj.format) {
|
5854 | const u = `${Date.now().toString(16)}${Math.random().toString(16)}0`.repeat(16);
|
5855 | switch (schemaObj.format.toLowerCase()) {
|
5856 | case 'url':
|
5857 | case 'uri':
|
5858 | return 'http://example.com';
|
5859 | case 'date':
|
5860 | return new Date(0).toISOString().split('T')[0];
|
5861 | case 'time':
|
5862 | return new Date(0).toISOString().split('T')[1];
|
5863 | case 'date-time':
|
5864 | return new Date(0).toISOString();
|
5865 | case 'duration':
|
5866 | return 'P3Y6M4DT12H30M5S';
|
5867 |
|
5868 | case 'email':
|
5869 | case 'idn-email':
|
5870 | return 'user@example.com';
|
5871 | case 'hostname':
|
5872 | case 'idn-hostname':
|
5873 | return 'www.example.com';
|
5874 | case 'ipv4':
|
5875 | return '198.51.100.42';
|
5876 | case 'ipv6':
|
5877 | return '2001:0db8:5b96:0000:0000:426f:8e17:642a';
|
5878 | case 'uuid':
|
5879 | return [u.substring(0, 8), u.substring(8, 12), `4000-8${u.substring(13, 16)}`, u.substring(16, 28)].join('-');
|
5880 | case 'byte':
|
5881 | return 'ZXhhbXBsZQ==';
|
5882 |
|
5883 | default:
|
5884 | return '';
|
5885 | }
|
5886 | } else {
|
5887 | const minLength = Number.isNaN(schemaObj.minLength) ? undefined : Number(schemaObj.minLength);
|
5888 | const maxLength = Number.isNaN(schemaObj.maxLength) ? undefined : Number(schemaObj.maxLength);
|
5889 | const finalLength = minLength || (maxLength > 6 ? 6 : maxLength || undefined);
|
5890 | return finalLength ? 'A'.repeat(finalLength) : 'string';
|
5891 | }
|
5892 | }
|
5893 |
|
5894 | return null;
|
5895 | }
|
5896 |
|
5897 |
|
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 |
|
5919 |
|
5920 |
|
5921 | function json2xml(obj, level = 1) {
|
5922 | const indent = ' '.repeat(level);
|
5923 | let xmlText = '';
|
5924 | if (level === 1 && typeof obj !== 'object') {
|
5925 | return `\n${indent}${obj.toString()}`;
|
5926 | }
|
5927 | for (const prop in obj) {
|
5928 | const tagNameOrProp = obj[prop]['::XML_TAG'] || prop;
|
5929 | let tagName = '';
|
5930 | if (Array.isArray(obj[prop])) {
|
5931 | tagName = tagNameOrProp[0]['::XML_TAG'] || `${prop}`;
|
5932 | } else {
|
5933 | tagName = tagNameOrProp;
|
5934 | }
|
5935 | if (prop.startsWith('::')) {
|
5936 | continue;
|
5937 | }
|
5938 | if (Array.isArray(obj[prop])) {
|
5939 | xmlText = `${xmlText}\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\n${indent}</${tagName}>`;
|
5940 | } else if (typeof obj[prop] === 'object') {
|
5941 | xmlText = `${xmlText}\n${indent}<${tagName}>${json2xml(obj[prop], level + 1)}\n${indent}</${tagName}>`;
|
5942 | } else {
|
5943 | xmlText = `${xmlText}\n${indent}<${tagName}>${obj[prop].toString()}</${tagName}>`;
|
5944 | }
|
5945 | }
|
5946 | return xmlText;
|
5947 | }
|
5948 | function addSchemaInfoToExample(schema, obj) {
|
5949 | var _schema$xml, _schema$xml3;
|
5950 | if (typeof obj !== 'object' || obj === null) {
|
5951 | return;
|
5952 | }
|
5953 | if (schema.title) {
|
5954 | obj['::TITLE'] = schema.title;
|
5955 | }
|
5956 | if (schema.description) {
|
5957 | obj['::DESCRIPTION'] = schema.description;
|
5958 | }
|
5959 | if ((_schema$xml = schema.xml) !== null && _schema$xml !== void 0 && _schema$xml.name) {
|
5960 | var _schema$xml2;
|
5961 | obj['::XML_TAG'] = (_schema$xml2 = schema.xml) === null || _schema$xml2 === void 0 ? void 0 : _schema$xml2.name;
|
5962 | }
|
5963 | if ((_schema$xml3 = schema.xml) !== null && _schema$xml3 !== void 0 && _schema$xml3.wrapped) {
|
5964 | var _schema$xml4;
|
5965 | obj['::XML_WRAP'] = (_schema$xml4 = schema.xml) === null || _schema$xml4 === void 0 ? void 0 : _schema$xml4.wrapped.toString();
|
5966 | }
|
5967 | }
|
5968 | function removeTitlesAndDescriptions(obj) {
|
5969 | if (typeof obj !== 'object' || obj === null) {
|
5970 | return;
|
5971 | }
|
5972 | delete obj['::TITLE'];
|
5973 | delete obj['::DESCRIPTION'];
|
5974 | delete obj['::XML_TAG'];
|
5975 | delete obj['::XML_WRAP'];
|
5976 | for (const k in obj) {
|
5977 | removeTitlesAndDescriptions(obj[k]);
|
5978 | }
|
5979 | }
|
5980 | function addPropertyExampleToObjectExamples(example, obj, propertyKey) {
|
5981 | for (const key in obj) {
|
5982 | obj[key][propertyKey] = example;
|
5983 | }
|
5984 | }
|
5985 | function mergePropertyExamples(obj, propertyName, propExamples) {
|
5986 |
|
5987 | let i = 0;
|
5988 | const maxCombinations = 10;
|
5989 | const mergedObj = {};
|
5990 | for (const exampleKey in obj) {
|
5991 | for (const propExampleKey in propExamples) {
|
5992 | mergedObj[`example-${i}`] = {
|
5993 | ...obj[exampleKey]
|
5994 | };
|
5995 | mergedObj[`example-${i}`][propertyName] = propExamples[propExampleKey];
|
5996 | i++;
|
5997 | if (i >= maxCombinations) {
|
5998 | break;
|
5999 | }
|
6000 | }
|
6001 | if (i >= maxCombinations) {
|
6002 | break;
|
6003 | }
|
6004 | }
|
6005 | return mergedObj;
|
6006 | }
|
6007 |
|
6008 |
|
6009 | function schemaToSampleObj(schema, config = {}) {
|
6010 | let obj = {};
|
6011 | if (!schema) {
|
6012 | return;
|
6013 | }
|
6014 | if (schema.allOf) {
|
6015 | var _schema$allOf$, _schema$allOf$2;
|
6016 | const objWithAllProps = {};
|
6017 | if (schema.allOf.length === 1 && !((_schema$allOf$ = schema.allOf[0]) !== null && _schema$allOf$ !== void 0 && _schema$allOf$.properties) && !((_schema$allOf$2 = schema.allOf[0]) !== null && _schema$allOf$2 !== void 0 && _schema$allOf$2.items)) {
|
6018 |
|
6019 | if (schema.allOf[0].$ref) {
|
6020 | return '{ }';
|
6021 | }
|
6022 | if (schema.allOf[0].readOnly && config.includeReadOnly) {
|
6023 | const tempSchema = schema.allOf[0];
|
6024 | return getSampleValueByType(tempSchema);
|
6025 | }
|
6026 | return;
|
6027 | }
|
6028 | schema.allOf.forEach(v => {
|
6029 | if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
6030 | const partialObj = schemaToSampleObj(v, config);
|
6031 | Object.assign(objWithAllProps, partialObj);
|
6032 | } else if (v.type === 'array' || v.items) {
|
6033 | const partialObj = [schemaToSampleObj(v, config)];
|
6034 | Object.assign(objWithAllProps, partialObj);
|
6035 | } else if (v.type) {
|
6036 | const prop = `prop${Object.keys(objWithAllProps).length}`;
|
6037 | objWithAllProps[prop] = getSampleValueByType(v);
|
6038 | } else {
|
6039 | return '';
|
6040 | }
|
6041 | });
|
6042 | obj = objWithAllProps;
|
6043 | } else if (schema.oneOf) {
|
6044 |
|
6045 | const objWithSchemaProps = {};
|
6046 | if (schema.properties) {
|
6047 | for (const propertyName in schema.properties) {
|
6048 | var _schema$properties$pr;
|
6049 | if (schema.properties[propertyName].properties || (_schema$properties$pr = schema.properties[propertyName].properties) !== null && _schema$properties$pr !== void 0 && _schema$properties$pr.items) {
|
6050 | objWithSchemaProps[propertyName] = schemaToSampleObj(schema.properties[propertyName], config);
|
6051 | } else {
|
6052 | objWithSchemaProps[propertyName] = getSampleValueByType(schema.properties[propertyName]);
|
6053 | }
|
6054 | }
|
6055 | }
|
6056 | if (schema.oneOf.length > 0) {
|
6057 | |
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 |
|
6072 |
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 | let i = 0;
|
6091 |
|
6092 | for (const key in schema.oneOf) {
|
6093 | const oneOfSamples = schemaToSampleObj(schema.oneOf[key], config);
|
6094 | for (const sampleKey in oneOfSamples) {
|
6095 |
|
6096 | let finalExample;
|
6097 | if (Object.keys(objWithSchemaProps).length > 0) {
|
6098 | if (oneOfSamples[sampleKey] === null || typeof oneOfSamples[sampleKey] !== 'object') {
|
6099 |
|
6100 | continue;
|
6101 | } else {
|
6102 | finalExample = Object.assign(oneOfSamples[sampleKey], objWithSchemaProps);
|
6103 | }
|
6104 | } else {
|
6105 | finalExample = oneOfSamples[sampleKey];
|
6106 | }
|
6107 | obj[`example-${i}`] = finalExample;
|
6108 | addSchemaInfoToExample(schema.oneOf[key], obj[`example-${i}`]);
|
6109 | i++;
|
6110 | }
|
6111 | }
|
6112 | }
|
6113 | } else if (schema.anyOf) {
|
6114 |
|
6115 | let commonObj;
|
6116 | if (schema.type === 'object' || schema.properties) {
|
6117 | commonObj = {
|
6118 | 'example-0': {}
|
6119 | };
|
6120 | for (const propertyName in schema.properties) {
|
6121 | if (schema.example) {
|
6122 | commonObj = schema;
|
6123 | break;
|
6124 | }
|
6125 | if (schema.properties[propertyName].deprecated && !config.includeDeprecated) {
|
6126 | continue;
|
6127 | }
|
6128 | if (schema.properties[propertyName].readOnly && !config.includeReadOnly) {
|
6129 | continue;
|
6130 | }
|
6131 | if (schema.properties[propertyName].writeOnly && !config.includeWriteOnly) {
|
6132 | continue;
|
6133 | }
|
6134 | commonObj = mergePropertyExamples(commonObj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));
|
6135 | }
|
6136 | }
|
6137 |
|
6138 |
|
6139 | let i = 0;
|
6140 | for (const key in schema.anyOf) {
|
6141 | const anyOfSamples = schemaToSampleObj(schema.anyOf[key], config);
|
6142 | for (const sampleKey in anyOfSamples) {
|
6143 | if (typeof commonObj !== 'undefined') {
|
6144 | for (const commonKey in commonObj) {
|
6145 | obj[`example-${i}`] = {
|
6146 | ...commonObj[commonKey],
|
6147 | ...anyOfSamples[sampleKey]
|
6148 | };
|
6149 | }
|
6150 | } else {
|
6151 | obj[`example-${i}`] = anyOfSamples[sampleKey];
|
6152 | }
|
6153 | addSchemaInfoToExample(schema.anyOf[key], obj[`example-${i}`]);
|
6154 | i++;
|
6155 | }
|
6156 | }
|
6157 | } else if (schema.type === 'object' || schema.properties) {
|
6158 | obj['example-0'] = {};
|
6159 | addSchemaInfoToExample(schema, obj['example-0']);
|
6160 | if (schema.example) {
|
6161 | obj['example-0'] = schema.example;
|
6162 | } else {
|
6163 | for (const propertyName in schema.properties) {
|
6164 | var _schema$properties$pr2, _schema$properties$pr3, _schema$properties$pr4, _schema$properties$pr5, _schema$properties$pr6;
|
6165 | if ((_schema$properties$pr2 = schema.properties[propertyName]) !== null && _schema$properties$pr2 !== void 0 && _schema$properties$pr2.deprecated && !config.includeDeprecated) {
|
6166 | continue;
|
6167 | }
|
6168 | if ((_schema$properties$pr3 = schema.properties[propertyName]) !== null && _schema$properties$pr3 !== void 0 && _schema$properties$pr3.readOnly && !config.includeReadOnly) {
|
6169 | continue;
|
6170 | }
|
6171 | if ((_schema$properties$pr4 = schema.properties[propertyName]) !== null && _schema$properties$pr4 !== void 0 && _schema$properties$pr4.writeOnly && !config.includeWriteOnly) {
|
6172 | continue;
|
6173 | }
|
6174 | if (((_schema$properties$pr5 = schema.properties[propertyName]) === null || _schema$properties$pr5 === void 0 ? void 0 : _schema$properties$pr5.type) === 'array' || (_schema$properties$pr6 = schema.properties[propertyName]) !== null && _schema$properties$pr6 !== void 0 && _schema$properties$pr6.items) {
|
6175 | var _schema$properties$pr7;
|
6176 | if (schema.properties[propertyName].example) {
|
6177 | addPropertyExampleToObjectExamples(schema.properties[propertyName].example, obj, propertyName);
|
6178 | } else if ((_schema$properties$pr7 = schema.properties[propertyName]) !== null && _schema$properties$pr7 !== void 0 && (_schema$properties$pr7 = _schema$properties$pr7.items) !== null && _schema$properties$pr7 !== void 0 && _schema$properties$pr7.example) {
|
6179 |
|
6180 | addPropertyExampleToObjectExamples([schema.properties[propertyName].items.example], obj, propertyName);
|
6181 | } else {
|
6182 | const itemSamples = schemaToSampleObj(schema.properties[propertyName].items, config);
|
6183 | if (config.useXmlTagForProp) {
|
6184 | var _schema$properties$pr8, _schema$properties$pr9;
|
6185 | const xmlTagName = ((_schema$properties$pr8 = schema.properties[propertyName].xml) === null || _schema$properties$pr8 === void 0 ? void 0 : _schema$properties$pr8.name) || propertyName;
|
6186 | if ((_schema$properties$pr9 = schema.properties[propertyName].xml) !== null && _schema$properties$pr9 !== void 0 && _schema$properties$pr9.wrapped) {
|
6187 | const wrappedItemSample = JSON.parse(`{ "${xmlTagName}" : { "${xmlTagName}" : ${JSON.stringify(itemSamples['example-0'])} } }`);
|
6188 | obj = mergePropertyExamples(obj, xmlTagName, wrappedItemSample);
|
6189 | } else {
|
6190 | obj = mergePropertyExamples(obj, xmlTagName, itemSamples);
|
6191 | }
|
6192 | } else {
|
6193 | const arraySamples = [];
|
6194 | for (const key in itemSamples) {
|
6195 | arraySamples[key] = [itemSamples[key]];
|
6196 | }
|
6197 | obj = mergePropertyExamples(obj, propertyName, arraySamples);
|
6198 | }
|
6199 | }
|
6200 | continue;
|
6201 | }
|
6202 | obj = mergePropertyExamples(obj, propertyName, schemaToSampleObj(schema.properties[propertyName], config));
|
6203 | }
|
6204 | if (typeof schema.additionalProperties === 'object') {
|
6205 | const propertyName = schema.additionalProperties['x-additionalPropertiesName'] || 'property';
|
6206 | obj = mergePropertyExamples(obj, `${propertyName}1`, schemaToSampleObj(schema.additionalProperties, config));
|
6207 | obj = mergePropertyExamples(obj, `${propertyName}2`, schemaToSampleObj(schema.additionalProperties, config));
|
6208 | }
|
6209 | }
|
6210 | } else if (schema.type === 'array' || schema.items) {
|
6211 | if (schema.items || schema.example) {
|
6212 | var _schema$items3;
|
6213 | if (schema.example) {
|
6214 | obj['example-0'] = schema.example;
|
6215 | } else if ((_schema$items3 = schema.items) !== null && _schema$items3 !== void 0 && _schema$items3.example) {
|
6216 |
|
6217 | obj['example-0'] = [schema.items.example];
|
6218 | } else {
|
6219 | const samples = schemaToSampleObj(schema.items, config);
|
6220 | let i = 0;
|
6221 | for (const key in samples) {
|
6222 | obj[`example-${i}`] = [samples[key]];
|
6223 | addSchemaInfoToExample(schema.items, obj[`example-${i}`]);
|
6224 | i++;
|
6225 | }
|
6226 | }
|
6227 | } else {
|
6228 | obj['example-0'] = [];
|
6229 | }
|
6230 | } else {
|
6231 | return {
|
6232 | 'example-0': getSampleValueByType(schema)
|
6233 | };
|
6234 | }
|
6235 | return obj;
|
6236 | }
|
6237 | function generateMarkdownForArrayAndObjectDescription(schema, level = 0) {
|
6238 | var _schema$items4;
|
6239 | let markdown = (schema.description || schema.title) && (schema.minItems || schema.maxItems) ? '<span class="descr-expand-toggle">➔</span>' : '';
|
6240 | if (schema.title) {
|
6241 | if (schema.description) {
|
6242 | markdown = `${markdown} <b>${schema.title}:</b> ${schema.description}<br/>`;
|
6243 | } else {
|
6244 | markdown = `${markdown} ${schema.title}<br/>`;
|
6245 | }
|
6246 | } else if (schema.description) {
|
6247 | markdown = `${markdown} ${schema.description}<br/>`;
|
6248 | }
|
6249 | if (schema.minItems) {
|
6250 | markdown = `${markdown} <b>Min Items:</b> ${schema.minItems}`;
|
6251 | }
|
6252 | if (schema.maxItems) {
|
6253 | markdown = `${markdown} <b>Max Items:</b> ${schema.maxItems}`;
|
6254 | }
|
6255 | if (level > 0 && (_schema$items4 = schema.items) !== null && _schema$items4 !== void 0 && _schema$items4.description) {
|
6256 | let itemsMarkdown = '';
|
6257 | if (schema.items.minProperties) {
|
6258 | itemsMarkdown = `<b>Min Properties:</b> ${schema.items.minProperties}`;
|
6259 | }
|
6260 | if (schema.items.maxProperties) {
|
6261 | itemsMarkdown = `${itemsMarkdown} <b>Max Properties:</b> ${schema.items.maxProperties}`;
|
6262 | }
|
6263 | markdown = `${markdown} ⮕ ${itemsMarkdown} [ ${schema.items.description} ] `;
|
6264 | }
|
6265 | return markdown;
|
6266 | }
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 | function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
6276 | if (!schema) {
|
6277 | return;
|
6278 | }
|
6279 | if (schema.allOf) {
|
6280 | const objWithAllProps = {};
|
6281 | if (schema.allOf.length === 1 && !schema.allOf[0].properties && !schema.allOf[0].items) {
|
6282 |
|
6283 | const tempSchema = schema.allOf[0];
|
6284 | return `${getTypeInfo(tempSchema).html}`;
|
6285 | }
|
6286 |
|
6287 | schema.allOf.map((v, i) => {
|
6288 | if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
6289 | const propSuffix = (v.anyOf || v.oneOf) && i > 0 ? i : '';
|
6290 | const partialObj = schemaInObjectNotation(v, {}, level + 1, propSuffix);
|
6291 | Object.assign(objWithAllProps, partialObj);
|
6292 | } else if (v.type === 'array' || v.items) {
|
6293 | const partialObj = schemaInObjectNotation(v, {}, level + 1);
|
6294 | Object.assign(objWithAllProps, partialObj);
|
6295 | } else if (v.type) {
|
6296 | const prop = `prop${Object.keys(objWithAllProps).length}`;
|
6297 | const typeObj = getTypeInfo(v);
|
6298 | objWithAllProps[prop] = `${typeObj.html}`;
|
6299 | } else {
|
6300 | return '';
|
6301 | }
|
6302 | });
|
6303 | obj = objWithAllProps;
|
6304 | } else if (schema.anyOf || schema.oneOf) {
|
6305 | obj['::description'] = schema.description || '';
|
6306 |
|
6307 | if (schema.type === 'object' || schema.properties) {
|
6308 | obj['::description'] = schema.description || '';
|
6309 | obj['::type'] = 'object';
|
6310 |
|
6311 | for (const key in schema.properties) {
|
6312 | if (schema.required && schema.required.includes(key)) {
|
6313 | obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
6314 | } else {
|
6315 | obj[key] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
6316 | }
|
6317 | }
|
6318 | }
|
6319 |
|
6320 | const objWithAnyOfProps = {};
|
6321 | const xxxOf = schema.anyOf ? 'anyOf' : 'oneOf';
|
6322 | schema[xxxOf].forEach((v, index) => {
|
6323 | if (v.type === 'object' || v.properties || v.allOf || v.anyOf || v.oneOf) {
|
6324 | const partialObj = schemaInObjectNotation(v, {});
|
6325 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
|
6326 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = '';
|
6327 | objWithAnyOfProps['::type'] = 'xxx-of-option';
|
6328 | } else if (v.type === 'array' || v.items) {
|
6329 |
|
6330 | const partialObj = schemaInObjectNotation(v, {});
|
6331 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`] = partialObj;
|
6332 | objWithAnyOfProps[`::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`]['::readwrite'] = '';
|
6333 | objWithAnyOfProps['::type'] = 'xxx-of-array';
|
6334 | } else {
|
6335 | const prop = `::OPTION~${index + 1}${v.title ? `~${v.title}` : ''}`;
|
6336 | objWithAnyOfProps[prop] = `${getTypeInfo(v).html}`;
|
6337 | objWithAnyOfProps['::type'] = 'xxx-of-option';
|
6338 | }
|
6339 | });
|
6340 | obj[schema.anyOf ? `::ANY~OF ${suffix}` : `::ONE~OF ${suffix}`] = objWithAnyOfProps;
|
6341 |
|
6342 | obj['::type'] = 'object';
|
6343 | } else if (Array.isArray(schema.type)) {
|
6344 |
|
6345 |
|
6346 | const subSchema = JSON.parse(JSON.stringify(schema));
|
6347 | const primitiveType = [];
|
6348 | const complexTypes = [];
|
6349 | subSchema.type.forEach(v => {
|
6350 | var _subSchema$items, _subSchema$items2;
|
6351 | if (v.match(/integer|number|string|null|boolean/g)) {
|
6352 | primitiveType.push(v);
|
6353 | } else if (v === 'array' && typeof ((_subSchema$items = subSchema.items) === null || _subSchema$items === void 0 ? void 0 : _subSchema$items.type) === 'string' && (_subSchema$items2 = subSchema.items) !== null && _subSchema$items2 !== void 0 && _subSchema$items2.type.match(/integer|number|string|null|boolean/g)) {
|
6354 |
|
6355 | if (subSchema.items.type === 'string' && subSchema.items.format) {
|
6356 | primitiveType.push(`[${subSchema.items.format}]`);
|
6357 | } else {
|
6358 | primitiveType.push(`[${subSchema.items.type}]`);
|
6359 | }
|
6360 | } else {
|
6361 | complexTypes.push(v);
|
6362 | }
|
6363 | });
|
6364 | let multiPrimitiveTypes;
|
6365 | if (primitiveType.length > 0) {
|
6366 | subSchema.type = primitiveType.join(primitiveType.length === 2 ? ' or ' : '┃');
|
6367 | multiPrimitiveTypes = getTypeInfo(subSchema);
|
6368 | if (complexTypes.length === 0) {
|
6369 | var _multiPrimitiveTypes;
|
6370 | return `${((_multiPrimitiveTypes = multiPrimitiveTypes) === null || _multiPrimitiveTypes === void 0 ? void 0 : _multiPrimitiveTypes.html) || ''}`;
|
6371 | }
|
6372 | }
|
6373 | if (complexTypes.length > 0) {
|
6374 | var _multiPrimitiveTypes2;
|
6375 | obj['::type'] = 'object';
|
6376 | const multiTypeOptions = {
|
6377 | '::type': 'xxx-of-option'
|
6378 | };
|
6379 |
|
6380 |
|
6381 | complexTypes.forEach((v, i) => {
|
6382 | if (v === 'null') {
|
6383 | multiTypeOptions[`::OPTION~${i + 1}`] = 'NULL~|~~|~~|~~|~~|~~|~~|~~|~';
|
6384 | } else if ('integer, number, string, boolean,'.includes(`${v},`)) {
|
6385 | subSchema.type = Array.isArray(v) ? v.join('┃') : v;
|
6386 | const primitiveTypeInfo = getTypeInfo(subSchema);
|
6387 | multiTypeOptions[`::OPTION~${i + 1}`] = primitiveTypeInfo.html;
|
6388 | } else if (v === 'object') {
|
6389 |
|
6390 | const objTypeOption = {
|
6391 | '::title': schema.title || '',
|
6392 | '::description': schema.description || '',
|
6393 | '::type': 'object',
|
6394 | '::deprecated': schema.deprecated || false
|
6395 | };
|
6396 | for (const key in schema.properties) {
|
6397 | if (schema.required && schema.required.includes(key)) {
|
6398 | objTypeOption[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
6399 | } else {
|
6400 | objTypeOption[key] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
6401 | }
|
6402 | }
|
6403 | multiTypeOptions[`::OPTION~${i + 1}`] = objTypeOption;
|
6404 | } else if (v === 'array') {
|
6405 | multiTypeOptions[`::OPTION~${i + 1}`] = {
|
6406 | '::title': schema.title || '',
|
6407 | '::description': schema.description || '',
|
6408 | '::type': 'array',
|
6409 | '::props': schemaInObjectNotation(schema.items, {}, level + 1)
|
6410 | };
|
6411 | }
|
6412 | });
|
6413 | multiTypeOptions[`::OPTION~${complexTypes.length + 1}`] = ((_multiPrimitiveTypes2 = multiPrimitiveTypes) === null || _multiPrimitiveTypes2 === void 0 ? void 0 : _multiPrimitiveTypes2.html) || '';
|
6414 | obj['::ONE~OF'] = multiTypeOptions;
|
6415 | }
|
6416 | } else if (schema.type === 'object' || schema.properties) {
|
6417 |
|
6418 | obj['::title'] = schema.title || '';
|
6419 | obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
6420 | obj['::type'] = 'object';
|
6421 | if (Array.isArray(schema.type) && schema.type.includes('null') || schema.nullable) {
|
6422 | obj['::dataTypeLabel'] = 'object or null';
|
6423 | obj['::nullable'] = true;
|
6424 | }
|
6425 | obj['::deprecated'] = schema.deprecated || false;
|
6426 | obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
6427 | for (const key in schema.properties) {
|
6428 | if (schema.required && schema.required.includes(key)) {
|
6429 | obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
6430 | } else {
|
6431 | obj[key] = schemaInObjectNotation(schema.properties[key], {}, level + 1);
|
6432 | }
|
6433 | }
|
6434 | for (const key in schema.patternProperties) {
|
6435 | obj[`[pattern: ${key}]`] = schemaInObjectNotation(schema.patternProperties[key], obj, level + 1);
|
6436 | }
|
6437 | if (schema.additionalProperties) {
|
6438 | obj['[any-key]'] = schemaInObjectNotation(schema.additionalProperties, {});
|
6439 | }
|
6440 | } else if (schema.type === 'array' || schema.items) {
|
6441 | var _schema$items5;
|
6442 |
|
6443 | obj['::title'] = schema.title || '';
|
6444 | obj['::description'] = generateMarkdownForArrayAndObjectDescription(schema, level);
|
6445 | obj['::type'] = 'array';
|
6446 | if (Array.isArray(schema.type) && schema.type.includes('null') || schema.nullable) {
|
6447 | obj['::dataTypeLabel'] = 'array or null';
|
6448 | obj['::nullable'] = true;
|
6449 | }
|
6450 | obj['::deprecated'] = schema.deprecated || false;
|
6451 | obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
6452 | if ((_schema$items5 = schema.items) !== null && _schema$items5 !== void 0 && _schema$items5.items) {
|
6453 | obj['::array-type'] = schema.items.items.type;
|
6454 | }
|
6455 | obj['::props'] = schemaInObjectNotation(schema.items, {}, level + 1);
|
6456 | } else {
|
6457 | const typeObj = getTypeInfo(schema);
|
6458 | if (typeObj !== null && typeObj !== void 0 && typeObj.html) {
|
6459 | return `${typeObj.html}`;
|
6460 | }
|
6461 | return '';
|
6462 | }
|
6463 | return obj;
|
6464 | }
|
6465 |
|
6466 |
|
6467 | function generateExample(schema, mimeType, examples = {}, example = {}, includeReadOnly = true, includeWriteOnly = true, outputType = 'json', includeGeneratedExample = false) {
|
6468 | const finalExamples = [];
|
6469 |
|
6470 | if (examples) {
|
6471 | for (const eg in examples) {
|
6472 | let egContent = '';
|
6473 | let egFormat = 'json';
|
6474 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json')) {
|
6475 | if (outputType === 'text') {
|
6476 | egContent = typeof examples[eg].value === 'string' ? examples[eg].value : JSON.stringify(examples[eg].value, undefined, 2);
|
6477 | egFormat = 'text';
|
6478 | } else {
|
6479 | egContent = examples[eg].value;
|
6480 | if (typeof examples[eg].value === 'string') {
|
6481 | try {
|
6482 |
|
6483 | const fixedJsonString = examples[eg].value;
|
6484 | egContent = JSON.parse(fixedJsonString);
|
6485 | egFormat = 'json';
|
6486 | } catch {
|
6487 | egFormat = 'text';
|
6488 | egContent = examples[eg].value;
|
6489 | }
|
6490 | }
|
6491 | }
|
6492 | } else {
|
6493 | egContent = examples[eg].value;
|
6494 | egFormat = 'text';
|
6495 | }
|
6496 | finalExamples.push({
|
6497 | exampleId: eg,
|
6498 | exampleSummary: examples[eg].summary || eg,
|
6499 | exampleDescription: examples[eg].description || '',
|
6500 | exampleType: mimeType,
|
6501 | exampleValue: egContent,
|
6502 | exampleFormat: egFormat
|
6503 | });
|
6504 | }
|
6505 | } else if (example) {
|
6506 | let egContent = '';
|
6507 | let egFormat = 'json';
|
6508 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json')) {
|
6509 | if (outputType === 'text') {
|
6510 | egContent = typeof example === 'string' ? example : JSON.stringify(example, undefined, 2);
|
6511 | egFormat = 'text';
|
6512 | } else if (typeof example === 'object') {
|
6513 | egContent = example;
|
6514 | egFormat = 'json';
|
6515 | } else if (typeof example === 'string') {
|
6516 | try {
|
6517 | egContent = JSON.parse(example);
|
6518 | egFormat = 'json';
|
6519 | } catch {
|
6520 | egFormat = 'text';
|
6521 | egContent = example;
|
6522 | }
|
6523 | }
|
6524 | } else {
|
6525 | egContent = example;
|
6526 | egFormat = 'text';
|
6527 | }
|
6528 | finalExamples.push({
|
6529 | exampleId: 'Example',
|
6530 | exampleSummary: '',
|
6531 | exampleDescription: '',
|
6532 | exampleType: mimeType,
|
6533 | exampleValue: egContent,
|
6534 | exampleFormat: egFormat
|
6535 | });
|
6536 | }
|
6537 |
|
6538 | if (finalExamples.length === 0 || includeGeneratedExample === true) {
|
6539 | if (schema) {
|
6540 | if (schema.example) {
|
6541 |
|
6542 | finalExamples.push({
|
6543 | exampleId: 'Example',
|
6544 | exampleSummary: '',
|
6545 | exampleDescription: '',
|
6546 | exampleType: mimeType,
|
6547 | exampleValue: schema.example,
|
6548 | exampleFormat: mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json') && typeof schema.example === 'object' ? 'json' : 'text'
|
6549 | });
|
6550 | } else if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('json') || mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('text') || mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('*/*') || mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('xml')) {
|
6551 | let xmlRootStart = '';
|
6552 | let xmlRootEnd = '';
|
6553 | let exampleFormat = '';
|
6554 | let exampleValue = '';
|
6555 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('xml')) {
|
6556 | var _schema$xml5, _schema$xml6;
|
6557 | xmlRootStart = (_schema$xml5 = schema.xml) !== null && _schema$xml5 !== void 0 && _schema$xml5.name ? `<${schema.xml.name} ${schema.xml.namespace ? `xmlns="${schema.xml.namespace}"` : ''}>` : '<root>';
|
6558 | xmlRootEnd = (_schema$xml6 = schema.xml) !== null && _schema$xml6 !== void 0 && _schema$xml6.name ? `</${schema.xml.name}>` : '</root>';
|
6559 | exampleFormat = 'text';
|
6560 | } else {
|
6561 | exampleFormat = outputType;
|
6562 | }
|
6563 | const samples = schemaToSampleObj(schema, {
|
6564 | includeReadOnly,
|
6565 | includeWriteOnly,
|
6566 | deprecated: true,
|
6567 | useXmlTagForProp: mimeType === null || mimeType === void 0 ? void 0 : mimeType.toLowerCase().includes('xml')
|
6568 | });
|
6569 | let i = 0;
|
6570 | for (const samplesKey in samples) {
|
6571 | if (!samples[samplesKey]) {
|
6572 | continue;
|
6573 | }
|
6574 | const summary = samples[samplesKey]['::TITLE'] || `Example ${++i}`;
|
6575 | const description = samples[samplesKey]['::DESCRIPTION'] || '';
|
6576 | if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('xml')) {
|
6577 | exampleValue = `<?xml version="1.0" encoding="UTF-8"?>\n${xmlRootStart}${json2xml(samples[samplesKey], 1)}\n${xmlRootEnd}`;
|
6578 | } else {
|
6579 | removeTitlesAndDescriptions(samples[samplesKey]);
|
6580 | exampleValue = outputType === 'text' ? JSON.stringify(samples[samplesKey], null, 2) : samples[samplesKey];
|
6581 | }
|
6582 | finalExamples.push({
|
6583 | exampleId: samplesKey,
|
6584 | exampleSummary: summary,
|
6585 | exampleDescription: description,
|
6586 | exampleType: mimeType,
|
6587 | exampleFormat,
|
6588 | exampleValue
|
6589 | });
|
6590 | }
|
6591 | } else if (mimeType !== null && mimeType !== void 0 && mimeType.toLowerCase().includes('jose')) {
|
6592 | finalExamples.push({
|
6593 | exampleId: 'Example',
|
6594 | exampleSummary: 'Base64 Encoded',
|
6595 | exampleDescription: '',
|
6596 | exampleType: mimeType,
|
6597 | exampleValue: schema.pattern || 'bXJpbg==',
|
6598 | exampleFormat: 'text'
|
6599 | });
|
6600 | } else {
|
6601 | finalExamples.push({
|
6602 | exampleId: 'Example',
|
6603 | exampleSummary: '',
|
6604 | exampleDescription: '',
|
6605 | exampleType: mimeType,
|
6606 | exampleValue: '',
|
6607 | exampleFormat: 'text'
|
6608 | });
|
6609 | }
|
6610 | } else {
|
6611 |
|
6612 | finalExamples.push({
|
6613 | exampleId: 'Example',
|
6614 | exampleSummary: '',
|
6615 | exampleDescription: '',
|
6616 | exampleType: mimeType,
|
6617 | exampleValue: '',
|
6618 | exampleFormat: 'text'
|
6619 | });
|
6620 | }
|
6621 | }
|
6622 | return finalExamples;
|
6623 | }
|
6624 | function getSerializeStyleForContentType(contentType) {
|
6625 | if (contentType === 'application/json') {
|
6626 | return 'json';
|
6627 | }
|
6628 | if (contentType === 'application/xml') {
|
6629 | return 'xml';
|
6630 | }
|
6631 | return null;
|
6632 | }
|
6633 | function getSchemaFromParam(param) {
|
6634 | if (param.schema) {
|
6635 | return [param.schema, null, null];
|
6636 | }
|
6637 | if (param.content) {
|
6638 |
|
6639 | for (const contentType of Object.keys(param.content)) {
|
6640 | if (param.content[contentType].schema) {
|
6641 | return [param.content[contentType].schema, getSerializeStyleForContentType(contentType), param.content[contentType]];
|
6642 | }
|
6643 | }
|
6644 | }
|
6645 | return [null, null, null];
|
6646 | }
|
6647 | ;
|
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 |
|
6653 |
|
6654 | class JsonTree extends lit_element_h {
|
6655 | static get properties() {
|
6656 | return {
|
6657 | data: {
|
6658 | type: Object
|
6659 | },
|
6660 | renderStyle: {
|
6661 | type: String,
|
6662 | attribute: 'render-style'
|
6663 | }
|
6664 | };
|
6665 | }
|
6666 | static get styles() {
|
6667 | return [font_styles, border_styles, input_styles, i`
|
6668 | :host{
|
6669 | display:flex;
|
6670 | }
|
6671 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
6672 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
6673 | .json-tree {
|
6674 | position: relative;
|
6675 | font-family: var(--font-mono);
|
6676 | font-size: var(--font-size-small);
|
6677 | display:inline-block;
|
6678 | overflow:hidden;
|
6679 | word-break: break-all;
|
6680 | flex:1;
|
6681 | line-height: calc(var(--font-size-small) + 6px);
|
6682 | min-height: 40px;
|
6683 | direction: ltr;
|
6684 | text-align: left;
|
6685 | }
|
6686 |
|
6687 | .open-bracket {
|
6688 | display:inline-block;
|
6689 | padding: 0 20px 0 0;
|
6690 | cursor:pointer;
|
6691 | border: 1px solid transparent;
|
6692 | border-radius:3px;
|
6693 | }
|
6694 | .close-bracket {
|
6695 | border: 1px solid transparent;
|
6696 | border-radius:3px;
|
6697 | display:inline-block;
|
6698 | }
|
6699 | .open-bracket:hover {
|
6700 | color:var(--primary-color);
|
6701 | background-color:var(--hover-color);
|
6702 | border: 1px solid var(--border-color);
|
6703 | }
|
6704 | .open-bracket.expanded:hover ~ .inside-bracket {
|
6705 | border-left: 1px solid var(--fg3);
|
6706 | }
|
6707 | .open-bracket.expanded:hover ~ .close-bracket {
|
6708 | color:var(--primary-color);
|
6709 | }
|
6710 | .inside-bracket {
|
6711 | padding-left:12px;
|
6712 | overflow: hidden;
|
6713 | border-left:1px dotted var(--border-color);
|
6714 | }
|
6715 | .open-bracket.collapsed + .inside-bracket,
|
6716 | .open-bracket.collapsed + .inside-bracket + .close-bracket {
|
6717 | display:none;
|
6718 | }
|
6719 |
|
6720 | .string{color:var(--green);}
|
6721 | .number{color:var(--blue);}
|
6722 | .null{color:var(--red);}
|
6723 | .boolean{color:var(--purple);}
|
6724 | .object{color:var(--fg)}
|
6725 | .toolbar {
|
6726 | position: absolute;
|
6727 | top:5px;
|
6728 | right:6px;
|
6729 | display:flex;
|
6730 | padding:2px;
|
6731 | align-items: center;
|
6732 | }`, custom_styles];
|
6733 | }
|
6734 |
|
6735 |
|
6736 | render() {
|
6737 | return ke`
|
6738 | <div class = "json-tree" @click='${e => {
|
6739 | if (e.target.classList.contains('btn-copy')) {
|
6740 | copyToClipboard(JSON.stringify(this.data, null, 2), e);
|
6741 | } else {
|
6742 | this.toggleExpand(e);
|
6743 | }
|
6744 | }}'>
|
6745 | <div class='toolbar'>
|
6746 | <button class="toolbar-btn btn-copy" part="btn btn-fill btn-copy"> Copy </button>
|
6747 | </div>
|
6748 | ${this.generateTree(this.data, true)}
|
6749 | </div>
|
6750 | `;
|
6751 | }
|
6752 | generateTree(data, isLast = false) {
|
6753 | if (data === null) {
|
6754 | return ke`<span class="null">null</span>${isLast ? '' : ','}`;
|
6755 | }
|
6756 | if (typeof data === 'object' && data instanceof Date === false) {
|
6757 | const detailType = Array.isArray(data) ? 'array' : 'pure_object';
|
6758 | if (Object.keys(data).length === 0) {
|
6759 | return ke`${Array.isArray(data) ? '[ ],' : '{ },'}`;
|
6760 | }
|
6761 | return ke`
|
6762 | <div class="open-bracket expanded ${detailType === 'array' ? 'array' : 'object'}" > ${detailType === 'array' ? '[' : '{'}</div>
|
6763 | <div class="inside-bracket">
|
6764 | ${Object.keys(data).map((key, i, a) => ke`
|
6765 | <div class="item">
|
6766 | ${detailType === 'pure_object' ? ke`"${key}":` : ''}
|
6767 | ${this.generateTree(data[key], i === a.length - 1)}
|
6768 | </div>`)}
|
6769 | </div>
|
6770 | <div class="close-bracket">${detailType === 'array' ? ']' : '}'}${isLast ? '' : ','}</div>
|
6771 | `;
|
6772 | }
|
6773 | return typeof data === 'string' || data instanceof Date ? ke`<span class="${typeof data}">"${data}"</span>${isLast ? '' : ','}` : ke`<span class="${typeof data}">${data}</span>${isLast ? '' : ','}`;
|
6774 | }
|
6775 |
|
6776 |
|
6777 | toggleExpand(e) {
|
6778 | const openBracketEl = e.target;
|
6779 | if (e.target.classList.contains('open-bracket')) {
|
6780 | if (openBracketEl.classList.contains('expanded')) {
|
6781 | openBracketEl.classList.replace('expanded', 'collapsed');
|
6782 | e.target.innerHTML = e.target.classList.contains('array') ? '[...]' : '{...}';
|
6783 | } else {
|
6784 | openBracketEl.classList.replace('collapsed', 'expanded');
|
6785 | e.target.innerHTML = e.target.classList.contains('array') ? '[' : '{';
|
6786 | }
|
6787 | }
|
6788 | }
|
6789 | }
|
6790 |
|
6791 | customElements.define('json-tree', JsonTree);
|
6792 | ;
|
6793 |
|
6794 | const schema_styles = (i`
|
6795 |
|
6796 | *, *:before, *:after { box-sizing: border-box; }
|
6797 | :host {
|
6798 | container-type: inline-size;
|
6799 | }
|
6800 |
|
6801 | .tr {
|
6802 | display: flex;
|
6803 | flex: none;
|
6804 | width: 100%;
|
6805 | box-sizing: content-box;
|
6806 | border-bottom: 1px dotted transparent;
|
6807 | transition: max-height 0.3s ease-out;
|
6808 | }
|
6809 | .td {
|
6810 | display: block;
|
6811 | flex: 0 0 auto;
|
6812 | }
|
6813 | .key {
|
6814 | font-family: var(--font-mono);
|
6815 | white-space: normal;
|
6816 | word-break: break-all;
|
6817 | }
|
6818 |
|
6819 | .collapsed-all-descr .key {
|
6820 | overflow:hidden;
|
6821 | }
|
6822 | .expanded-all-descr .key-descr .descr-expand-toggle {
|
6823 | display:none;
|
6824 | }
|
6825 |
|
6826 | .key-descr .descr-expand-toggle {
|
6827 | display:inline-block;
|
6828 | user-select:none;
|
6829 | color: var(--fg);
|
6830 | cursor: pointer;
|
6831 | transform: rotate(45deg);
|
6832 | transition: transform .2s ease;
|
6833 | }
|
6834 |
|
6835 | .expanded-descr .key-descr .descr-expand-toggle {
|
6836 | transform: rotate(270deg)
|
6837 | }
|
6838 |
|
6839 | .key-descr .descr-expand-toggle:hover {
|
6840 | color: var(--primary-color);
|
6841 | }
|
6842 |
|
6843 | .expanded-descr .more-content { display:none; }
|
6844 |
|
6845 | .key-descr {
|
6846 | font-family:var(--font-regular);
|
6847 | color:var(--light-fg);
|
6848 | flex-shrink: 1;
|
6849 | text-overflow: ellipsis;
|
6850 | overflow: hidden;
|
6851 | display: none;
|
6852 | }
|
6853 | .expanded-descr .key-descr{
|
6854 | max-height:auto;
|
6855 | overflow:hidden;
|
6856 | display: none;
|
6857 | }
|
6858 |
|
6859 | .xxx-of-key {
|
6860 | font-size: calc(var(--font-size-small) - 2px);
|
6861 | font-weight:bold;
|
6862 | background-color:var(--primary-color);
|
6863 | color:var(--primary-color-invert);
|
6864 | border-radius:2px;
|
6865 | line-height:calc(var(--font-size-small) + 6px);
|
6866 | padding:0px 5px;
|
6867 | margin-bottom:1px;
|
6868 | display:inline-block;
|
6869 | }
|
6870 |
|
6871 | .xxx-of-descr {
|
6872 | font-family: var(--font-regular);
|
6873 | color: var(--primary-color);
|
6874 | font-size: calc(var(--font-size-small) - 1px);
|
6875 | margin-left: 2px;
|
6876 | }
|
6877 |
|
6878 | .stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host { color:var(--green); }
|
6879 | .inte, .numb, .number, .int6, .int3, .floa, .doub, .deci .blue { color:var(--blue); }
|
6880 | .null { color:var(--red); }
|
6881 | .bool, .boolean { color:var(--orange) }
|
6882 | .enum { color:var(--purple) }
|
6883 | .cons { color:var(--purple) }
|
6884 | .recu { color:var(--brown) }
|
6885 | .toolbar {
|
6886 | display:flex;
|
6887 | width:100%;
|
6888 | padding: 2px 0;
|
6889 | color:var(--primary-color);
|
6890 | }
|
6891 | .toolbar-item {
|
6892 | cursor:pointer;
|
6893 | padding:5px 0;
|
6894 | margin:0 2px;
|
6895 | }
|
6896 | .schema-root-type {
|
6897 | cursor:auto;
|
6898 | color:var(--fg2);
|
6899 | font-weight: bold;
|
6900 | text-transform: uppercase;
|
6901 | }
|
6902 | .toolbar-item:first-of-type { margin:0 2px 0 0;}
|
6903 |
|
6904 | @container (min-width: 500px) {
|
6905 | .key-descr {
|
6906 | display: block;
|
6907 | }
|
6908 | .expanded-descr .key-descr {
|
6909 | display: block;
|
6910 | }
|
6911 | }
|
6912 | `);
|
6913 | ;
|
6914 |
|
6915 |
|
6916 |
|
6917 |
|
6918 |
|
6919 |
|
6920 |
|
6921 | class SchemaTree extends lit_element_h {
|
6922 | static get properties() {
|
6923 | return {
|
6924 | data: {
|
6925 | type: Object
|
6926 | },
|
6927 | schemaExpandLevel: {
|
6928 | type: Number,
|
6929 | attribute: 'schema-expand-level'
|
6930 | },
|
6931 | schemaDescriptionExpanded: {
|
6932 | type: String,
|
6933 | attribute: 'schema-description-expanded'
|
6934 | },
|
6935 | allowSchemaDescriptionExpandToggle: {
|
6936 | type: String,
|
6937 | attribute: 'allow-schema-description-expand-toggle'
|
6938 | },
|
6939 | schemaHideReadOnly: {
|
6940 | type: String,
|
6941 | attribute: 'schema-hide-read-only'
|
6942 | },
|
6943 | schemaHideWriteOnly: {
|
6944 | type: String,
|
6945 | attribute: 'schema-hide-write-only'
|
6946 | }
|
6947 | };
|
6948 | }
|
6949 | connectedCallback() {
|
6950 | super.connectedCallback();
|
6951 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
6952 | this.schemaExpandLevel = 99999;
|
6953 | }
|
6954 | if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) {
|
6955 | this.schemaDescriptionExpanded = 'false';
|
6956 | }
|
6957 | if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) {
|
6958 | this.schemaHideReadOnly = 'true';
|
6959 | }
|
6960 | if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) {
|
6961 | this.schemaHideWriteOnly = 'true';
|
6962 | }
|
6963 | }
|
6964 | static get styles() {
|
6965 | return [font_styles, schema_styles, border_styles, i`
|
6966 | .tree {
|
6967 | font-size:var(--font-size-small);
|
6968 | text-align: left;
|
6969 | direction: ltr;
|
6970 | line-height:calc(var(--font-size-small) + 6px);
|
6971 | }
|
6972 | .tree .tr:hover{
|
6973 | background-color:var(--hover-color);
|
6974 | }
|
6975 | .collapsed-all-descr .tr:not(.expanded-descr) {
|
6976 | overflow: hidden;
|
6977 | max-height:calc(var(--font-size-small) + 8px);
|
6978 | }
|
6979 | .tree .key {
|
6980 | max-width: 300px;
|
6981 | }
|
6982 | .tr.expanded:hover > .td.key > .open-bracket {
|
6983 | color: var(--primary-color);
|
6984 | }
|
6985 | .tr.expanded:hover + .inside-bracket {
|
6986 | border-left: 1px solid var(--fg3);
|
6987 | }
|
6988 | .tr.expanded:hover + .inside-bracket + .close-bracket {
|
6989 | color: var(--primary-color);
|
6990 | }
|
6991 | .inside-bracket.xxx-of-option {
|
6992 | border-left: 1px solid transparent;
|
6993 | }
|
6994 | .open-bracket{
|
6995 | display:inline-block;
|
6996 | padding: 0 20px 0 0;
|
6997 | cursor:pointer;
|
6998 | border: 1px solid transparent;
|
6999 | border-radius:3px;
|
7000 | }
|
7001 | .open-bracket:hover {
|
7002 | color:var(--primary-color);
|
7003 | background-color:var(--hover-color);
|
7004 | border: 1px solid var(--border-color);
|
7005 | }
|
7006 | .close-bracket{
|
7007 | display:inline-block;
|
7008 | font-family: var(--font-mono);
|
7009 | }
|
7010 | .tr.collapsed + .inside-bracket,
|
7011 | .tr.collapsed + .inside-bracket + .close-bracket{
|
7012 | overflow: hidden;
|
7013 | display:none;
|
7014 | }
|
7015 | .inside-bracket.object,
|
7016 | .inside-bracket.array {
|
7017 | border-left: 1px dotted var(--border-color);
|
7018 | }`, custom_styles];
|
7019 | }
|
7020 |
|
7021 |
|
7022 | render() {
|
7023 | var _this$data, _this$data2, _this$data3;
|
7024 | return ke`
|
7025 | <div class="tree ${this.schemaDescriptionExpanded === 'true' ? 'expanded-all-descr' : 'collapsed-all-descr'}" @click="${e => this.handleAllEvents(e)}">
|
7026 | <div class="toolbar">
|
7027 | <div class="toolbar-item schema-root-type ${((_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data['::type']) || ''} "> ${((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2['::type']) || ''} </div>
|
7028 | ${this.allowSchemaDescriptionExpandToggle === 'true' ? ke`
|
7029 | <div style="flex:1"></div>
|
7030 | <div part="schema-toolbar-item schema-multiline-toggle" class='toolbar-item schema-multiline-toggle'>
|
7031 | ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
|
7032 | </div>` : ''}
|
7033 | </div>
|
7034 | <span part="schema-description" class='m-markdown'> ${unsafe_html_ae(marked(((_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3['::description']) || ''))}</span>
|
7035 | ${this.data ? ke`
|
7036 | ${this.generateTree(this.data['::type'] === 'array' ? this.data['::props'] : this.data, this.data['::type'], this.data['::array-type'] || '')}` : ke`<span class='mono-font' style='color:var(--red)'> Schema not found </span>`}
|
7037 | </div>
|
7038 | `;
|
7039 | }
|
7040 | generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '', isDeprecated = false) {
|
7041 | var _data$Type;
|
7042 | if (this.schemaHideReadOnly === 'true') {
|
7043 | if (dataType === 'array') {
|
7044 | if (readOrWrite === 'readonly') {
|
7045 | return;
|
7046 | }
|
7047 | }
|
7048 | if ((data === null || data === void 0 ? void 0 : data['::readwrite']) === 'readonly') {
|
7049 | return;
|
7050 | }
|
7051 | }
|
7052 | if (this.schemaHideWriteOnly === 'true') {
|
7053 | if (dataType === 'array') {
|
7054 | if (readOrWrite === 'writeonly') {
|
7055 | return;
|
7056 | }
|
7057 | }
|
7058 | if ((data === null || data === void 0 ? void 0 : data['::readwrite']) === 'writeonly') {
|
7059 | return;
|
7060 | }
|
7061 | }
|
7062 | if (!data) {
|
7063 | return ke`<div class="null" style="display:inline;">
|
7064 | <span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span>
|
7065 | ${dataType === 'array' ? ke`<span class='mono-font'> [ ] </span>` : dataType === 'object' ? ke`<span class='mono-font'> { } </span>` : ke`<span class='mono-font'> schema undefined </span>`}
|
7066 | </div>`;
|
7067 | }
|
7068 | if (Object.keys(data).length === 0) {
|
7069 | return ke`<span class="key object">${key}:{ }</span>`;
|
7070 | }
|
7071 | let keyLabel = '';
|
7072 | let keyDescr = '';
|
7073 | if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {
|
7074 | keyLabel = key.replace('::', '').replace('~', ' ');
|
7075 | } else if (key.startsWith('::OPTION')) {
|
7076 | const parts = key.split('~');
|
7077 | [, keyLabel, keyDescr] = parts;
|
7078 | } else {
|
7079 | keyLabel = key;
|
7080 | }
|
7081 | const leftPadding = 12;
|
7082 | const minFieldColWidth = 400 - indentLevel * leftPadding;
|
7083 | let openBracket = '';
|
7084 | let closeBracket = '';
|
7085 | const newSchemaLevel = (_data$Type = data['::type']) !== null && _data$Type !== void 0 && _data$Type.startsWith('xxx-of') ? schemaLevel : schemaLevel + 1;
|
7086 |
|
7087 | const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : indentLevel + 1;
|
7088 | if (data['::type'] === 'object') {
|
7089 | if (dataType === 'array') {
|
7090 | if (schemaLevel < this.schemaExpandLevel) {
|
7091 | openBracket = ke`<span class="open-bracket array-of-object" >[{</span>`;
|
7092 | } else {
|
7093 | openBracket = ke`<span class="open-bracket array-of-object">[{...}]</span>`;
|
7094 | }
|
7095 | closeBracket = '}]';
|
7096 | } else {
|
7097 | if (schemaLevel < this.schemaExpandLevel) {
|
7098 | openBracket = ke`<span class="open-bracket object">${data['::nullable'] ? 'null┃' : ''}{</span>`;
|
7099 | } else {
|
7100 | openBracket = ke`<span class="open-bracket object">${data['::nullable'] ? 'null┃' : ''}{...}</span>`;
|
7101 | }
|
7102 | closeBracket = '}';
|
7103 | }
|
7104 | } else if (data['::type'] === 'array') {
|
7105 | if (dataType === 'array') {
|
7106 | const arrType = arrayType !== 'object' ? arrayType : '';
|
7107 | if (schemaLevel < this.schemaExpandLevel) {
|
7108 | openBracket = ke`<span class="open-bracket array-of-array" data-array-type="${arrType}">[[ ${arrType} </span>`;
|
7109 | } else {
|
7110 | openBracket = ke`<span class="open-bracket array-of-array" data-array-type="${arrType}">[[...]]</span>`;
|
7111 | }
|
7112 | closeBracket = ']]';
|
7113 | } else {
|
7114 | if (schemaLevel < this.schemaExpandLevel) {
|
7115 | openBracket = ke`<span class="open-bracket array">[</span>`;
|
7116 | } else {
|
7117 | openBracket = ke`<span class="open-bracket array">[...]</span>`;
|
7118 | }
|
7119 | closeBracket = ']';
|
7120 | }
|
7121 | }
|
7122 | if (typeof data === 'object') {
|
7123 | var _data$Type2;
|
7124 | return ke`
|
7125 | <div class="tr ${schemaLevel < this.schemaExpandLevel || (_data$Type2 = data['::type']) !== null && _data$Type2 !== void 0 && _data$Type2.startsWith('xxx-of') ? 'expanded' : 'collapsed'} ${data['::type'] || 'no-type-info'}${data['::nullable'] ? ' nullable' : ''}" title="${isDeprecated || data['::deprecated'] ? 'Deprecated' : ''}">
|
7126 | <div class="td key ${isDeprecated || data['::deprecated'] ? 'deprecated' : ''}" style='min-width:${minFieldColWidth}px'>
|
7127 | ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION') ? ke`<span class='key-label xxx-of-key'> ${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : keyLabel === '::props' || keyLabel === '::ARRAY~OF' ? '' : schemaLevel > 0 ? ke`<span class="key-label" title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWrite === 'writeonly' ? 'Write-Only' : ''}">
|
7128 | ${isDeprecated || data['::deprecated'] ? ke`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>` : ''}
|
7129 | ${keyLabel.replace(/\*$/, '')}${keyLabel.endsWith('*') ? ke`<span style="color:var(--red)">*</span>` : ''}${readOrWrite === 'readonly' ? ke` 🆁` : readOrWrite === 'writeonly' ? ke` 🆆` : readOrWrite}:
|
7130 | </span>` : ''}
|
7131 | ${openBracket}
|
7132 | </div>
|
7133 | <div class='td key-descr m-markdown-small'>${unsafe_html_ae(marked(description || ''))}</div>
|
7134 | </div>
|
7135 | <div class='inside-bracket ${data['::type'] || 'no-type-info'}' style='padding-left:${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' ? 0 : leftPadding}px;'>
|
7136 | ${Array.isArray(data) && data[0] ? ke`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, data[0]['::readwrite'], isDeprecated || data[0]['::deprecated'])}` : ke`
|
7137 | ${Object.keys(data).map(dataKey => {
|
7138 | var _data$dataKey;
|
7139 | return ke`
|
7140 | ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel', '::nullable'].includes(dataKey) ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object' ? ke`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, data[dataKey]['::description'], newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '', isDeprecated || data[dataKey]['::deprecated'])}` : '' : ke`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, ((_data$dataKey = data[dataKey]) === null || _data$dataKey === void 0 ? void 0 : _data$dataKey['::description']) || '', newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '', isDeprecated || data[dataKey]['::deprecated'])}`}
|
7141 | `;
|
7142 | })}
|
7143 | `}
|
7144 | </div>
|
7145 | ${data['::type'] && data['::type'].includes('xxx-of') ? '' : ke`<div class='close-bracket'> ${closeBracket} </div>`}
|
7146 | `;
|
7147 | }
|
7148 |
|
7149 |
|
7150 |
|
7151 | const [type, primitiveReadOrWrite, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');
|
7152 | if (primitiveReadOrWrite === '🆁' && this.schemaHideReadOnly === 'true') {
|
7153 | return;
|
7154 | }
|
7155 | if (primitiveReadOrWrite === '🆆' && this.schemaHideWriteOnly === 'true') {
|
7156 | return;
|
7157 | }
|
7158 | const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();
|
7159 | const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? `<span class="descr-expand-toggle ${this.schemaDescriptionExpanded === 'true' ? 'expanded-descr' : ''}">➔</span>` : ''}`;
|
7160 | let finalReadWriteText = '';
|
7161 | let finalReadWriteTip = '';
|
7162 | if (dataType === 'array') {
|
7163 | if (readOrWrite === 'readonly') {
|
7164 | finalReadWriteText = '🆁';
|
7165 | finalReadWriteTip = 'Read-Only';
|
7166 | } else if (readOrWrite === 'writeonly') {
|
7167 | finalReadWriteText = '🆆';
|
7168 | finalReadWriteTip = 'Write-Only';
|
7169 | }
|
7170 | } else if (primitiveReadOrWrite === '🆁') {
|
7171 | finalReadWriteText = '🆁';
|
7172 | finalReadWriteTip = 'Read-Only';
|
7173 | } else if (primitiveReadOrWrite === '🆆') {
|
7174 | finalReadWriteText = '🆆';
|
7175 | finalReadWriteTip = 'Write-Only';
|
7176 | }
|
7177 | return ke`
|
7178 | <div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
|
7179 | <div class="td key ${isDeprecated || deprecated}" style='min-width:${minFieldColWidth}px'>
|
7180 | ${isDeprecated || deprecated ? ke`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>` : ''}
|
7181 | ${keyLabel.endsWith('*') ? ke`<span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>:` : key.startsWith('::OPTION') ? ke`<span class='key-label xxx-of-key'>${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : ke`<span class="key-label">${keyLabel}:</span>`}
|
7182 | <span class="${dataTypeCss}" title="${finalReadWriteTip}">
|
7183 | ${dataType === 'array' ? `[${type}]` : `${type}`}
|
7184 | ${finalReadWriteText}
|
7185 | </span>
|
7186 | </div>
|
7187 | <div class='td key-descr'>
|
7188 | ${description || schemaTitle || schemaDescription ? ke`${ke`<span class="m-markdown-small">
|
7189 | ${unsafe_html_ae(marked(dataType === 'array' ? `${descrExpander} ${description}` : schemaTitle ? `${descrExpander} <b>${schemaTitle}:</b> ${schemaDescription}` : `${descrExpander} ${schemaDescription}`))}
|
7190 | </span>`}` : ''}
|
7191 | ${constraint ? ke`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Constraints: </span>${constraint}</div>` : ''}
|
7192 | ${defaultValue ? ke`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
|
7193 | ${allowedValues ? ke`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>${type === 'const' ? 'Value' : 'Allowed'}: </span>${allowedValues}</div>` : ''}
|
7194 | ${pattern ? ke`<div style='display:inline-block; line-break: anywhere; margin-right:8px'><span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
|
7195 | </div>
|
7196 | </div>
|
7197 | `;
|
7198 | }
|
7199 |
|
7200 |
|
7201 | handleAllEvents(e) {
|
7202 | if (e.target.classList.contains('open-bracket')) {
|
7203 | this.toggleObjectExpand(e);
|
7204 | } else if (e.target.classList.contains('schema-multiline-toggle')) {
|
7205 | this.schemaDescriptionExpanded = this.schemaDescriptionExpanded === 'true' ? 'false' : 'true';
|
7206 | } else if (e.target.classList.contains('descr-expand-toggle')) {
|
7207 | const trEl = e.target.closest('.tr');
|
7208 | if (trEl) {
|
7209 | trEl.classList.toggle('expanded-descr');
|
7210 | trEl.style.maxHeight = trEl.scrollHeight;
|
7211 | }
|
7212 | }
|
7213 | }
|
7214 | toggleObjectExpand(e) {
|
7215 | const rowEl = e.target.closest('.tr');
|
7216 | const nullable = rowEl.classList.contains('nullable');
|
7217 | if (rowEl.classList.contains('expanded')) {
|
7218 | rowEl.classList.replace('expanded', 'collapsed');
|
7219 | e.target.innerHTML = e.target.classList.contains('array-of-object') ? '[{...}]' : e.target.classList.contains('array-of-array') ? '[[...]]' : e.target.classList.contains('array') ? '[...]' : `${nullable ? 'null┃' : ''}{...}`;
|
7220 | } else {
|
7221 | rowEl.classList.replace('collapsed', 'expanded');
|
7222 | e.target.innerHTML = e.target.classList.contains('array-of-object') ? '[{' : e.target.classList.contains('array-of-array') ? `[[ ${e.target.dataset.arrayType}` : e.target.classList.contains('object') ? `${nullable ? 'null┃' : ''}{` : '[';
|
7223 | }
|
7224 | }
|
7225 | }
|
7226 | customElements.define('schema-tree', SchemaTree);
|
7227 | ;
|
7228 |
|
7229 | class TagInput extends lit_element_h {
|
7230 |
|
7231 | render() {
|
7232 | let tagItemTmpl = '';
|
7233 | if (Array.isArray(this.value)) {
|
7234 | tagItemTmpl = ke`${this.value.filter(v => typeof v === 'string' && v.trim() !== '').map(v => ke`<span class='tag'>${v}</span>`)}`;
|
7235 | }
|
7236 | return ke`
|
7237 | <div class='tags'>
|
7238 | ${tagItemTmpl}
|
7239 | <input type="text" class='editor' @paste="${e => this.afterPaste(e)}" @keydown="${this.afterKeyDown}" @blur="${this.onBlur}" placeholder="${this.placeholder || ''}">
|
7240 | </div>
|
7241 | `;
|
7242 | }
|
7243 |
|
7244 |
|
7245 | static get properties() {
|
7246 | return {
|
7247 | placeholder: {
|
7248 | type: String
|
7249 | },
|
7250 | value: {
|
7251 | type: Array,
|
7252 | attribute: 'value'
|
7253 | }
|
7254 | };
|
7255 | }
|
7256 | attributeChangedCallback(name, oldVal, newVal) {
|
7257 | if (name === 'value') {
|
7258 | if (newVal && oldVal !== newVal) {
|
7259 | this.value = newVal.split(',').filter(v => v.trim() !== '');
|
7260 | }
|
7261 | }
|
7262 | super.attributeChangedCallback(name, oldVal, newVal);
|
7263 | }
|
7264 | afterPaste(e) {
|
7265 | const clipboardData = e.clipboardData || window.clipboardData;
|
7266 | const pastedData = clipboardData.getData('Text');
|
7267 | const pastedArray = pastedData ? pastedData.split(',').filter(v => v.trim() !== '') : '';
|
7268 | if (pastedArray) {
|
7269 | if (Array.isArray(this.value)) {
|
7270 | this.value = [...this.value, ...pastedArray];
|
7271 | } else {
|
7272 | this.value = pastedArray;
|
7273 | }
|
7274 | }
|
7275 | e.preventDefault();
|
7276 | }
|
7277 | afterKeyDown(e) {
|
7278 | if (e.keyCode === 13) {
|
7279 | e.stopPropagation();
|
7280 | e.preventDefault();
|
7281 | if (e.target.value) {
|
7282 | if (Array.isArray(this.value)) {
|
7283 | this.value = [...this.value, e.target.value];
|
7284 | } else {
|
7285 | this.value = [e.target.value];
|
7286 | }
|
7287 | e.target.value = '';
|
7288 | }
|
7289 | } else if (e.keyCode === 8) {
|
7290 | if (e.target.value.length === 0) {
|
7291 | if (Array.isArray(this.value) && this.value.length > 0) {
|
7292 | this.value.splice(-1);
|
7293 | this.value = [...this.value];
|
7294 | }
|
7295 | }
|
7296 | }
|
7297 | }
|
7298 | onBlur(e) {
|
7299 | if (e.target.value) {
|
7300 | if (Array.isArray(this.value)) {
|
7301 | this.value = [...this.value, e.target.value];
|
7302 | } else {
|
7303 | this.value = [e.target.value];
|
7304 | }
|
7305 | e.target.value = '';
|
7306 | }
|
7307 | }
|
7308 | static get styles() {
|
7309 | return [i`
|
7310 | .tags {
|
7311 | display:flex;
|
7312 | flex-wrap: wrap;
|
7313 | outline: none;
|
7314 | padding:0;
|
7315 | border-radius:var(--border-radius);
|
7316 | border:1px solid var(--border-color);
|
7317 | cursor:text;
|
7318 | overflow:hidden;
|
7319 | background:var(--input-bg);
|
7320 | }
|
7321 | .tag, .editor {
|
7322 | padding:3px;
|
7323 | margin:2px;
|
7324 | }
|
7325 | .tag{
|
7326 | border:1px solid var(--border-color);
|
7327 | background-color:var(--bg3);
|
7328 | color:var(--fg3);
|
7329 | border-radius:var(--border-radius);
|
7330 | word-break: break-all;
|
7331 | font-size: var(--font-size-small);
|
7332 | }
|
7333 | .tag:hover ~ #cursor {
|
7334 | display: block;
|
7335 | }
|
7336 | .editor {
|
7337 | flex:1;
|
7338 | border:1px solid transparent;
|
7339 | color:var(--fg);
|
7340 | min-width:60px;
|
7341 | outline: none;
|
7342 | line-height: inherit;
|
7343 | font-family:inherit;
|
7344 | background:transparent;
|
7345 | font-size: calc(var(--font-size-small) + 1px);
|
7346 | }
|
7347 | .editor:focus-visible {
|
7348 | outline: 1px solid;
|
7349 | }
|
7350 | .editor::placeholder {
|
7351 | color: var(--placeholder-color);
|
7352 | opacity:1;
|
7353 | }
|
7354 | `];
|
7355 | }
|
7356 | }
|
7357 |
|
7358 | customElements.define('tag-input', TagInput);
|
7359 | ;
|
7360 |
|
7361 |
|
7362 |
|
7363 |
|
7364 |
|
7365 |
|
7366 |
|
7367 |
|
7368 |
|
7369 |
|
7370 |
|
7371 |
|
7372 |
|
7373 |
|
7374 |
|
7375 |
|
7376 |
|
7377 |
|
7378 |
|
7379 |
|
7380 |
|
7381 | class ApiRequest extends lit_element_h {
|
7382 | constructor() {
|
7383 | super();
|
7384 | this.responseMessage = '';
|
7385 | this.responseStatus = 'success';
|
7386 | this.responseHeaders = '';
|
7387 | this.responseText = '';
|
7388 | this.responseUrl = '';
|
7389 | this.curlSyntax = '';
|
7390 | this.activeResponseTab = 'response';
|
7391 | this.selectedRequestBodyType = '';
|
7392 | this.selectedRequestBodyExample = '';
|
7393 | this.activeParameterSchemaTabs = {};
|
7394 | }
|
7395 | static get properties() {
|
7396 | return {
|
7397 | serverUrl: {
|
7398 | type: String,
|
7399 | attribute: 'server-url'
|
7400 | },
|
7401 | servers: {
|
7402 | type: Array
|
7403 | },
|
7404 | method: {
|
7405 | type: String
|
7406 | },
|
7407 | path: {
|
7408 | type: String
|
7409 | },
|
7410 | security: {
|
7411 | type: Array
|
7412 | },
|
7413 | parameters: {
|
7414 | type: Array
|
7415 | },
|
7416 | request_body: {
|
7417 | type: Object
|
7418 | },
|
7419 | api_keys: {
|
7420 | type: Array
|
7421 | },
|
7422 | parser: {
|
7423 | type: Object
|
7424 | },
|
7425 | accept: {
|
7426 | type: String
|
7427 | },
|
7428 | callback: {
|
7429 | type: String
|
7430 | },
|
7431 | webhook: {
|
7432 | type: String
|
7433 | },
|
7434 | responseMessage: {
|
7435 | type: String,
|
7436 | attribute: false
|
7437 | },
|
7438 | responseText: {
|
7439 | type: String,
|
7440 | attribute: false
|
7441 | },
|
7442 | responseHeaders: {
|
7443 | type: String,
|
7444 | attribute: false
|
7445 | },
|
7446 | responseStatus: {
|
7447 | type: String,
|
7448 | attribute: false
|
7449 | },
|
7450 | responseUrl: {
|
7451 | type: String,
|
7452 | attribute: false
|
7453 | },
|
7454 | curlSyntax: {
|
7455 | type: String,
|
7456 | attribute: false
|
7457 | },
|
7458 | fillRequestFieldsWithExample: {
|
7459 | type: String,
|
7460 | attribute: 'fill-request-fields-with-example'
|
7461 | },
|
7462 | allowTry: {
|
7463 | type: String,
|
7464 | attribute: 'allow-try'
|
7465 | },
|
7466 | showCurlBeforeTry: {
|
7467 | type: String,
|
7468 | attribute: 'show-curl-before-try'
|
7469 | },
|
7470 | renderStyle: {
|
7471 | type: String,
|
7472 | attribute: 'render-style'
|
7473 | },
|
7474 | schemaStyle: {
|
7475 | type: String,
|
7476 | attribute: 'schema-style'
|
7477 | },
|
7478 | activeSchemaTab: {
|
7479 | type: String,
|
7480 | attribute: 'active-schema-tab'
|
7481 | },
|
7482 | activeParameterSchemaTabs: {
|
7483 | type: Object,
|
7484 | converter: {
|
7485 | fromAttribute: attr => JSON.parse(attr),
|
7486 | toAttribute: prop => JSON.stringify(prop)
|
7487 | },
|
7488 | attribute: 'active-parameter-schema-tabs'
|
7489 | },
|
7490 | schemaExpandLevel: {
|
7491 | type: Number,
|
7492 | attribute: 'schema-expand-level'
|
7493 | },
|
7494 | schemaDescriptionExpanded: {
|
7495 | type: String,
|
7496 | attribute: 'schema-description-expanded'
|
7497 | },
|
7498 | allowSchemaDescriptionExpandToggle: {
|
7499 | type: String,
|
7500 | attribute: 'allow-schema-description-expand-toggle'
|
7501 | },
|
7502 | schemaHideReadOnly: {
|
7503 | type: String,
|
7504 | attribute: 'schema-hide-read-only'
|
7505 | },
|
7506 | schemaHideWriteOnly: {
|
7507 | type: String,
|
7508 | attribute: 'schema-hide-write-only'
|
7509 | },
|
7510 | fetchCredentials: {
|
7511 | type: String,
|
7512 | attribute: 'fetch-credentials'
|
7513 | },
|
7514 |
|
7515 | activeResponseTab: {
|
7516 | type: String
|
7517 | },
|
7518 |
|
7519 | selectedRequestBodyType: {
|
7520 | type: String,
|
7521 | attribute: 'selected-request-body-type'
|
7522 | },
|
7523 |
|
7524 | selectedRequestBodyExample: {
|
7525 | type: String,
|
7526 | attribute: 'selected-request-body-example'
|
7527 | }
|
7528 | };
|
7529 | }
|
7530 | static get styles() {
|
7531 | return [table_styles, input_styles, font_styles, flex_styles, border_styles, tab_styles, prism_styles, i`
|
7532 | :host {
|
7533 | container-type: inline-size;
|
7534 | }
|
7535 | *, *:before, *:after { box-sizing: border-box; }
|
7536 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
7537 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
7538 | tag-input:focus-within { outline: 1px solid;}
|
7539 | .read-mode {
|
7540 | margin-top: 24px;
|
7541 | }
|
7542 | .param-name,
|
7543 | .param-type {
|
7544 | margin: 1px 0;
|
7545 | text-align: right;
|
7546 | line-height: var(--font-size-small);
|
7547 | }
|
7548 | .param-name {
|
7549 | color: var(--fg);
|
7550 | font-family: var(--font-mono);
|
7551 | }
|
7552 | .param-name.deprecated {
|
7553 | color: var(--red);
|
7554 | }
|
7555 | .param-type{
|
7556 | color: var(--light-fg);
|
7557 | font-family: var(--font-regular);
|
7558 | }
|
7559 | .param-constraint{
|
7560 | min-width:100px;
|
7561 | }
|
7562 | .param-constraint:empty{
|
7563 | display:none;
|
7564 | }
|
7565 | .top-gap{margin-top:24px;}
|
7566 |
|
7567 | .textarea {
|
7568 | min-height:220px;
|
7569 | padding:5px;
|
7570 | resize:vertical;
|
7571 | direction: ltr;
|
7572 | }
|
7573 | .example:first-child {
|
7574 | margin-top: -9px;
|
7575 | }
|
7576 |
|
7577 | .response-message{
|
7578 | font-weight:bold;
|
7579 | text-overflow: ellipsis;
|
7580 | }
|
7581 | .response-message.error {
|
7582 | color:var(--red);
|
7583 | }
|
7584 | .response-message.success {
|
7585 | color:var(--blue);
|
7586 | }
|
7587 |
|
7588 | .file-input-container {
|
7589 | align-items:flex-end;
|
7590 | }
|
7591 | .file-input-container .input-set:first-child .file-input-remove-btn{
|
7592 | visibility:hidden;
|
7593 | }
|
7594 |
|
7595 | .file-input-remove-btn{
|
7596 | font-size:16px;
|
7597 | color:var(--red);
|
7598 | outline: none;
|
7599 | border: none;
|
7600 | background:none;
|
7601 | cursor:pointer;
|
7602 | }
|
7603 |
|
7604 | .v-tab-btn {
|
7605 | font-size: var(--smal-font-size);
|
7606 | height:24px;
|
7607 | border:none;
|
7608 | background:none;
|
7609 | opacity: 0.3;
|
7610 | cursor: pointer;
|
7611 | padding: 4px 8px;
|
7612 | }
|
7613 | .v-tab-btn.active {
|
7614 | font-weight: bold;
|
7615 | background: var(--bg);
|
7616 | opacity: 1;
|
7617 | }
|
7618 |
|
7619 | @container (min-width: 768px) {
|
7620 | .textarea {
|
7621 | padding:8px;
|
7622 | }
|
7623 | }
|
7624 |
|
7625 | @container (max-width: 470px) {
|
7626 | .hide-in-small-screen {
|
7627 | display:none;
|
7628 | }
|
7629 | }
|
7630 | `, custom_styles];
|
7631 | }
|
7632 |
|
7633 |
|
7634 | render() {
|
7635 | return ke`
|
7636 | <div class="col regular-font request-panel ${'read focused'.includes(this.renderStyle) || this.callback === 'true' ? 'read-mode' : 'view-mode'}">
|
7637 | <div class=" ${this.callback === 'true' ? 'tiny-title' : 'req-res-title'} ">
|
7638 | ${this.callback === 'true' ? 'CALLBACK REQUEST' : 'REQUEST'}
|
7639 | </div>
|
7640 | <div>
|
7641 | ${guard_It([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}
|
7642 | ${guard_It([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}
|
7643 | ${this.requestBodyTemplate()}
|
7644 | ${guard_It([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}
|
7645 | ${guard_It([this.method, this.path, this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}
|
7646 | ${this.allowTry === 'false' ? '' : ke`${this.apiCallTemplate()}`}
|
7647 | </div>
|
7648 | </div>
|
7649 | `;
|
7650 | }
|
7651 | async updated() {
|
7652 | if (this.showCurlBeforeTry === 'true') {
|
7653 | this.applyCURLSyntax(this.shadowRoot);
|
7654 | }
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 |
|
7664 |
|
7665 |
|
7666 |
|
7667 |
|
7668 | if (this.webhook === 'true') {
|
7669 | this.allowTry = 'false';
|
7670 | }
|
7671 | }
|
7672 | async saveExampleState() {
|
7673 | if (this.renderStyle === 'focused') {
|
7674 | const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];
|
7675 | reqBodyTextAreaEls.forEach(el => {
|
7676 | el.dataset.user_example = el.value;
|
7677 | });
|
7678 | const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype="form-data"]')];
|
7679 | exampleTextAreaEls.forEach(el => {
|
7680 | el.dataset.user_example = el.value;
|
7681 | });
|
7682 | this.requestUpdate();
|
7683 | }
|
7684 | }
|
7685 | async updateExamplesFromDataAttr() {
|
7686 |
|
7687 |
|
7688 |
|
7689 | if (this.renderStyle === 'focused') {
|
7690 | const reqBodyTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea.request-body-param-user-input')];
|
7691 | reqBodyTextAreaEls.forEach(el => {
|
7692 | el.value = el.dataset.user_example || el.dataset.example;
|
7693 | });
|
7694 | const exampleTextAreaEls = [...this.shadowRoot.querySelectorAll('textarea[data-ptype="form-data"]')];
|
7695 | exampleTextAreaEls.forEach(el => {
|
7696 | el.value = el.dataset.user_example || el.dataset.example;
|
7697 | });
|
7698 | this.requestUpdate();
|
7699 | }
|
7700 | }
|
7701 | renderExample(example, paramType, paramName) {
|
7702 | var _example$value, _example$value2;
|
7703 | return ke`
|
7704 | ${paramType === 'array' ? '[' : ''}
|
7705 | <a
|
7706 | part="anchor anchor-param-example"
|
7707 | style="display:inline-block; min-width:24px; text-align:center"
|
7708 | class="${this.allowTry === 'true' ? '' : 'inactive-link'}"
|
7709 | data-example-type="${paramType === 'array' ? paramType : 'string'}"
|
7710 | data-example="${example.value && Array.isArray(example.value) ? (_example$value = example.value) === null || _example$value === void 0 ? void 0 : _example$value.join('~|~') : (typeof example.value === 'object' ? JSON.stringify(example.value, null, 2) : example.value) || ''}"
|
7711 | title="${example.value && Array.isArray(example.value) ? (_example$value2 = example.value) === null || _example$value2 === void 0 ? void 0 : _example$value2.join('~|~') : (typeof example.value === 'object' ? JSON.stringify(example.value, null, 2) : example.value) || ''}"
|
7712 | @click="${e => {
|
7713 | const inputEl = e.target.closest('table').querySelector(`[data-pname="${paramName}"]`);
|
7714 | if (inputEl) {
|
7715 | inputEl.value = e.target.dataset.exampleType === 'array' ? e.target.dataset.example.split('~|~') : e.target.dataset.example;
|
7716 | }
|
7717 | }}"
|
7718 | > ${example.printableValue || example.value} </a>
|
7719 | ${paramType === 'array' ? '] ' : ''}
|
7720 | `;
|
7721 | }
|
7722 | renderShortFormatExamples(examples, paramType, paramName) {
|
7723 | return ke`${examples.map((x, i) => ke`
|
7724 | ${i === 0 ? '' : '┃'}
|
7725 | ${this.renderExample(x, paramType, paramName)}`)}`;
|
7726 | }
|
7727 | renderLongFormatExamples(exampleList, paramType, paramName) {
|
7728 | return ke` <ul style="list-style-type: disclosure-closed;">
|
7729 | ${exampleList.map(v => {
|
7730 | var _v$summary, _v$description;
|
7731 | return ke`
|
7732 | <li>
|
7733 | ${this.renderExample(v, paramType, paramName)}
|
7734 | ${((_v$summary = v.summary) === null || _v$summary === void 0 ? void 0 : _v$summary.length) > 0 ? ke`<span>(${v.summary})</span>` : ''}
|
7735 | ${((_v$description = v.description) === null || _v$description === void 0 ? void 0 : _v$description.length) > 0 ? ke`<p>${unsafe_html_ae(marked(v.description))}</p>` : ''}
|
7736 | </li>
|
7737 | `;
|
7738 | })}
|
7739 | </ul>`;
|
7740 | }
|
7741 | exampleListTemplate(paramName, paramType, exampleList = []) {
|
7742 | return ke` ${exampleList.length > 0 ? ke`<span style="font-weight:bold">Examples: </span>
|
7743 | ${anyExampleWithSummaryOrDescription(exampleList) ? this.renderLongFormatExamples(exampleList, paramType, paramName) : this.renderShortFormatExamples(exampleList, paramType, paramName)}` : ''}`;
|
7744 | }
|
7745 | inputParametersTemplate(paramType) {
|
7746 | const filteredParams = this.parameters ? this.parameters.filter(param => param.in === paramType) : [];
|
7747 | if (filteredParams.length === 0) {
|
7748 | return '';
|
7749 | }
|
7750 | let title = '';
|
7751 | if (paramType === 'path') {
|
7752 | title = 'PATH PARAMETERS';
|
7753 | } else if (paramType === 'query') {
|
7754 | title = 'QUERY-STRING PARAMETERS';
|
7755 | } else if (paramType === 'header') {
|
7756 | title = 'REQUEST HEADERS';
|
7757 | } else if (paramType === 'cookie') {
|
7758 | title = 'COOKIES';
|
7759 | }
|
7760 | const tableRows = [];
|
7761 | for (const param of filteredParams) {
|
7762 | const [declaredParamSchema, serializeStyle, mimeTypeElem] = getSchemaFromParam(param);
|
7763 | if (!declaredParamSchema) {
|
7764 | continue;
|
7765 | }
|
7766 | const paramSchema = getTypeInfo(declaredParamSchema);
|
7767 | if (!paramSchema) {
|
7768 | continue;
|
7769 | }
|
7770 | const schemaAsObj = schemaInObjectNotation(declaredParamSchema, {});
|
7771 |
|
7772 |
|
7773 | let paramStyle = 'form';
|
7774 | let paramExplode = true;
|
7775 | let paramAllowReserved = false;
|
7776 | if (paramType === 'query' || paramType === 'header' || paramType === 'path') {
|
7777 | if (param.style && 'form spaceDelimited pipeDelimited'.includes(param.style)) {
|
7778 | paramStyle = param.style;
|
7779 | } else if (serializeStyle) {
|
7780 | paramStyle = serializeStyle;
|
7781 | }
|
7782 | if (typeof param.explode === 'boolean') {
|
7783 | paramExplode = param.explode;
|
7784 | }
|
7785 | if (typeof param.allowReserved === 'boolean') {
|
7786 | paramAllowReserved = param.allowReserved;
|
7787 | }
|
7788 | }
|
7789 |
|
7790 | const example = normalizeExamples(standardizeExample(param.examples) || standardizeExample(param.example) || standardizeExample(mimeTypeElem === null || mimeTypeElem === void 0 ? void 0 : mimeTypeElem.example) || standardizeExample(mimeTypeElem === null || mimeTypeElem === void 0 ? void 0 : mimeTypeElem.examples) || standardizeExample(paramSchema.examples) || standardizeExample(paramSchema.example), paramSchema.type);
|
7791 | if (!example.exampleVal && paramSchema.type === 'object') {
|
7792 | example.exampleVal = generateExample(declaredParamSchema, serializeStyle || 'json', {}, {}, this.callback === 'true' || this.webhook === 'true' ? true : false,
|
7793 |
|
7794 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
7795 |
|
7796 | true, 'text', false)[0].exampleValue;
|
7797 | }
|
7798 | const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';
|
7799 | tableRows.push(ke`
|
7800 | <tr title="${param.deprecated ? 'Deprecated' : ''}">
|
7801 | <td rowspan="${this.allowTry === 'true' ? '1' : '2'}" style="width:${labelColWidth}; min-width:100px;">
|
7802 | <div class="param-name ${param.deprecated ? 'deprecated' : ''}" >
|
7803 | ${param.deprecated ? ke`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>` : ''}
|
7804 | ${param.required ? ke`<span style='color:var(--red)'>*</span>` : ''}
|
7805 | ${param.name}
|
7806 | </div>
|
7807 | <div class="param-type">
|
7808 | ${paramSchema.type === 'array' ? `${paramSchema.arrayType}` : `${paramSchema.format ? paramSchema.format : paramSchema.type}`}
|
7809 | </div>
|
7810 | </td>
|
7811 | ${this.allowTry === 'true' ? ke`
|
7812 | <td style="min-width:100px;" colspan="${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern ? '1' : '2'}">
|
7813 | ${paramSchema.type === 'array' ? ke`
|
7814 | <tag-input class="request-param"
|
7815 | id = "tag-input-request-param-${param.name}"
|
7816 | style = "width:100%"
|
7817 | data-ptype = "${paramType}"
|
7818 | data-pname = "${param.name}"
|
7819 | data-example = "${Array.isArray(example.exampleVal) ? example.exampleVal.join('~|~') : example.exampleVal}"
|
7820 | data-param-serialize-style = "${paramStyle}"
|
7821 | data-param-serialize-explode = "${paramExplode}"
|
7822 | data-param-allow-reserved = "${paramAllowReserved}"
|
7823 | data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
|
7824 | data-array = "true"
|
7825 | placeholder = "add-multiple ↩"
|
7826 | .value="${param['x-fill-example'] === 'no' ? [] : live_Ft(this.fillRequestFieldsWithExample === 'true' ? Array.isArray(example.exampleVal) ? example.exampleVal : [example.exampleVal] : [])}"
|
7827 | >
|
7828 | </tag-input>` : paramSchema.type === 'object' ? ke`
|
7829 | <div part="tab-panel" class="tab-panel col" style="border-width:0 0 1px 0;">
|
7830 | <div part="tab-btn-row" class="tab-buttons row" @click="${e => {
|
7831 | if (e.target.tagName.toLowerCase() === 'button') {
|
7832 | const newState = {
|
7833 | ...this.activeParameterSchemaTabs
|
7834 | };
|
7835 | newState[param.name] = e.target.dataset.tab;
|
7836 | this.activeParameterSchemaTabs = newState;
|
7837 | }
|
7838 | }}">
|
7839 | <button part="tab-btn" class="tab-btn ${this.activeParameterSchemaTabs[param.name] === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
|
7840 | <button part="tab-btn" class="tab-btn ${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
|
7841 | </div>
|
7842 |
|
7843 | ${ke`<div part="tab-content" class="tab-content col" data-tab = 'example' style="display:${this.activeParameterSchemaTabs[param.name] === 'example' ? 'block' : 'none'}; padding-left:5px; width:100%">
|
7844 | <textarea
|
7845 | id = "textarea-request-param-${param.name}"
|
7846 | class = "textarea request-param"
|
7847 | part = "textarea textarea-param"
|
7848 | data-ptype = "${paramType}-object"
|
7849 | data-pname = "${param.name}"
|
7850 | data-example = "${example.exampleVal}"
|
7851 | data-param-serialize-style = "${paramStyle}"
|
7852 | data-param-serialize-explode = "${paramExplode}"
|
7853 | data-param-allow-reserved = "${paramAllowReserved}"
|
7854 | data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
|
7855 | spellcheck = "false"
|
7856 | .textContent="${param['x-fill-example'] === 'no' ? '' : live_Ft(this.fillRequestFieldsWithExample === 'true' ? typeof example.exampleVal === 'object' ? JSON.stringify(example.exampleVal, null, 2) : example.exampleVal : '')}"
|
7857 | style = "resize:vertical; width:100%; height: ${'read focused'.includes(this.renderStyle) ? '180px' : '120px'};"
|
7858 | @input=${e => {
|
7859 | const requestPanelEl = this.getRequestPanel(e);
|
7860 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
7861 | }}
|
7862 | ></textarea>
|
7863 | </div>`}
|
7864 | ${ke`<div part="tab-content" class="tab-content col" data-tab = 'schema' style="display:${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'block' : 'none'}; padding-left:5px; width:100%;">
|
7865 | <schema-tree
|
7866 | class = 'json'
|
7867 | style = 'display: block'
|
7868 | .data = '${schemaAsObj}'
|
7869 | schema-expand-level = "${this.schemaExpandLevel}"
|
7870 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
7871 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
7872 | schema-hide-read-only = "${this.schemaHideReadOnly.includes(this.method)}"
|
7873 | schema-hide-write-only = "${this.schemaHideWriteOnly.includes(this.method)}"
|
7874 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
7875 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
7876 | anchor:anchor, anchor-param-example:anchor-param-example"
|
7877 | > </schema-tree>
|
7878 | </div>`}
|
7879 | </div>` : ke`
|
7880 | <input type="${paramSchema.format === 'password' ? 'password' : 'text'}" spellcheck="false" style="width:100%"
|
7881 | id="input-request-param-${param.name}"
|
7882 | class="request-param"
|
7883 | part="textbox textbox-param"
|
7884 | data-ptype="${paramType}"
|
7885 | data-pname="${param.name}"
|
7886 | data-example="${Array.isArray(example.exampleVal) ? example.exampleVal.join('~|~') : example.exampleVal}"
|
7887 | data-param-allow-reserved = "${paramAllowReserved}"
|
7888 | data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
|
7889 | data-array="false"
|
7890 | .value="${param['x-fill-example'] === 'no' ? '' : live_Ft(this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : '')}"
|
7891 | @input=${e => {
|
7892 | const requestPanelEl = this.getRequestPanel(e);
|
7893 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
7894 | }}
|
7895 | />`}
|
7896 | </td>` : ''}
|
7897 | ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern ? ke`
|
7898 | <td colspan="${this.allowTry === 'true' ? '1' : '2'}">
|
7899 | <div class="param-constraint">
|
7900 | ${paramSchema.default ? ke`<span style="font-weight:bold">Default: </span>${paramSchema.default}<br/>` : ''}
|
7901 | ${paramSchema.pattern ? ke`<span style="font-weight:bold">Pattern: </span>${paramSchema.pattern}<br/>` : ''}
|
7902 | ${paramSchema.constrain ? ke`${paramSchema.constrain}<br/>` : ''}
|
7903 | ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => ke`
|
7904 | ${i > 0 ? '┃' : ke`<span style="font-weight:bold">Allowed: </span>`}
|
7905 | ${ke`
|
7906 | <a part="anchor anchor-param-constraint" class = "${this.allowTry === 'true' ? '' : 'inactive-link'}"
|
7907 | data-type="${paramSchema.type === 'array' ? paramSchema.type : 'string'}"
|
7908 | data-enum="${v.trim()}"
|
7909 | @click="${e => {
|
7910 | const inputEl = e.target.closest('table').querySelector(`[data-pname="${param.name}"]`);
|
7911 | if (inputEl) {
|
7912 | if (e.target.dataset.type === 'array') {
|
7913 | inputEl.value = [e.target.dataset.enum];
|
7914 | } else {
|
7915 | inputEl.value = e.target.dataset.enum;
|
7916 | }
|
7917 | }
|
7918 | }}"
|
7919 | >${v}</a>`}`)}
|
7920 | </div>
|
7921 | </td>` : ke`<td></td>`}
|
7922 | </tr>
|
7923 | <tr>
|
7924 | ${this.allowTry === 'true' ? ke`<td style="border:none"> </td>` : ''}
|
7925 | <td colspan="2" style="border:none">
|
7926 | <span class="m-markdown-small">${unsafe_html_ae(marked(param.description || ''))}</span>
|
7927 | ${this.exampleListTemplate.call(this, param.name, paramSchema.type, example.exampleList)}
|
7928 | </td>
|
7929 | </tr>
|
7930 | `);
|
7931 | }
|
7932 | return ke`
|
7933 | <div class="table-title top-gap">${title}</div>
|
7934 | <div style="display:block; overflow-x:auto; max-width:100%;">
|
7935 | <table role="presentation" class="m-table" style="width:100%; word-break:break-word;">
|
7936 | ${tableRows}
|
7937 | </table>
|
7938 | </div>`;
|
7939 | }
|
7940 |
|
7941 |
|
7942 | async beforeNavigationFocusedMode() {
|
7943 |
|
7944 | }
|
7945 |
|
7946 |
|
7947 | async afterNavigationFocusedMode() {
|
7948 | this.selectedRequestBodyType = '';
|
7949 | this.selectedRequestBodyExample = '';
|
7950 | this.updateExamplesFromDataAttr();
|
7951 | this.clearResponseData();
|
7952 | }
|
7953 |
|
7954 |
|
7955 | onSelectExample(e) {
|
7956 | this.selectedRequestBodyExample = e.target.value;
|
7957 | const exampleDropdownEl = e.target;
|
7958 | window.setTimeout(selectEl => {
|
7959 | const readOnlyExampleEl = selectEl.closest('.example-panel').querySelector('.request-body-param');
|
7960 | const userInputExampleTextareaEl = selectEl.closest('.example-panel').querySelector('.request-body-param-user-input');
|
7961 | userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;
|
7962 | const requestPanelEl = this.getRequestPanel({
|
7963 | target: selectEl
|
7964 | });
|
7965 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
7966 | }, 0, exampleDropdownEl);
|
7967 | }
|
7968 | onMimeTypeChange(e) {
|
7969 | this.selectedRequestBodyType = e.target.value;
|
7970 | const mimeDropdownEl = e.target;
|
7971 | this.selectedRequestBodyExample = '';
|
7972 | window.setTimeout(selectEl => {
|
7973 | const readOnlyExampleEl = selectEl.closest('.request-body-container').querySelector('.request-body-param');
|
7974 | if (readOnlyExampleEl) {
|
7975 | const userInputExampleTextareaEl = selectEl.closest('.request-body-container').querySelector('.request-body-param-user-input');
|
7976 | userInputExampleTextareaEl.value = readOnlyExampleEl.innerText;
|
7977 | }
|
7978 | }, 0, mimeDropdownEl);
|
7979 | }
|
7980 | requestBodyTemplate() {
|
7981 | if (!this.request_body) {
|
7982 | return '';
|
7983 | }
|
7984 | if (Object.keys(this.request_body).length === 0) {
|
7985 | return '';
|
7986 | }
|
7987 |
|
7988 |
|
7989 | let reqBodyTypeSelectorHtml = '';
|
7990 | let reqBodyFileInputHtml = '';
|
7991 | let reqBodyFormHtml = '';
|
7992 | let reqBodySchemaHtml = '';
|
7993 | let reqBodyExampleHtml = '';
|
7994 | const requestBodyTypes = [];
|
7995 | const {
|
7996 | content
|
7997 | } = this.request_body;
|
7998 | for (const mimeType in content) {
|
7999 | requestBodyTypes.push({
|
8000 | mimeType,
|
8001 | schema: content[mimeType].schema,
|
8002 | example: content[mimeType].example,
|
8003 | examples: content[mimeType].examples
|
8004 | });
|
8005 | if (!this.selectedRequestBodyType) {
|
8006 | this.selectedRequestBodyType = mimeType;
|
8007 | }
|
8008 | }
|
8009 |
|
8010 | reqBodyTypeSelectorHtml = requestBodyTypes.length === 1 ? '' : ke`
|
8011 | <select style="min-width:100px; max-width:100%; margin-bottom:-1px;" @change = '${e => this.onMimeTypeChange(e)}'>
|
8012 | ${requestBodyTypes.map(reqBody => ke`
|
8013 | <option value = '${reqBody.mimeType}' ?selected = '${reqBody.mimeType === this.selectedRequestBodyType}'>
|
8014 | ${reqBody.mimeType}
|
8015 | </option> `)}
|
8016 | </select>
|
8017 | `;
|
8018 |
|
8019 |
|
8020 | requestBodyTypes.forEach(reqBody => {
|
8021 | let schemaAsObj;
|
8022 | let reqBodyExamples = [];
|
8023 | if (this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose')) {
|
8024 |
|
8025 | if (reqBody.mimeType === this.selectedRequestBodyType) {
|
8026 | reqBodyExamples = generateExample(reqBody.schema, reqBody.mimeType, standardizeExample(reqBody.examples), standardizeExample(reqBody.example), this.callback === 'true' || this.webhook === 'true' ? true : false,
|
8027 |
|
8028 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
8029 |
|
8030 | 'text', false);
|
8031 | if (!this.selectedRequestBodyExample) {
|
8032 | this.selectedRequestBodyExample = reqBodyExamples.length > 0 ? reqBodyExamples[0].exampleId : '';
|
8033 | }
|
8034 | reqBodyExampleHtml = ke`
|
8035 | ${reqBodyExampleHtml}
|
8036 | <div class = 'example-panel border-top pad-top-8'>
|
8037 | ${reqBodyExamples.length === 1 ? '' : ke`
|
8038 | <select style="min-width:100px; max-width:100%; margin-bottom:-1px;" @change='${e => this.onSelectExample(e)}'>
|
8039 | ${reqBodyExamples.map(v => ke`<option value="${v.exampleId}" ?selected=${v.exampleId === this.selectedRequestBodyExample} >
|
8040 | ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary ? v.exampleSummary : v.exampleId}
|
8041 | </option>`)}
|
8042 | </select>
|
8043 | `}
|
8044 | ${reqBodyExamples.filter(v => v.exampleId === this.selectedRequestBodyExample).map(v => ke`
|
8045 | <div class="example ${v.exampleId === this.selectedRequestBodyExample ? 'example-selected' : ''}" data-example = '${v.exampleId}'>
|
8046 | ${v.exampleSummary && v.exampleSummary.length > 80 ? ke`<div style="padding: 4px 0"> ${v.exampleSummary} </div>` : ''}
|
8047 | ${v.exampleDescription ? ke`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_ae(marked(v.exampleDescription || ''))} </div>` : ''}
|
8048 | <!-- This pre(hidden) is to store the original example value, this will remain unchanged when users switches from one example to another, its is used to populate the editable textarea -->
|
8049 | <pre
|
8050 | class = "textarea is-hidden request-body-param ${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}"
|
8051 | spellcheck = "false"
|
8052 | data-ptype = "${reqBody.mimeType}"
|
8053 | style="width:100%; resize:vertical; display:none"
|
8054 | >${v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2)}</pre>
|
8055 |
|
8056 | <!-- this textarea is for user to edit the example -->
|
8057 | <textarea
|
8058 | class = "textarea request-body-param-user-input"
|
8059 | part = "textarea textarea-param"
|
8060 | spellcheck = "false"
|
8061 | data-ptype = "${reqBody.mimeType}"
|
8062 | data-example = "${v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2)}"
|
8063 | data-example-format = "${v.exampleFormat}"
|
8064 | style="width:100%; resize:vertical;"
|
8065 | .textContent = "${this.fillRequestFieldsWithExample === 'true' ? v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2) : ''}"
|
8066 | @input=${e => {
|
8067 | const requestPanelEl = this.getRequestPanel(e);
|
8068 | this.liveCURLSyntaxUpdate(requestPanelEl);
|
8069 | }}
|
8070 | @keydown=${e => {
|
8071 | if ((e.keyCode === 10 || e.keyCode === 13) && e.ctrlKey) {
|
8072 | return this.onTryClick(e);
|
8073 | }
|
8074 | }}
|
8075 |
|
8076 | ></textarea>
|
8077 | </div>
|
8078 | `)}
|
8079 |
|
8080 | </div>
|
8081 | `;
|
8082 | }
|
8083 | } else if (this.selectedRequestBodyType.includes('form-urlencoded') || this.selectedRequestBodyType.includes('form-data')) {
|
8084 | if (reqBody.mimeType === this.selectedRequestBodyType) {
|
8085 | const ex = generateExample(reqBody.schema, reqBody.mimeType, reqBody.examples, reqBody.example, this.callback === 'true' || this.webhook === 'true' ? true : false,
|
8086 |
|
8087 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
8088 |
|
8089 | 'text', false);
|
8090 | if (reqBody.schema) {
|
8091 | reqBodyFormHtml = this.formDataTemplate(reqBody.schema, reqBody.mimeType, ex[0] ? ex[0].exampleValue : '');
|
8092 | }
|
8093 | }
|
8094 | } else if (/^audio\/|^image\/|^video\/|^font\/|tar$|zip$|7z$|rtf$|msword$|excel$|\/pdf$|\/octet-stream$/.test(this.selectedRequestBodyType)) {
|
8095 | if (reqBody.mimeType === this.selectedRequestBodyType) {
|
8096 | reqBodyFileInputHtml = ke`
|
8097 | <div class = "small-font-size bold-text row">
|
8098 | <input id="input-request-body-param-file" type="file" part="file-input" style="max-width:100%" class="request-body-param-file" data-ptype="${reqBody.mimeType}" spellcheck="false" />
|
8099 | </div>
|
8100 | `;
|
8101 | }
|
8102 | }
|
8103 |
|
8104 |
|
8105 | if (reqBody.mimeType.includes('json') || reqBody.mimeType.includes('xml') || reqBody.mimeType.includes('text') || this.selectedRequestBodyType.includes('jose')) {
|
8106 | schemaAsObj = schemaInObjectNotation(reqBody.schema, {});
|
8107 | if (this.schemaStyle === 'table') {
|
8108 | reqBodySchemaHtml = ke`
|
8109 | ${reqBodySchemaHtml}
|
8110 | <schema-table
|
8111 | class = '${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}'
|
8112 | style = 'display: ${this.selectedRequestBodyType === reqBody.mimeType ? 'block' : 'none'};'
|
8113 | .data = '${schemaAsObj}'
|
8114 | schema-expand-level = "${this.schemaExpandLevel}"
|
8115 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
8116 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
8117 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
8118 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
8119 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
8120 | > </schema-table>
|
8121 | `;
|
8122 | } else if (this.schemaStyle === 'tree') {
|
8123 | reqBodySchemaHtml = ke`
|
8124 | ${reqBodySchemaHtml}
|
8125 | <schema-tree
|
8126 | class = "${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}"
|
8127 | style = "display: ${this.selectedRequestBodyType === reqBody.mimeType ? 'block' : 'none'};"
|
8128 | .data = "${schemaAsObj}"
|
8129 | schema-expand-level = "${this.schemaExpandLevel}"
|
8130 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
8131 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
8132 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
8133 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
8134 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
8135 | > </schema-tree>
|
8136 | `;
|
8137 | }
|
8138 | }
|
8139 | });
|
8140 | return ke`
|
8141 | <div class='request-body-container' data-selected-request-body-type="${this.selectedRequestBodyType}">
|
8142 | <div class="table-title top-gap row">
|
8143 | REQUEST BODY ${this.request_body.required ? ke`<span class="mono-font" style='color:var(--red)'>*</span>` : ''}
|
8144 | <span style = "font-weight:normal; margin-left:5px"> ${this.selectedRequestBodyType}</span>
|
8145 | <span style="flex:1"></span>
|
8146 | ${reqBodyTypeSelectorHtml}
|
8147 | </div>
|
8148 | ${this.request_body.description ? ke`<div class="m-markdown" style="margin-bottom:12px">${unsafe_html_ae(marked(this.request_body.description))}</div>` : ''}
|
8149 |
|
8150 | ${this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose') ? ke`
|
8151 | <div part="tab-panel" class="tab-panel col" style="border-width:0 0 1px 0;">
|
8152 | <div part="tab-btn-row" class="tab-buttons row" @click="${e => {
|
8153 | if (e.target.tagName.toLowerCase() === 'button') {
|
8154 | this.activeSchemaTab = e.target.dataset.tab;
|
8155 | }
|
8156 | }}">
|
8157 | <button part="tab-btn" class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button>
|
8158 | <button part="tab-btn" class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
|
8159 | </div>
|
8160 | ${ke`<div part="tab-content" class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'};"> ${reqBodyExampleHtml}</div>`}
|
8161 | ${ke`<div part="tab-content" class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'none' : 'block'};"> ${reqBodySchemaHtml}</div>`}
|
8162 | </div>` : ke`
|
8163 | ${reqBodyFileInputHtml}
|
8164 | ${reqBodyFormHtml}`}
|
8165 | </div>
|
8166 | `;
|
8167 | }
|
8168 | formDataParamAsObjectTemplate(fieldName, fieldSchema, mimeType) {
|
8169 | var _formdataPartExample$;
|
8170 |
|
8171 | const formdataPartSchema = schemaInObjectNotation(fieldSchema, {});
|
8172 | const formdataPartExample = generateExample(fieldSchema, 'json', standardizeExample(fieldSchema.examples), standardizeExample(fieldSchema.example), this.callback === 'true' || this.webhook === 'true' ? true : false,
|
8173 |
|
8174 | this.callback === 'true' || this.webhook === 'true' ? false : true,
|
8175 |
|
8176 | 'text', false);
|
8177 | return ke`
|
8178 | <div part="tab-panel" class="tab-panel row" style="min-height:220px; border-left: 6px solid var(--light-border-color); align-items: stretch;">
|
8179 | <div style="width:24px; background-color:var(--light-border-color)">
|
8180 | <div class="row" style="flex-direction:row-reverse; width:160px; height:24px; transform:rotate(270deg) translateX(-160px); transform-origin:top left; display:block;" @click="${e => {
|
8181 | if (e.target.classList.contains('v-tab-btn')) {
|
8182 | const {
|
8183 | tab
|
8184 | } = e.target.dataset;
|
8185 | if (tab) {
|
8186 | const tabPanelEl = e.target.closest('.tab-panel');
|
8187 | const selectedTabBtnEl = tabPanelEl.querySelector(`.v-tab-btn[data-tab="${tab}"]`);
|
8188 | const otherTabBtnEl = [...tabPanelEl.querySelectorAll(`.v-tab-btn:not([data-tab="${tab}"])`)];
|
8189 | const selectedTabContentEl = tabPanelEl.querySelector(`.tab-content[data-tab="${tab}"]`);
|
8190 | const otherTabContentEl = [...tabPanelEl.querySelectorAll(`.tab-content:not([data-tab="${tab}"])`)];
|
8191 | selectedTabBtnEl.classList.add('active');
|
8192 | selectedTabContentEl.style.display = 'block';
|
8193 | otherTabBtnEl.forEach(el => {
|
8194 | el.classList.remove('active');
|
8195 | });
|
8196 | otherTabContentEl.forEach(el => {
|
8197 | el.style.display = 'none';
|
8198 | });
|
8199 | }
|
8200 | }
|
8201 | if (e.target.tagName.toLowerCase() === 'button') {
|
8202 | this.activeSchemaTab = e.target.dataset.tab;
|
8203 | }
|
8204 | }}">
|
8205 | <button class="v-tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button>
|
8206 | <button class="v-tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
|
8207 | </div>
|
8208 | </div>
|
8209 | ${ke`
|
8210 | <div class="tab-content col" data-tab = 'example' style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'}; padding-left:5px; width:100%">
|
8211 | <textarea
|
8212 | class = "textarea"
|
8213 | part = "textarea textarea-param"
|
8214 | style = "width:100%; border:none; resize:vertical;"
|
8215 | data-array = "false"
|
8216 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
8217 | data-pname = "${fieldName}"
|
8218 | data-example = "${((_formdataPartExample$ = formdataPartExample[0]) === null || _formdataPartExample$ === void 0 ? void 0 : _formdataPartExample$.exampleValue) || ''}"
|
8219 | .textContent = "${this.fillRequestFieldsWithExample === 'true' ? formdataPartExample[0].exampleValue : ''}"
|
8220 | spellcheck = "false"
|
8221 | ></textarea>
|
8222 | </div>`}
|
8223 | ${ke`
|
8224 | <div class="tab-content col" data-tab = 'schema' style="display:${this.activeSchemaTab !== 'example' ? 'block' : 'none'}; padding-left:5px; width:100%;">
|
8225 | <schema-tree
|
8226 | .data = "${formdataPartSchema}"
|
8227 | schema-expand-level = "${this.schemaExpandLevel}"
|
8228 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
8229 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
|
8230 | > </schema-tree>
|
8231 | </div>`}
|
8232 | </div>
|
8233 | `;
|
8234 | }
|
8235 | formDataTemplate(schema, mimeType, exampleValue = '') {
|
8236 | const formDataTableRows = [];
|
8237 | if (schema.properties) {
|
8238 | for (const fieldName in schema.properties) {
|
8239 | var _schema$required, _fieldSchema$items;
|
8240 | const fieldSchema = schema.properties[fieldName];
|
8241 | if (fieldSchema.readOnly) {
|
8242 | continue;
|
8243 | }
|
8244 | const fieldExamples = fieldSchema.examples || fieldSchema.example || '';
|
8245 | const fieldType = fieldSchema.type;
|
8246 | const paramSchema = getTypeInfo(fieldSchema);
|
8247 | const labelColWidth = 'read focused'.includes(this.renderStyle) ? '200px' : '160px';
|
8248 | const example = normalizeExamples(paramSchema.examples || paramSchema.example, paramSchema.type);
|
8249 | formDataTableRows.push(ke`
|
8250 | <tr title="${fieldSchema.deprecated ? 'Deprecated' : ''}">
|
8251 | <td style="width:${labelColWidth}; min-width:100px;">
|
8252 | <div class="param-name ${fieldSchema.deprecated ? 'deprecated' : ''}">
|
8253 | ${fieldName}${(_schema$required = schema.required) !== null && _schema$required !== void 0 && _schema$required.includes(fieldName) || fieldSchema.required ? ke`<span style='color:var(--red);'>*</span>` : ''}
|
8254 | </div>
|
8255 | <div class="param-type">${paramSchema.type}</div>
|
8256 | </td>
|
8257 | <td
|
8258 | style="${fieldType === 'object' ? 'width:100%; padding:0;' : this.allowTry === 'true' ? '' : 'display:none;'} min-width:100px;"
|
8259 | colspan="${fieldType === 'object' ? 2 : 1}">
|
8260 | ${fieldType === 'array' ? ((_fieldSchema$items = fieldSchema.items) === null || _fieldSchema$items === void 0 ? void 0 : _fieldSchema$items.format) === 'binary' ? ke`
|
8261 | <div class="file-input-container col" style='align-items:flex-end;' @click="${e => this.onAddRemoveFileInput(e, fieldName, mimeType)}">
|
8262 | <div class='input-set row'>
|
8263 | <input
|
8264 | type = "file"
|
8265 | part = "file-input"
|
8266 | style = "width:100%"
|
8267 | data-pname = "${fieldName}"
|
8268 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
8269 | data-array = "false"
|
8270 | data-file-array = "true"
|
8271 | />
|
8272 | <button class="file-input-remove-btn"> ✕ </button>
|
8273 | </div>
|
8274 | <button class="m-btn primary file-input-add-btn" part="btn btn-fill" style="margin:2px 25px 0 0; padding:2px 6px;">ADD</button>
|
8275 | </div>
|
8276 | ` : ke`
|
8277 | <tag-input
|
8278 | style = "width:100%"
|
8279 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
8280 | data-pname = "${fieldName}"
|
8281 | data-example = "${Array.isArray(fieldExamples) ? fieldExamples.join('~|~') : fieldExamples}"
|
8282 | data-array = "true"
|
8283 | placeholder = "add-multiple ↩"
|
8284 | .value = "${Array.isArray(fieldExamples) ? Array.isArray(fieldExamples[0]) ? fieldExamples[0] : fieldExamples : []}"
|
8285 | >
|
8286 | </tag-input>
|
8287 | ` : ke`
|
8288 | ${fieldType === 'object' ? this.formDataParamAsObjectTemplate.call(this, fieldName, fieldSchema, mimeType) : ke`
|
8289 | ${this.allowTry === 'true' ? ke`<input
|
8290 | .value = "${this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : ''}"
|
8291 | spellcheck = "false"
|
8292 | type = "${fieldSchema.format === 'binary' ? 'file' : fieldSchema.format === 'password' ? 'password' : 'text'}"
|
8293 | part = "textbox textbox-param"
|
8294 | style = "width:100%"
|
8295 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}"
|
8296 | data-pname = "${fieldName}"
|
8297 | data-example = "${Array.isArray(fieldExamples) ? fieldExamples[0] : fieldExamples}"
|
8298 | data-array = "false"
|
8299 | />` : ''}
|
8300 | `}`}
|
8301 | </td>
|
8302 | ${fieldType === 'object' ? '' : ke`
|
8303 | <td>
|
8304 | ${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern ? ke`
|
8305 | <div class="param-constraint">
|
8306 | ${paramSchema.default ? ke`<span style="font-weight:bold">Default: </span>${paramSchema.default}<br/>` : ''}
|
8307 | ${paramSchema.pattern ? ke`<span style="font-weight:bold">Pattern: </span>${paramSchema.pattern}<br/>` : ''}
|
8308 | ${paramSchema.constrain ? ke`${paramSchema.constrain}<br/>` : ''}
|
8309 | ${paramSchema.allowedValues && paramSchema.allowedValues.split('┃').map((v, i) => ke`
|
8310 | ${i > 0 ? '┃' : ke`<span style="font-weight:bold">Allowed: </span>`}
|
8311 | ${ke`
|
8312 | <a part="anchor anchor-param-constraint" class = "${this.allowTry === 'true' ? '' : 'inactive-link'}"
|
8313 | data-type="${paramSchema.type === 'array' ? paramSchema.type : 'string'}"
|
8314 | data-enum="${v.trim()}"
|
8315 | @click="${e => {
|
8316 | const inputEl = e.target.closest('table').querySelector(`[data-pname="${fieldName}"]`);
|
8317 | if (inputEl) {
|
8318 | if (e.target.dataset.type === 'array') {
|
8319 | inputEl.value = [e.target.dataset.enum];
|
8320 | } else {
|
8321 | inputEl.value = e.target.dataset.enum;
|
8322 | }
|
8323 | }
|
8324 | }}"
|
8325 | >
|
8326 | ${v}
|
8327 | </a>`}`)}
|
8328 | </div>` : ''}
|
8329 | </td>`}
|
8330 | </tr>
|
8331 | ${fieldType === 'object' ? '' : ke`
|
8332 | <tr>
|
8333 | <td style="border:none"> </td>
|
8334 | <td colspan="2" style="border:none; margin-top:0; padding:0 5px 8px 5px;">
|
8335 | <span class="m-markdown-small">${unsafe_html_ae(marked(fieldSchema.description || ''))}</span>
|
8336 | ${this.exampleListTemplate.call(this, fieldName, paramSchema.type, example.exampleList)}
|
8337 | </td>
|
8338 | </tr>
|
8339 | `}`);
|
8340 | }
|
8341 | return ke`
|
8342 | <table role="presentation" style="width:100%;" class="m-table">
|
8343 | ${formDataTableRows}
|
8344 | </table>
|
8345 | `;
|
8346 | }
|
8347 | return ke`
|
8348 | <textarea
|
8349 | class = "textarea dynamic-form-param ${mimeType}"
|
8350 | part = "textarea textarea-param"
|
8351 | spellcheck = "false"
|
8352 | data-pname="dynamic-form"
|
8353 | data-ptype="${mimeType}"
|
8354 | .textContent = "${exampleValue}"
|
8355 | style="width:100%"
|
8356 | ></textarea>
|
8357 | ${schema.description ? ke`<span class="m-markdown-small">${unsafe_html_ae(marked(schema.description))}</span>` : ''}
|
8358 | `;
|
8359 | }
|
8360 | curlSyntaxTemplate(display = 'flex') {
|
8361 | return ke`
|
8362 | <div class="col m-markdown" style="flex:1; display:${display}; position:relative; max-width: 100%;">
|
8363 | <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${e => {
|
8364 | copyToClipboard(this.curlSyntax.trim().replace(/\\$/, ''), e);
|
8365 | }}' part="btn btn-fill"> Copy </button>
|
8366 | <pre style="white-space:pre"><code>${unsafe_html_ae(prism_default().highlight(this.curlSyntax.trim().replace(/\\$/, ''), (prism_default()).languages.shell, 'shell'))}</code></pre>
|
8367 | </div>
|
8368 | `;
|
8369 | }
|
8370 | apiResponseTabTemplate() {
|
8371 | let responseFormat = '';
|
8372 | let responseContent = '';
|
8373 | if (!this.responseIsBlob) {
|
8374 | if (this.responseHeaders.includes('application/x-ndjson')) {
|
8375 | responseFormat = 'json';
|
8376 | const prismLines = this.responseText.split('\n').map(q => prism_default().highlight(q, (prism_default()).languages[responseFormat], responseFormat)).join('\n');
|
8377 | responseContent = ke`<code>${unsafe_html_ae(prismLines)}</code>`;
|
8378 | } else if (this.responseHeaders.includes('json')) {
|
8379 | responseFormat = 'json';
|
8380 | responseContent = ke`<code>${unsafe_html_ae(prism_default().highlight(this.responseText, (prism_default()).languages[responseFormat], responseFormat))}</code>`;
|
8381 | } else if (this.responseHeaders.includes('html') || this.responseHeaders.includes('xml')) {
|
8382 | responseFormat = 'html';
|
8383 | responseContent = ke`<code>${unsafe_html_ae(prism_default().highlight(this.responseText, (prism_default()).languages[responseFormat], responseFormat))}</code>`;
|
8384 | } else {
|
8385 | responseFormat = 'text';
|
8386 | responseContent = ke`<code>${this.responseText}</code>`;
|
8387 | }
|
8388 | }
|
8389 | return ke`
|
8390 | <div class="row" style="font-size:var(--font-size-small); margin:5px 0">
|
8391 | <div class="response-message ${this.responseStatus}">Response Status: ${this.responseMessage}</div>
|
8392 | <div style="flex:1"></div>
|
8393 | <button class="m-btn" part="btn btn-outline btn-clear-response" @click="${this.clearResponseData}">CLEAR RESPONSE</button>
|
8394 | </div>
|
8395 | <div part="tab-panel" class="tab-panel col" style="border-width:0 0 1px 0;">
|
8396 | <div id="tab_buttons" part="tab-btn-row" class="tab-buttons row" @click="${e => {
|
8397 | if (e.target.classList.contains('tab-btn') === false) {
|
8398 | return;
|
8399 | }
|
8400 | this.activeResponseTab = e.target.dataset.tab;
|
8401 | }}">
|
8402 | <button part="tab-btn" class="tab-btn ${this.activeResponseTab === 'response' ? 'active' : ''}" data-tab = 'response' > RESPONSE</button>
|
8403 | <button part="tab-btn" class="tab-btn ${this.activeResponseTab === 'headers' ? 'active' : ''}" data-tab = 'headers' > RESPONSE HEADERS</button>
|
8404 | ${this.showCurlBeforeTry === 'true' ? '' : ke`<button part="tab-btn" class="tab-btn ${this.activeResponseTab === 'curl' ? 'active' : ''}" data-tab = 'curl'>CURL</button>`}
|
8405 | </div>
|
8406 | ${this.responseIsBlob ? ke`
|
8407 | <div part="tab-content" class="tab-content col" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};">
|
8408 | ${this.responseBlobType === 'image' ? ke`<img style="max-height:var(--resp-area-height, 400px); object-fit:contain;" class="mar-top-8" src="${if_defined_to(this.responseBlobUrl)}"></img>` : ''}
|
8409 | <button class="m-btn thin-border mar-top-8" style="width:135px" @click='${e => {
|
8410 | downloadResource(this.responseBlobUrl, this.respContentDisposition, e);
|
8411 | }}' part="btn btn-outline">
|
8412 | DOWNLOAD
|
8413 | </button>
|
8414 | ${this.responseBlobType === 'view' || this.responseBlobType === 'image' ? ke`<button class="m-btn thin-border mar-top-8" style="width:135px" @click='${e => {
|
8415 | viewResource(this.responseBlobUrl, e);
|
8416 | }}' part="btn btn-outline">VIEW (NEW TAB)</button>` : ''}
|
8417 | </div>` : ke`
|
8418 | <div part="tab-content" class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};" >
|
8419 | <button class="toolbar-btn" style="position:absolute; top:12px; right:8px" @click='${e => {
|
8420 | copyToClipboard(this.responseText, e);
|
8421 | }}' part="btn btn-fill"> Copy </button>
|
8422 | <pre style="white-space:pre; min-height:50px; height:var(--resp-area-height, 400px); resize:vertical; overflow:auto">${responseContent}</pre>
|
8423 | </div>`}
|
8424 | <div part="tab-content" class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'headers' ? 'flex' : 'none'};" >
|
8425 | <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${e => {
|
8426 | copyToClipboard(this.responseHeaders, e);
|
8427 | }}' part="btn btn-fill"> Copy </button>
|
8428 | <pre style="white-space:pre"><code>${unsafe_html_ae(prism_default().highlight(this.responseHeaders, (prism_default()).languages.css, 'css'))}</code></pre>
|
8429 | </div>
|
8430 | ${this.showCurlBeforeTry === 'true' ? '' : this.curlSyntaxTemplate(this.activeResponseTab === 'curl' ? 'flex' : 'none')}
|
8431 | </div>`;
|
8432 | }
|
8433 | apiCallTemplate() {
|
8434 | var _this$security, _this$api_keys$;
|
8435 | const selectedServerHtml = ke`
|
8436 | <div style="display:flex; flex-direction:column;">
|
8437 | ${this.serverUrl ? ke`
|
8438 | <div style="display:flex; align-items:baseline;">
|
8439 | <div style="font-weight:bold; padding-right:5px;">API Server</div>
|
8440 | <span class = "gray-text"> ${this.serverUrl} </span>
|
8441 | </div>
|
8442 | ` : ''}
|
8443 | </div>
|
8444 | `;
|
8445 | return ke`
|
8446 | <div style="display:flex; align-items:flex-end; margin:16px 0; font-size:var(--font-size-small);" part="wrap-request-btn">
|
8447 | <div class="hide-in-small-screen" style="flex-direction:column; margin:0; width:calc(100% - 60px);">
|
8448 | <div style="display:flex; flex-direction:row; align-items:center; overflow:hidden;">
|
8449 | ${selectedServerHtml}
|
8450 | </div>
|
8451 | <div style="display:flex;">
|
8452 | <div style="font-weight:bold; padding-right:5px;">Authentication</div>
|
8453 | ${((_this$security = this.security) === null || _this$security === void 0 ? void 0 : _this$security.length) > 0 ? ke`
|
8454 | ${this.api_keys.length > 0 ? ke`<div style="color:var(--blue); overflow:hidden;">
|
8455 | ${this.api_keys.length === 1 ? `${(_this$api_keys$ = this.api_keys[0]) === null || _this$api_keys$ === void 0 ? void 0 : _this$api_keys$.typeDisplay} in ${this.api_keys[0].in}` : `${this.api_keys.length} API keys applied`}
|
8456 | </div>` : ke`<div class="gray-text">Required <span style="color:var(--red)">(None Applied)</span> </div>`}` : ke`<span class="gray-text"> Not Required </span>`}
|
8457 | </div>
|
8458 | </div>
|
8459 | ${this.parameters.length > 0 || this.request_body ? ke`
|
8460 | <button class="m-btn thin-border" part="btn btn-outline btn-fill" style="margin-right:5px;" @click="${this.onFillRequestData}" title="Fills with example data (if provided)">
|
8461 | FILL EXAMPLE
|
8462 | </button>
|
8463 | <button class="m-btn thin-border" part="btn btn-outline btn-clear" style="margin-right:5px;" @click="${this.onClearRequestData}">
|
8464 | CLEAR
|
8465 | </button>` : ''}
|
8466 | <button class="m-btn primary thin-border" part="btn btn-try" @click="${this.onTryClick}">TRY</button>
|
8467 | </div>
|
8468 | <div class="row" style="font-size:var(--font-size-small); margin:5px 0">
|
8469 | ${this.showCurlBeforeTry === 'true' ? this.curlSyntaxTemplate() : ''}
|
8470 | </div>
|
8471 | ${this.responseMessage === '' ? '' : this.apiResponseTabTemplate()}
|
8472 | `;
|
8473 | }
|
8474 |
|
8475 |
|
8476 | async onFillRequestData(e) {
|
8477 | const requestPanelEl = e.target.closest('.request-panel');
|
8478 | const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];
|
8479 | requestPanelInputEls.forEach(el => {
|
8480 | if (el.dataset.example) {
|
8481 | if (el.tagName.toUpperCase() === 'TAG-INPUT') {
|
8482 | el.value = el.dataset.example.split('~|~');
|
8483 | } else {
|
8484 | el.value = el.dataset.example;
|
8485 | }
|
8486 | }
|
8487 | });
|
8488 | }
|
8489 | async onClearRequestData(e) {
|
8490 | const requestPanelEl = e.target.closest('.request-panel');
|
8491 | const requestPanelInputEls = [...requestPanelEl.querySelectorAll('input, tag-input, textarea:not(.is-hidden)')];
|
8492 | requestPanelInputEls.forEach(el => {
|
8493 | el.value = '';
|
8494 | });
|
8495 | }
|
8496 | buildFetchURL(requestPanelEl) {
|
8497 | let fetchUrl;
|
8498 | const pathParamEls = [...requestPanelEl.querySelectorAll("[data-ptype='path']")];
|
8499 | const queryParamEls = [...requestPanelEl.querySelectorAll("[data-ptype='query']")];
|
8500 | const queryParamObjTypeEls = [...requestPanelEl.querySelectorAll("[data-ptype='query-object']")];
|
8501 | fetchUrl = this.path;
|
8502 |
|
8503 | pathParamEls.map(el => {
|
8504 | fetchUrl = fetchUrl.replace(`{${el.dataset.pname}}`, encodeURIComponent(el.value));
|
8505 | });
|
8506 |
|
8507 |
|
8508 | const urlQueryParamsMap = new Map();
|
8509 | const queryParamsWithReservedCharsAllowed = [];
|
8510 | if (queryParamEls.length > 0) {
|
8511 | queryParamEls.forEach(el => {
|
8512 | const queryParam = new URLSearchParams();
|
8513 | if (el.dataset.paramAllowReserved === 'true') {
|
8514 | queryParamsWithReservedCharsAllowed.push(el.dataset.pname);
|
8515 | }
|
8516 | if (el.dataset.array === 'false') {
|
8517 | if (el.value !== '') {
|
8518 | queryParam.append(el.dataset.pname, el.value);
|
8519 | }
|
8520 | } else {
|
8521 | const {
|
8522 | paramSerializeStyle,
|
8523 | paramSerializeExplode
|
8524 | } = el.dataset;
|
8525 | let vals = el.value && Array.isArray(el.value) ? el.value : [];
|
8526 | vals = Array.isArray(vals) ? vals.filter(v => v !== '') : [];
|
8527 | if (vals.length > 0) {
|
8528 | if (paramSerializeStyle === 'spaceDelimited') {
|
8529 | queryParam.append(el.dataset.pname, vals.join(' ').replace(/^\s|\s$/g, ''));
|
8530 | } else if (paramSerializeStyle === 'pipeDelimited') {
|
8531 | queryParam.append(el.dataset.pname, vals.join('|').replace(/^\||\|$/g, ''));
|
8532 | } else {
|
8533 | if (paramSerializeExplode === 'true') {
|
8534 |
|
8535 | vals.forEach(v => {
|
8536 | queryParam.append(el.dataset.pname, v);
|
8537 | });
|
8538 | } else {
|
8539 | queryParam.append(el.dataset.pname, vals.join(',').replace(/^,|,$/g, ''));
|
8540 | }
|
8541 | }
|
8542 | }
|
8543 | }
|
8544 | if (queryParam.toString()) {
|
8545 | urlQueryParamsMap.set(el.dataset.pname, queryParam);
|
8546 | }
|
8547 | });
|
8548 | }
|
8549 |
|
8550 |
|
8551 | if (queryParamObjTypeEls.length > 0) {
|
8552 | queryParamObjTypeEls.map(el => {
|
8553 | const queryParam = new URLSearchParams();
|
8554 | try {
|
8555 | let queryParamObj = {};
|
8556 | const {
|
8557 | paramSerializeStyle,
|
8558 | paramSerializeExplode,
|
8559 | pname
|
8560 | } = el.dataset;
|
8561 | queryParamObj = Object.assign(queryParamObj, JSON.parse(el.value.replace(/\s+/g, ' ')));
|
8562 | if (el.dataset.paramAllowReserved === 'true') {
|
8563 | queryParamsWithReservedCharsAllowed.push(el.dataset.pname);
|
8564 | }
|
8565 | if ('json xml'.includes(paramSerializeStyle)) {
|
8566 | if (paramSerializeStyle === 'json') {
|
8567 | queryParam.append(el.dataset.pname, JSON.stringify(queryParamObj));
|
8568 | } else if (paramSerializeStyle === 'xml') {
|
8569 | queryParam.append(el.dataset.pname, json2xml(queryParamObj));
|
8570 | }
|
8571 | } else {
|
8572 | for (const key in queryParamObj) {
|
8573 | const pKey = `${pname}[${key}]`;
|
8574 | if (typeof queryParamObj[key] === 'object') {
|
8575 | if (Array.isArray(queryParamObj[key])) {
|
8576 | if (paramSerializeStyle === 'spaceDelimited') {
|
8577 | queryParam.append(pKey, queryParamObj[key].join(' '));
|
8578 | } else if (paramSerializeStyle === 'pipeDelimited') {
|
8579 | queryParam.append(pKey, queryParamObj[key].join('|'));
|
8580 | } else {
|
8581 | if (paramSerializeExplode === 'true') {
|
8582 |
|
8583 | queryParamObj[key].forEach(v => {
|
8584 | queryParam.append(pKey, v);
|
8585 | });
|
8586 | } else {
|
8587 | queryParam.append(pKey, queryParamObj[key]);
|
8588 | }
|
8589 | }
|
8590 | }
|
8591 | } else {
|
8592 | queryParam.append(pKey, queryParamObj[key]);
|
8593 | }
|
8594 | }
|
8595 | }
|
8596 | } catch {
|
8597 | console.error('RapiDoc: unable to parse %s into object', el.value);
|
8598 | }
|
8599 | if (queryParam.toString()) {
|
8600 | urlQueryParamsMap.set(el.dataset.pname, queryParam);
|
8601 | }
|
8602 | });
|
8603 | }
|
8604 | let urlQueryParamString = '';
|
8605 | if (urlQueryParamsMap.size) {
|
8606 | urlQueryParamsMap.forEach((val, pname) => {
|
8607 | if (queryParamsWithReservedCharsAllowed.includes(pname)) {
|
8608 | urlQueryParamString += `${pname}=`;
|
8609 | urlQueryParamString += val.getAll(pname).join(`&${pname}=`);
|
8610 | urlQueryParamString += '&';
|
8611 | } else {
|
8612 | urlQueryParamString += `${val.toString()}&`;
|
8613 | }
|
8614 | });
|
8615 | urlQueryParamString = urlQueryParamString.slice(0, -1);
|
8616 | }
|
8617 | if (urlQueryParamString.length !== 0) {
|
8618 | fetchUrl = `${fetchUrl}${fetchUrl.includes('?') ? '&' : '?'}${urlQueryParamString}`;
|
8619 | }
|
8620 |
|
8621 |
|
8622 | this.api_keys.filter(v => v.in === 'query').forEach(v => {
|
8623 | fetchUrl = `${fetchUrl}${fetchUrl.includes('?') ? '&' : '?'}${v.name}=${encodeURIComponent(v.finalKeyValue)}`;
|
8624 | });
|
8625 | fetchUrl = `${this.serverUrl.replace(/\/$/, '')}${fetchUrl}`;
|
8626 | return fetchUrl;
|
8627 | }
|
8628 | buildFetchHeaders(requestPanelEl) {
|
8629 | var _this$closest;
|
8630 | const respEl = (_this$closest = this.closest('.expanded-req-resp-container, .req-resp-container')) === null || _this$closest === void 0 ? void 0 : _this$closest.getElementsByTagName('api-response')[0];
|
8631 | const headerParamEls = [...requestPanelEl.querySelectorAll("[data-ptype='header'], [data-ptype='header-object']")];
|
8632 | const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
8633 | const acceptHeader = respEl === null || respEl === void 0 ? void 0 : respEl.selectedMimeType;
|
8634 | const reqHeaders = new Headers();
|
8635 | if (acceptHeader) {
|
8636 |
|
8637 | reqHeaders.append('Accept', acceptHeader);
|
8638 | } else if (this.accept) {
|
8639 | reqHeaders.append('Accept', this.accept);
|
8640 | }
|
8641 |
|
8642 |
|
8643 | this.api_keys.filter(v => v.in === 'header').forEach(v => {
|
8644 | reqHeaders.append(v.name, v.finalKeyValue);
|
8645 | });
|
8646 |
|
8647 |
|
8648 | headerParamEls.map(el => {
|
8649 | if (el.value) {
|
8650 | if (el.dataset.ptype === 'header-object') {
|
8651 | |
8652 |
|
8653 |
|
8654 |
|
8655 |
|
8656 |
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 |
|
8665 |
|
8666 | const headerObjVal = JSON.parse(el.value.replace(/\n/g, '').trim());
|
8667 | const firstLevelKeySeparator = el.dataset.paramSerializeExplode === 'true' ? '=' : ',';
|
8668 | const headerStrVal = Object.keys(headerObjVal).map(key => {
|
8669 | const value = headerObjVal[key];
|
8670 | if (typeof value === 'object') {
|
8671 | return `${key}${firstLevelKeySeparator}${JSON.stringify(value)}`;
|
8672 | }
|
8673 | return `${key}${firstLevelKeySeparator}${value}`;
|
8674 | }).join(',');
|
8675 | reqHeaders.append(el.dataset.pname, headerStrVal);
|
8676 | } else {
|
8677 | reqHeaders.append(el.dataset.pname, el.value);
|
8678 | }
|
8679 | }
|
8680 | });
|
8681 | if (requestBodyContainerEl) {
|
8682 | const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;
|
8683 |
|
8684 | if (!requestBodyType.includes('form-data')) {
|
8685 |
|
8686 | reqHeaders.append('Content-Type', requestBodyType);
|
8687 | }
|
8688 | }
|
8689 | return reqHeaders;
|
8690 | }
|
8691 | buildFetchBodyOptions(requestPanelEl) {
|
8692 | const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
8693 | const fetchOptions = {
|
8694 | method: this.method.toUpperCase()
|
8695 | };
|
8696 | if (requestBodyContainerEl) {
|
8697 | const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;
|
8698 | if (requestBodyType.includes('form-urlencoded')) {
|
8699 |
|
8700 | const formUrlDynamicTextAreaEl = requestPanelEl.querySelector("[data-ptype='dynamic-form']");
|
8701 | if (formUrlDynamicTextAreaEl) {
|
8702 | const val = formUrlDynamicTextAreaEl.value;
|
8703 | const formUrlDynParams = new URLSearchParams();
|
8704 | let proceed = true;
|
8705 | let tmpObj;
|
8706 | if (val) {
|
8707 | try {
|
8708 | tmpObj = JSON.parse(val);
|
8709 | } catch (err) {
|
8710 | proceed = false;
|
8711 | console.warn('RapiDoc: Invalid JSON provided', err);
|
8712 | }
|
8713 | } else {
|
8714 | proceed = false;
|
8715 | }
|
8716 | if (proceed) {
|
8717 | for (const prop in tmpObj) {
|
8718 | formUrlDynParams.append(prop, JSON.stringify(tmpObj[prop]));
|
8719 | }
|
8720 | fetchOptions.body = formUrlDynParams;
|
8721 | }
|
8722 | } else {
|
8723 |
|
8724 | const formUrlEls = [...requestPanelEl.querySelectorAll("[data-ptype='form-urlencode']")];
|
8725 | const formUrlParams = new URLSearchParams();
|
8726 | formUrlEls.filter(v => v.type !== 'file').forEach(el => {
|
8727 | if (el.dataset.array === 'false') {
|
8728 | if (el.value) {
|
8729 | formUrlParams.append(el.dataset.pname, el.value);
|
8730 | }
|
8731 | } else {
|
8732 | const vals = el.value && Array.isArray(el.value) ? el.value.join(',') : '';
|
8733 | formUrlParams.append(el.dataset.pname, vals);
|
8734 | }
|
8735 | });
|
8736 | fetchOptions.body = formUrlParams;
|
8737 | }
|
8738 | } else if (requestBodyType.includes('form-data')) {
|
8739 | const formDataParams = new FormData();
|
8740 | const formDataEls = [...requestPanelEl.querySelectorAll("[data-ptype='form-data']")];
|
8741 | formDataEls.forEach(el => {
|
8742 | if (el.dataset.array === 'false') {
|
8743 | if (el.type === 'file' && el.files[0]) {
|
8744 | formDataParams.append(el.dataset.pname, el.files[0], el.files[0].name);
|
8745 | } else if (el.value) {
|
8746 | formDataParams.append(el.dataset.pname, el.value);
|
8747 | }
|
8748 | } else if (el.value && Array.isArray(el.value)) {
|
8749 | formDataParams.append(el.dataset.pname, el.value.join(','));
|
8750 | }
|
8751 | });
|
8752 | fetchOptions.body = formDataParams;
|
8753 | } else if (/^audio\/|^image\/|^video\/|^font\/|tar$|zip$|7z$|rtf$|msword$|excel$|\/pdf$|\/octet-stream$/.test(requestBodyType)) {
|
8754 | const bodyParamFileEl = requestPanelEl.querySelector('.request-body-param-file');
|
8755 | if (bodyParamFileEl !== null && bodyParamFileEl !== void 0 && bodyParamFileEl.files[0]) {
|
8756 | fetchOptions.body = bodyParamFileEl.files[0];
|
8757 | }
|
8758 | } else if (requestBodyType.includes('json') || requestBodyType.includes('xml') || requestBodyType.includes('text')) {
|
8759 | const exampleTextAreaEl = requestPanelEl.querySelector('.request-body-param-user-input');
|
8760 | if (exampleTextAreaEl !== null && exampleTextAreaEl !== void 0 && exampleTextAreaEl.value) {
|
8761 | fetchOptions.body = exampleTextAreaEl.value;
|
8762 | }
|
8763 | }
|
8764 | }
|
8765 | return fetchOptions;
|
8766 | }
|
8767 | async onTryClick(e) {
|
8768 | const tryBtnEl = e.target;
|
8769 | const requestPanelEl = tryBtnEl.closest('.request-panel');
|
8770 | const fetchUrl = this.buildFetchURL(requestPanelEl);
|
8771 | const fetchOptions = this.buildFetchBodyOptions(requestPanelEl);
|
8772 | const reqHeaders = this.buildFetchHeaders(requestPanelEl);
|
8773 | this.responseUrl = '';
|
8774 | this.responseHeaders = [];
|
8775 | this.curlSyntax = this.generateCURLSyntax(fetchUrl, reqHeaders, fetchOptions, requestPanelEl);
|
8776 | this.responseStatus = 'success';
|
8777 | this.responseIsBlob = false;
|
8778 | this.respContentDisposition = '';
|
8779 | if (this.responseBlobUrl) {
|
8780 | URL.revokeObjectURL(this.responseBlobUrl);
|
8781 | this.responseBlobUrl = '';
|
8782 | }
|
8783 | if (this.fetchCredentials) {
|
8784 | fetchOptions.credentials = this.fetchCredentials;
|
8785 | }
|
8786 | const controller = new AbortController();
|
8787 | const {
|
8788 | signal
|
8789 | } = controller;
|
8790 | fetchOptions.headers = reqHeaders;
|
8791 | const tempRequest = {
|
8792 | url: fetchUrl,
|
8793 | ...fetchOptions
|
8794 | };
|
8795 | this.dispatchEvent(new CustomEvent('before-try', {
|
8796 | bubbles: true,
|
8797 | composed: true,
|
8798 | detail: {
|
8799 | request: tempRequest,
|
8800 | controller
|
8801 | }
|
8802 | }));
|
8803 | const updatedFetchOptions = {
|
8804 | method: tempRequest.method,
|
8805 | headers: tempRequest.headers,
|
8806 | credentials: tempRequest.credentials,
|
8807 | body: tempRequest.body
|
8808 | };
|
8809 | const fetchRequest = new Request(tempRequest.url, updatedFetchOptions);
|
8810 | let fetchResponse;
|
8811 | let responseClone;
|
8812 | try {
|
8813 | let respBlob;
|
8814 | let respJson;
|
8815 | let respText;
|
8816 | tryBtnEl.disabled = true;
|
8817 | this.responseText = '⌛';
|
8818 | this.responseMessage = '';
|
8819 | this.requestUpdate();
|
8820 | const startTime = performance.now();
|
8821 | fetchResponse = await fetch(fetchRequest, {
|
8822 | signal
|
8823 | });
|
8824 | const endTime = performance.now();
|
8825 |
|
8826 | |
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 |
|
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 | responseClone = fetchResponse.clone();
|
8843 | tryBtnEl.disabled = false;
|
8844 | this.responseMessage = ke`${fetchResponse.statusText ? `${fetchResponse.statusText}:${fetchResponse.status}` : fetchResponse.status} <div style="color:var(--light-fg)"> Took ${Math.round(endTime - startTime)} milliseconds </div>`;
|
8845 | this.responseUrl = fetchResponse.url;
|
8846 | const respHeadersObj = {};
|
8847 | fetchResponse.headers.forEach((hdrVal, hdr) => {
|
8848 | respHeadersObj[hdr] = hdrVal;
|
8849 | this.responseHeaders = `${this.responseHeaders}${hdr}: ${hdrVal}\n`;
|
8850 | });
|
8851 | let contentType = fetchResponse.headers.get('content-type');
|
8852 | const respEmpty = (await fetchResponse.clone().text()).length === 0;
|
8853 | if (respEmpty) {
|
8854 | this.responseText = '';
|
8855 | } else if (contentType) {
|
8856 | contentType = contentType.split(';')[0].trim();
|
8857 | if (contentType === 'application/x-ndjson') {
|
8858 | this.responseText = await fetchResponse.text();
|
8859 | } else if (contentType.includes('json')) {
|
8860 | if (/charset=[^"']+/.test(contentType)) {
|
8861 | const encoding = contentType.split('charset=')[1];
|
8862 | const buffer = await fetchResponse.arrayBuffer();
|
8863 | try {
|
8864 | respText = new TextDecoder(encoding).decode(buffer);
|
8865 | } catch {
|
8866 | respText = new TextDecoder('utf-8').decode(buffer);
|
8867 | }
|
8868 | try {
|
8869 | respJson = JSON.parse(respText);
|
8870 | this.responseText = JSON.stringify(respJson, null, 2);
|
8871 | } catch {
|
8872 | this.responseText = respText;
|
8873 | }
|
8874 | } else {
|
8875 | respJson = await fetchResponse.json();
|
8876 | this.responseText = JSON.stringify(respJson, null, 2);
|
8877 | }
|
8878 |
|
8879 | } else if (/^font\/|tar$|zip$|7z$|rtf$|msword$|excel$|\/pdf$|\/octet-stream$|^application\/vnd\./.test(contentType)) {
|
8880 | this.responseIsBlob = true;
|
8881 | this.responseBlobType = 'download';
|
8882 | } else if (/^image/.test(contentType)) {
|
8883 | this.responseIsBlob = true;
|
8884 | this.responseBlobType = 'image';
|
8885 | } else if (/^audio|^image|^video/.test(contentType)) {
|
8886 | this.responseIsBlob = true;
|
8887 | this.responseBlobType = 'view';
|
8888 | } else {
|
8889 | respText = await fetchResponse.text();
|
8890 | if (contentType.includes('xml')) {
|
8891 | this.responseText = dist_default()(respText, {
|
8892 | textNodesOnSameLine: true,
|
8893 | indentor: ' '
|
8894 | });
|
8895 | } else {
|
8896 | this.responseText = respText;
|
8897 | }
|
8898 | }
|
8899 | if (this.responseIsBlob) {
|
8900 | const contentDisposition = fetchResponse.headers.get('content-disposition') || '';
|
8901 | let filenameFromContentDeposition = 'filename';
|
8902 | if (contentDisposition) {
|
8903 | const filenameStarRegexMatch = contentDisposition.match(/filename\*=\s*UTF-8''([^;]+)/);
|
8904 | if (filenameStarRegexMatch) {
|
8905 | filenameFromContentDeposition = decodeURIComponent(filenameStarRegexMatch[1]);
|
8906 | } else {
|
8907 |
|
8908 | const filenameMatch = contentDisposition.match(/filename="?([^"]+)"?/);
|
8909 | if (filenameMatch) {
|
8910 | filenameFromContentDeposition = filenameMatch[1];
|
8911 | }
|
8912 | }
|
8913 | }
|
8914 | this.respContentDisposition = filenameFromContentDeposition;
|
8915 | respBlob = await fetchResponse.blob();
|
8916 | this.responseBlobUrl = URL.createObjectURL(respBlob);
|
8917 | }
|
8918 | } else {
|
8919 | respText = await fetchResponse.text();
|
8920 | this.responseText = respText;
|
8921 | }
|
8922 | this.dispatchEvent(new CustomEvent('after-try', {
|
8923 | bubbles: true,
|
8924 | composed: true,
|
8925 | detail: {
|
8926 | request: fetchRequest,
|
8927 | response: responseClone,
|
8928 | responseHeaders: respHeadersObj,
|
8929 | responseBody: respJson || respText || respBlob,
|
8930 | responseStatus: responseClone.ok
|
8931 | }
|
8932 | }));
|
8933 | } catch (err) {
|
8934 | tryBtnEl.disabled = false;
|
8935 | if (err.name === 'AbortError') {
|
8936 | this.dispatchEvent(new CustomEvent('request-aborted', {
|
8937 | bubbles: true,
|
8938 | composed: true,
|
8939 | detail: {
|
8940 | err,
|
8941 | request: fetchRequest
|
8942 | }
|
8943 | }));
|
8944 | this.responseMessage = 'Request Aborted';
|
8945 | this.responseText = 'Request Aborted';
|
8946 | } else {
|
8947 | this.dispatchEvent(new CustomEvent('after-try', {
|
8948 | bubbles: true,
|
8949 | composed: true,
|
8950 | detail: {
|
8951 | err,
|
8952 | request: fetchRequest
|
8953 | }
|
8954 | }));
|
8955 | this.responseMessage = `${err.message} (CORS or Network Issue)`;
|
8956 | }
|
8957 | }
|
8958 | this.requestUpdate();
|
8959 | }
|
8960 | liveCURLSyntaxUpdate(requestPanelEl) {
|
8961 | this.applyCURLSyntax(requestPanelEl);
|
8962 | this.requestUpdate();
|
8963 | }
|
8964 | onGenerateCURLClick(e) {
|
8965 | const requestPanelEl = this.getRequestPanel(e);
|
8966 | this.applyCURLSyntax(requestPanelEl);
|
8967 | }
|
8968 | getRequestPanel(e) {
|
8969 | return e.target.closest('.request-panel');
|
8970 | }
|
8971 | applyCURLSyntax(requestPanelEl) {
|
8972 | const fetchUrl = this.buildFetchURL(requestPanelEl);
|
8973 | const fetchOptions = this.buildFetchBodyOptions(requestPanelEl);
|
8974 | const fetchHeaders = this.buildFetchHeaders(requestPanelEl);
|
8975 | this.curlSyntax = this.generateCURLSyntax(fetchUrl, fetchHeaders, fetchOptions, requestPanelEl);
|
8976 | }
|
8977 | generateCURLSyntax(fetchUrl, fetchHeaders, fetchOptions, requestPanelEl) {
|
8978 | let curlUrl;
|
8979 | let curl = '';
|
8980 | let curlHeaders = '';
|
8981 | let curlData = '';
|
8982 | let curlForm = '';
|
8983 | const requestBodyContainerEl = requestPanelEl.querySelector('.request-body-container');
|
8984 | if (fetchUrl.startsWith('http') === false) {
|
8985 | const url = new URL(fetchUrl, window.location.href);
|
8986 | curlUrl = url.href;
|
8987 | } else {
|
8988 | curlUrl = fetchUrl;
|
8989 | }
|
8990 | curl = `curl -X ${this.method.toUpperCase()} "${curlUrl}" \\\n`;
|
8991 | fetchHeaders.forEach((value, key) => {
|
8992 | let tempHeaderArray = value.split(',');
|
8993 | tempHeaderArray = tempHeaderArray.map(el => el.trim()).filter((string, index) => tempHeaderArray.indexOf(string) === index);
|
8994 | fetchHeaders.set(key, tempHeaderArray.join(', '));
|
8995 | });
|
8996 | curlHeaders = Array.from(fetchHeaders).map(([key, value]) => ` -H '${key}: ${value}'`).join('\\\n');
|
8997 | if (curlHeaders) {
|
8998 | curlHeaders = `${curlHeaders} \\\n`;
|
8999 | }
|
9000 | if (fetchOptions.body instanceof URLSearchParams) {
|
9001 | curlData = ` -d ${fetchOptions.body.toString()} \\\n`;
|
9002 | } else if (fetchOptions.body instanceof File) {
|
9003 | curlData = ` --data-binary @${fetchOptions.body.name} \\\n`;
|
9004 | } else if (fetchOptions.body instanceof FormData) {
|
9005 | curlForm = Array.from(fetchOptions.body).reduce((aggregator, [key, value]) => {
|
9006 | if (value instanceof File) {
|
9007 | return [...aggregator, ` -F "${key}=@${value.name}"`];
|
9008 | }
|
9009 | const multiple = value.match(/([^,],)/gm);
|
9010 | if (multiple) {
|
9011 | const multipleResults = multiple.map(one => `-F "${key}[]=${one}"`);
|
9012 | return [...aggregator, ...multipleResults];
|
9013 | }
|
9014 | return [...aggregator, ` -F "${key}=${value}"`];
|
9015 | }, []).join('\\\n');
|
9016 | } else if (requestBodyContainerEl && requestBodyContainerEl.dataset.selectedRequestBodyType) {
|
9017 | const requestBodyType = requestBodyContainerEl.dataset.selectedRequestBodyType;
|
9018 | const exampleTextAreaEl = requestPanelEl.querySelector('.request-body-param-user-input');
|
9019 | if (exampleTextAreaEl !== null && exampleTextAreaEl !== void 0 && exampleTextAreaEl.value) {
|
9020 | fetchOptions.body = exampleTextAreaEl.value;
|
9021 | if (requestBodyType.includes('json')) {
|
9022 | try {
|
9023 | curlData = ` -d '${JSON.stringify(JSON.parse(exampleTextAreaEl.value))}' \\\n`;
|
9024 | } catch {
|
9025 |
|
9026 | }
|
9027 | }
|
9028 | if (!curlData) {
|
9029 | curlData = ` -d '${exampleTextAreaEl.value.replace(/'/g, '\'"\'"\'')}' \\\n`;
|
9030 | }
|
9031 | }
|
9032 | }
|
9033 | return `${curl}${curlHeaders}${curlData}${curlForm}`;
|
9034 | }
|
9035 | onAddRemoveFileInput(e, pname, ptype) {
|
9036 | if (e.target.tagName.toLowerCase() !== 'button') {
|
9037 | return;
|
9038 | }
|
9039 | if (e.target.classList.contains('file-input-remove-btn')) {
|
9040 |
|
9041 | const el = e.target.closest('.input-set');
|
9042 | el.remove();
|
9043 | return;
|
9044 | }
|
9045 | const el = e.target.closest('.file-input-container');
|
9046 |
|
9047 |
|
9048 |
|
9049 |
|
9050 | const newInputContainerEl = document.createElement('div');
|
9051 | newInputContainerEl.setAttribute('class', 'input-set row');
|
9052 |
|
9053 |
|
9054 | const newInputEl = document.createElement('input');
|
9055 | newInputEl.type = 'file';
|
9056 | newInputEl.style = 'width:200px; margin-top:2px;';
|
9057 | newInputEl.setAttribute('data-pname', pname);
|
9058 | newInputEl.setAttribute('data-ptype', ptype.includes('form-urlencode') ? 'form-urlencode' : 'form-data');
|
9059 | newInputEl.setAttribute('data-array', 'false');
|
9060 | newInputEl.setAttribute('data-file-array', 'true');
|
9061 |
|
9062 |
|
9063 | const newRemoveBtnEl = document.createElement('button');
|
9064 | newRemoveBtnEl.setAttribute('class', 'file-input-remove-btn');
|
9065 | newRemoveBtnEl.innerHTML = '✕';
|
9066 | newInputContainerEl.appendChild(newInputEl);
|
9067 | newInputContainerEl.appendChild(newRemoveBtnEl);
|
9068 | el.insertBefore(newInputContainerEl, e.target);
|
9069 |
|
9070 | }
|
9071 | clearResponseData() {
|
9072 | this.responseUrl = '';
|
9073 | this.responseHeaders = '';
|
9074 | this.responseText = '';
|
9075 | this.responseStatus = 'success';
|
9076 | this.responseMessage = '';
|
9077 | this.responseIsBlob = false;
|
9078 | this.responseBlobType = '';
|
9079 | this.respContentDisposition = '';
|
9080 | if (this.responseBlobUrl) {
|
9081 | URL.revokeObjectURL(this.responseBlobUrl);
|
9082 | this.responseBlobUrl = '';
|
9083 | }
|
9084 | }
|
9085 | disconnectedCallback() {
|
9086 | this.curlSyntax = '';
|
9087 |
|
9088 | if (this.responseBlobUrl) {
|
9089 | URL.revokeObjectURL(this.responseBlobUrl);
|
9090 | this.responseBlobUrl = '';
|
9091 | }
|
9092 | super.disconnectedCallback();
|
9093 | }
|
9094 | }
|
9095 |
|
9096 |
|
9097 | customElements.define('api-request', ApiRequest);
|
9098 | ;
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 |
|
9105 | class SchemaTable extends lit_element_h {
|
9106 | static get properties() {
|
9107 | return {
|
9108 | schemaExpandLevel: {
|
9109 | type: Number,
|
9110 | attribute: 'schema-expand-level'
|
9111 | },
|
9112 | schemaDescriptionExpanded: {
|
9113 | type: String,
|
9114 | attribute: 'schema-description-expanded'
|
9115 | },
|
9116 | allowSchemaDescriptionExpandToggle: {
|
9117 | type: String,
|
9118 | attribute: 'allow-schema-description-expand-toggle'
|
9119 | },
|
9120 | schemaHideReadOnly: {
|
9121 | type: String,
|
9122 | attribute: 'schema-hide-read-only'
|
9123 | },
|
9124 | schemaHideWriteOnly: {
|
9125 | type: String,
|
9126 | attribute: 'schema-hide-write-only'
|
9127 | },
|
9128 | data: {
|
9129 | type: Object
|
9130 | }
|
9131 | };
|
9132 | }
|
9133 | connectedCallback() {
|
9134 | super.connectedCallback();
|
9135 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
9136 | this.schemaExpandLevel = 99999;
|
9137 | }
|
9138 | if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) {
|
9139 | this.schemaDescriptionExpanded = 'false';
|
9140 | }
|
9141 | if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) {
|
9142 | this.schemaHideReadOnly = 'true';
|
9143 | }
|
9144 | if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) {
|
9145 | this.schemaHideWriteOnly = 'true';
|
9146 | }
|
9147 | }
|
9148 | static get styles() {
|
9149 | return [font_styles, schema_styles, i`
|
9150 | .table {
|
9151 | font-size: var(--font-size-small);
|
9152 | text-align: left;
|
9153 | line-height: calc(var(--font-size-small) + 6px);
|
9154 | }
|
9155 | .table .tr {
|
9156 | width: calc(100% - 5px);
|
9157 | padding: 0 0 0 5px;
|
9158 | border-bottom: 1px dotted var(--light-border-color);
|
9159 | }
|
9160 | .table .td {
|
9161 | padding: 4px 0;
|
9162 | }
|
9163 | .table .key {
|
9164 | width: 240px;
|
9165 | }
|
9166 | .key .key-label {
|
9167 | font-size: var(--font-size-mono);
|
9168 | }
|
9169 | .key.deprecated .key-label {
|
9170 | color: var(--red);
|
9171 | }
|
9172 |
|
9173 | .table .key-type {
|
9174 | white-space: normal;
|
9175 | width: 150px;
|
9176 | }
|
9177 | .collapsed-all-descr .tr:not(.expanded-descr) {
|
9178 | max-height: calc(var(--font-size-small) + var(--font-size-small));
|
9179 | }
|
9180 |
|
9181 | .obj-toggle {
|
9182 | padding: 0 2px;
|
9183 | border-radius:2px;
|
9184 | border: 1px solid transparent;
|
9185 | display: inline-block;
|
9186 | margin-left: -16px;
|
9187 | color:var(--primary-color);
|
9188 | cursor:pointer;
|
9189 | font-size: calc(var(--font-size-small) + 4px);
|
9190 | font-family: var(--font-mono);
|
9191 | background-clip: border-box;
|
9192 | }
|
9193 | .obj-toggle:hover {
|
9194 | border-color: var(--primary-color);
|
9195 | }
|
9196 | .tr.expanded + .object-body {
|
9197 | display:block;
|
9198 | }
|
9199 | .tr.collapsed + .object-body {
|
9200 | display:none;
|
9201 | }`, custom_styles];
|
9202 | }
|
9203 |
|
9204 |
|
9205 | render() {
|
9206 | var _this$data, _this$data2, _this$data3;
|
9207 | return ke`
|
9208 | <div class="table ${this.schemaDescriptionExpanded === 'true' ? 'expanded-all-descr' : 'collapsed-all-descr'}" @click="${e => this.handleAllEvents(e)}">
|
9209 | <div class='toolbar'>
|
9210 | <div class="toolbar-item schema-root-type ${((_this$data = this.data) === null || _this$data === void 0 ? void 0 : _this$data['::type']) || ''} "> ${((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2['::type']) || ''} </div>
|
9211 | ${this.allowSchemaDescriptionExpandToggle === 'true' ? ke`
|
9212 | <div style="flex:1"></div>
|
9213 | <div part="schema-multiline-toggle" class='toolbar-item schema-multiline-toggle' >
|
9214 | ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
|
9215 | </div>
|
9216 | ` : ''}
|
9217 | </div>
|
9218 | <span part="schema-description" class='m-markdown'> ${unsafe_html_ae(marked(((_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3['::description']) || ''))} </span>
|
9219 | <div style = 'border:1px solid var(--light-border-color)'>
|
9220 | <div style='display:flex; background-color: var(--bg2); padding:8px 4px; border-bottom:1px solid var(--light-border-color);'>
|
9221 | <div class='key' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Field </div>
|
9222 | <div class='key-type' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Type </div>
|
9223 | <div class='key-descr' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Description </div>
|
9224 | </div>
|
9225 | ${this.data ? ke`
|
9226 | ${this.generateTree(this.data['::type'] === 'array' ? this.data['::props'] : this.data, this.data['::type'], this.data['::array-type'])}` : ''}
|
9227 | </div>
|
9228 | </div>
|
9229 | `;
|
9230 | }
|
9231 | generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '', isDeprecated = false) {
|
9232 | var _data$Type, _keyLabel;
|
9233 | if (this.schemaHideReadOnly === 'true') {
|
9234 | if (dataType === 'array') {
|
9235 | if (readOrWrite === 'readonly') {
|
9236 | return;
|
9237 | }
|
9238 | }
|
9239 | if (data && data['::readwrite'] === 'readonly') {
|
9240 | return;
|
9241 | }
|
9242 | }
|
9243 | if (this.schemaHideWriteOnly === 'true') {
|
9244 | if (dataType === 'array') {
|
9245 | if (readOrWrite === 'writeonly') {
|
9246 | return;
|
9247 | }
|
9248 | }
|
9249 | if (data && data['::readwrite'] === 'writeonly') {
|
9250 | return;
|
9251 | }
|
9252 | }
|
9253 | if (!data) {
|
9254 | return ke`<div class="null" style="display:inline;">
|
9255 | <span style='margin-left:${(schemaLevel + 1) * 16}px'> </span>
|
9256 | <span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span>
|
9257 | ${dataType === 'array' ? ke`<span class='mono-font'> [ ] </span>` : dataType === 'object' ? ke`<span class='mono-font'> { } </span>` : ke`<span class='mono-font'> schema undefined </span>`}
|
9258 | </div>`;
|
9259 | }
|
9260 | const newSchemaLevel = (_data$Type = data['::type']) !== null && _data$Type !== void 0 && _data$Type.startsWith('xxx-of') ? schemaLevel : schemaLevel + 1;
|
9261 | const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : indentLevel + 1;
|
9262 | const leftPadding = 16 * newIndentLevel;
|
9263 | if (Object.keys(data).length === 0) {
|
9264 | return ke`<span class="td key object" style='padding-left:${leftPadding}px'>${key}</span>`;
|
9265 | }
|
9266 | let keyLabel = '';
|
9267 | let keyDescr = '';
|
9268 | let isOneOfLabel = false;
|
9269 | if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {
|
9270 | keyLabel = key.replace('::', '').replace('~', ' ');
|
9271 | isOneOfLabel = true;
|
9272 | } else if (key.startsWith('::OPTION')) {
|
9273 | const parts = key.split('~');
|
9274 | keyLabel = parts[1];
|
9275 | keyDescr = parts[2];
|
9276 | } else {
|
9277 | keyLabel = key;
|
9278 | }
|
9279 | let detailObjType = '';
|
9280 | if (data['::type'] === 'object') {
|
9281 | if (dataType === 'array') {
|
9282 | detailObjType = 'array of object';
|
9283 | } else {
|
9284 | detailObjType = data['::dataTypeLabel'] || data['::type'];
|
9285 | }
|
9286 | } else if (data['::type'] === 'array') {
|
9287 | if (dataType === 'array') {
|
9288 |
|
9289 | detailObjType = `array of array ${arrayType !== 'object' ? `of ${arrayType}` : ''}`;
|
9290 | } else {
|
9291 | detailObjType = data['::dataTypeLabel'] || data['::type'];
|
9292 | }
|
9293 | }
|
9294 | if (typeof data === 'object') {
|
9295 | return ke`
|
9296 | ${newSchemaLevel >= 0 && key ? ke`
|
9297 | <div class='tr ${newSchemaLevel <= this.schemaExpandLevel ? 'expanded' : 'collapsed'} ${data['::type']}' data-obj='${keyLabel}' title="${isDeprecated || data['::deprecated'] ? 'Deprecated' : ''}">
|
9298 | <div class="td key ${isDeprecated || data['::deprecated'] ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
|
9299 | ${keyLabel || keyDescr ? ke`
|
9300 | <span class='obj-toggle ${newSchemaLevel < this.schemaExpandLevel ? 'expanded' : 'collapsed'}' data-obj='${keyLabel}'>
|
9301 | ${schemaLevel < this.schemaExpandLevel ? '-' : '+'}
|
9302 | </span>` : ''}
|
9303 | ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION') ? ke`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>` : keyLabel.endsWith('*') ? ke`<span class="key-label" style="display:inline-block; margin-left:-6px;">${isDeprecated || data['::deprecated'] ? ke`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>` : ''} ${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>` : ke`<span class="key-label" style="display:inline-block; margin-left:-6px;">${isDeprecated || data['::deprecated'] ? ke`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>` : ''} ${keyLabel === '::props' ? '' : keyLabel}</span>`}
|
9304 | ${data['::type'] === 'xxx-of' && dataType === 'array' ? ke`<span style="color:var(--primary-color)">ARRAY</span>` : ''}
|
9305 | </div>
|
9306 | <div class='td key-type' title="${data['::readwrite'] === 'readonly' ? 'Read-Only' : data['::readwrite'] === 'writeonly' ? 'Write-Only' : ''}">
|
9307 | ${(data['::type'] || '').includes('xxx-of') ? '' : detailObjType}
|
9308 | ${data['::readwrite'] === 'readonly' ? ' 🆁' : data['::readwrite'] === 'writeonly' ? ' 🆆' : ''}
|
9309 | </div>
|
9310 | <div class='td key-descr m-markdown-small' style='line-height:1.7'>${unsafe_html_ae(marked(description || ''))}</div>
|
9311 | </div>` : ke`
|
9312 | ${data['::type'] === 'array' && dataType === 'array' ? ke`
|
9313 | <div class='tr'>
|
9314 | <div class='td key'></div>
|
9315 | <div class='td key-type'>
|
9316 | ${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}
|
9317 | </div>
|
9318 | <div class='td key-descr'></div>
|
9319 | </div>` : ''}`}
|
9320 | <div class='object-body'>
|
9321 | ${Array.isArray(data) && data[0] ? ke`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, '')}` : ke`
|
9322 | ${Object.keys(data).map(dataKey => {
|
9323 | var _data$dataKey;
|
9324 | return ke`
|
9325 | ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel', '::nullable'].includes(dataKey) ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object' ? ke`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, data[dataKey]['::description'], newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '', isDeprecated || data[dataKey]['::deprecated'])}` : '' : ke`${this.generateTree(data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey], data[dataKey]['::type'], data[dataKey]['::array-type'] || '', dataKey, ((_data$dataKey = data[dataKey]) === null || _data$dataKey === void 0 ? void 0 : _data$dataKey['::description']) || '', newSchemaLevel, newIndentLevel, data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '', isDeprecated || data[dataKey]['::deprecated'])}`}
|
9326 | `;
|
9327 | })}
|
9328 | `}
|
9329 | </div>
|
9330 | `;
|
9331 | }
|
9332 |
|
9333 |
|
9334 |
|
9335 | const [type, readOrWriteOnly, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');
|
9336 | if (readOrWriteOnly === '🆁' && this.schemaHideReadOnly === 'true') {
|
9337 | return;
|
9338 | }
|
9339 | if (readOrWriteOnly === '🆆' && this.schemaHideWriteOnly === 'true') {
|
9340 | return;
|
9341 | }
|
9342 | const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();
|
9343 | const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? '<span class="descr-expand-toggle">➔</span>' : ''}`;
|
9344 | let dataTypeHtml = '';
|
9345 | if (dataType === 'array') {
|
9346 | dataTypeHtml = ke`
|
9347 | <div class='td key-type ${dataTypeCss}' title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWriteOnly === 'writeonly' ? 'Write-Only' : ''}">
|
9348 | [${type}] ${readOrWrite === 'readonly' ? '🆁' : readOrWrite === 'writeonly' ? '🆆' : ''}
|
9349 | </div>`;
|
9350 | } else {
|
9351 | dataTypeHtml = ke`
|
9352 | <div class='td key-type ${dataTypeCss}' title="${readOrWriteOnly === '🆁' ? 'Read-Only' : readOrWriteOnly === '🆆' ? 'Write-Only' : ''}">
|
9353 | ${type} ${readOrWriteOnly}
|
9354 | </div>`;
|
9355 | }
|
9356 | return ke`
|
9357 | <div class = "tr primitive" title="${isDeprecated || deprecated ? 'Deprecated' : ''}">
|
9358 | <div class="td key ${isDeprecated || deprecated ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
|
9359 | ${isDeprecated || deprecated ? ke`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>` : ''}
|
9360 | ${(_keyLabel = keyLabel) !== null && _keyLabel !== void 0 && _keyLabel.endsWith('*') ? ke`
|
9361 | <span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span>
|
9362 | <span style='color:var(--red);'>*</span>` : key.startsWith('::OPTION') ? ke`<span class='xxx-of-key'>${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>` : ke`${keyLabel ? ke`<span class="key-label"> ${keyLabel}</span>` : ke`<span class="xxx-of-descr">${schemaTitle}</span>`}`}
|
9363 | </div>
|
9364 | ${dataTypeHtml}
|
9365 | <div class='td key-descr' style='font-size: var(--font-size-small)'>
|
9366 | ${ke`<span class="m-markdown-small">
|
9367 | ${unsafe_html_ae(marked(dataType === 'array' ? `${descrExpander} ${description}` : schemaTitle ? `${descrExpander} <b>${schemaTitle}:</b> ${schemaDescription}` : `${descrExpander} ${schemaDescription}`))}
|
9368 | </span>`}
|
9369 | ${constraint ? ke`<div class='' style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Constraints: </span> ${constraint}</div>` : ''}
|
9370 | ${defaultValue ? ke`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
|
9371 | ${allowedValues ? ke`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>${type === 'const' ? 'Value' : 'Allowed'}: </span>${allowedValues}</div>` : ''}
|
9372 | ${pattern ? ke`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
|
9373 | </div>
|
9374 | </div>
|
9375 | `;
|
9376 | }
|
9377 |
|
9378 |
|
9379 | handleAllEvents(e) {
|
9380 | if (e.target.classList.contains('obj-toggle')) {
|
9381 | this.toggleObjectExpand(e);
|
9382 | } else if (e.target.classList.contains('schema-multiline-toggle')) {
|
9383 | this.schemaDescriptionExpanded = this.schemaDescriptionExpanded === 'true' ? 'false' : 'true';
|
9384 | } else if (e.target.classList.contains('descr-expand-toggle')) {
|
9385 | const trEl = e.target.closest('.tr');
|
9386 | if (trEl) {
|
9387 | trEl.classList.toggle('expanded-descr');
|
9388 | trEl.style.maxHeight = trEl.scrollHeight;
|
9389 | }
|
9390 | }
|
9391 | }
|
9392 | toggleObjectExpand(e) {
|
9393 | const rowEl = e.target.closest('.tr');
|
9394 | if (rowEl.classList.contains('expanded')) {
|
9395 | rowEl.classList.add('collapsed');
|
9396 | rowEl.classList.remove('expanded');
|
9397 | e.target.innerText = '+';
|
9398 | } else {
|
9399 | rowEl.classList.remove('collapsed');
|
9400 | rowEl.classList.add('expanded');
|
9401 | e.target.innerText = '-';
|
9402 | }
|
9403 | }
|
9404 | }
|
9405 | customElements.define('schema-table', SchemaTable);
|
9406 | ;
|
9407 |
|
9408 |
|
9409 |
|
9410 |
|
9411 |
|
9412 |
|
9413 |
|
9414 |
|
9415 |
|
9416 |
|
9417 |
|
9418 |
|
9419 |
|
9420 |
|
9421 | class ApiResponse extends lit_element_h {
|
9422 | constructor() {
|
9423 | super();
|
9424 | this.selectedStatus = '';
|
9425 | this.headersForEachRespStatus = {};
|
9426 | this.mimeResponsesForEachStatus = {};
|
9427 | this.activeSchemaTab = 'schema';
|
9428 | }
|
9429 | static get properties() {
|
9430 | return {
|
9431 | callback: {
|
9432 | type: String
|
9433 | },
|
9434 | webhook: {
|
9435 | type: String
|
9436 | },
|
9437 | responses: {
|
9438 | type: Object
|
9439 | },
|
9440 | parser: {
|
9441 | type: Object
|
9442 | },
|
9443 | schemaStyle: {
|
9444 | type: String,
|
9445 | attribute: 'schema-style'
|
9446 | },
|
9447 | renderStyle: {
|
9448 | type: String,
|
9449 | attribute: 'render-style'
|
9450 | },
|
9451 | selectedStatus: {
|
9452 | type: String,
|
9453 | attribute: 'selected-status'
|
9454 | },
|
9455 | selectedMimeType: {
|
9456 | type: String,
|
9457 | attribute: 'selected-mime-type'
|
9458 | },
|
9459 | activeSchemaTab: {
|
9460 | type: String,
|
9461 | attribute: 'active-schema-tab'
|
9462 | },
|
9463 | schemaExpandLevel: {
|
9464 | type: Number,
|
9465 | attribute: 'schema-expand-level'
|
9466 | },
|
9467 | schemaDescriptionExpanded: {
|
9468 | type: String,
|
9469 | attribute: 'schema-description-expanded'
|
9470 | },
|
9471 | allowSchemaDescriptionExpandToggle: {
|
9472 | type: String,
|
9473 | attribute: 'allow-schema-description-expand-toggle'
|
9474 | },
|
9475 | schemaHideReadOnly: {
|
9476 | type: String,
|
9477 | attribute: 'schema-hide-read-only'
|
9478 | },
|
9479 | schemaHideWriteOnly: {
|
9480 | type: String,
|
9481 | attribute: 'schema-hide-write-only'
|
9482 | }
|
9483 | };
|
9484 | }
|
9485 | static get styles() {
|
9486 | return [font_styles, flex_styles, tab_styles, table_styles, input_styles, border_styles, i`
|
9487 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
9488 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
9489 | .resp-head{
|
9490 | vertical-align: middle;
|
9491 | padding:16px 0 8px;
|
9492 | }
|
9493 | .resp-head.divider{
|
9494 | border-top: 1px solid var(--border-color);
|
9495 | margin-top:10px;
|
9496 | }
|
9497 | .resp-status{
|
9498 | font-weight:bold;
|
9499 | font-size:calc(var(--font-size-small) + 1px);
|
9500 | }
|
9501 | .resp-descr{
|
9502 | font-size:calc(var(--font-size-small) + 1px);
|
9503 | color:var(--light-fg);
|
9504 | text-align:left;
|
9505 | }
|
9506 | .top-gap{margin-top:16px;}
|
9507 | .example-panel{
|
9508 | font-size:var(--font-size-small);
|
9509 | margin:0;
|
9510 | }
|
9511 | .focused-mode,
|
9512 | .read-mode {
|
9513 | padding-top:24px;
|
9514 | margin-top:12px;
|
9515 | border-top: 1px dashed var(--border-color);
|
9516 | }`, custom_styles];
|
9517 | }
|
9518 | render() {
|
9519 | return ke`
|
9520 | <div class="col regular-font response-panel ${this.renderStyle}-mode">
|
9521 | <div class=" ${this.callback === 'true' ? 'tiny-title' : 'req-res-title'} ">
|
9522 | ${this.callback === 'true' ? 'CALLBACK RESPONSE' : 'RESPONSE'}
|
9523 | </div>
|
9524 | <div>
|
9525 | ${this.responseTemplate()}
|
9526 | </div>
|
9527 | </div>
|
9528 | `;
|
9529 | }
|
9530 | resetSelection() {
|
9531 | this.selectedStatus = '';
|
9532 | this.selectedMimeType = '';
|
9533 | }
|
9534 |
|
9535 |
|
9536 | responseTemplate() {
|
9537 | if (!this.responses) {
|
9538 | return '';
|
9539 | }
|
9540 | for (const statusCode in this.responses) {
|
9541 | if (!this.selectedStatus) {
|
9542 | this.selectedStatus = statusCode;
|
9543 | }
|
9544 | const allMimeResp = {};
|
9545 | for (const mimeResp in (_this$responses$statu = this.responses[statusCode]) === null || _this$responses$statu === void 0 ? void 0 : _this$responses$statu.content) {
|
9546 | var _this$responses$statu, _respExamples$;
|
9547 | const mimeRespObj = this.responses[statusCode].content[mimeResp];
|
9548 | if (!this.selectedMimeType) {
|
9549 | this.selectedMimeType = mimeResp;
|
9550 | }
|
9551 |
|
9552 | const schemaTree = schemaInObjectNotation(mimeRespObj.schema, {});
|
9553 |
|
9554 | const respExamples = generateExample(mimeRespObj.schema, mimeResp, standardizeExample(mimeRespObj.examples), standardizeExample(mimeRespObj.example), this.callback === 'true' || this.webhook === 'true' ? false : true,
|
9555 |
|
9556 | this.callback === 'true' || this.webhook === 'true' ? true : false,
|
9557 |
|
9558 | mimeResp.includes('json') ? 'json' : 'text');
|
9559 | allMimeResp[mimeResp] = {
|
9560 | description: this.responses[statusCode].description,
|
9561 | examples: respExamples,
|
9562 | selectedExample: ((_respExamples$ = respExamples[0]) === null || _respExamples$ === void 0 ? void 0 : _respExamples$.exampleId) || '',
|
9563 | schemaTree
|
9564 | };
|
9565 | }
|
9566 |
|
9567 | const tempHeaders = [];
|
9568 | for (const key in (_this$responses$statu2 = this.responses[statusCode]) === null || _this$responses$statu2 === void 0 ? void 0 : _this$responses$statu2.headers) {
|
9569 | var _this$responses$statu2;
|
9570 | tempHeaders.push({
|
9571 | name: key,
|
9572 | ...this.responses[statusCode].headers[key]
|
9573 | });
|
9574 | }
|
9575 | this.headersForEachRespStatus[statusCode] = tempHeaders;
|
9576 | this.mimeResponsesForEachStatus[statusCode] = allMimeResp;
|
9577 | }
|
9578 | return ke`
|
9579 | ${Object.keys(this.responses).length > 1 ? ke`<div class='row' style='flex-wrap:wrap'>
|
9580 | ${Object.keys(this.responses).map(respStatus => ke`
|
9581 | ${respStatus === '$$ref' // Swagger-Client parser creates '$$ref' object if JSON references are used to create responses - this should be ignored
|
9582 | ? '' : ke`
|
9583 | <button
|
9584 | @click="${() => {
|
9585 | this.selectedStatus = respStatus;
|
9586 | if (this.responses[respStatus].content && Object.keys(this.responses[respStatus].content)[0]) {
|
9587 | this.selectedMimeType = Object.keys(this.responses[respStatus].content)[0]; // eslint-disable-line prefer-destructuring
|
9588 | } else {
|
9589 | this.selectedMimeType = undefined;
|
9590 | }
|
9591 | }}"
|
9592 | class='m-btn small ${this.selectedStatus === respStatus ? 'primary' : ''}'
|
9593 | part="btn ${this.selectedStatus === respStatus ? 'btn-response-status btn-selected-response-status' : ' btn-response-status'}"
|
9594 | style='margin: 8px 4px 0 0'
|
9595 | >
|
9596 | ${respStatus}
|
9597 | </button>`}`)}</div>` : ke`<span>${Object.keys(this.responses)[0]}</span>`}
|
9598 |
|
9599 | ${Object.keys(this.responses).map(status => {
|
9600 | var _this$responses$statu3, _this$headersForEachR;
|
9601 | return ke`
|
9602 | <div style = 'display: ${status === this.selectedStatus ? 'block' : 'none'}' >
|
9603 | <div class="top-gap">
|
9604 | <span class="resp-descr m-markdown ">${unsafe_html_ae(marked(((_this$responses$statu3 = this.responses[status]) === null || _this$responses$statu3 === void 0 ? void 0 : _this$responses$statu3.description) || ''))}</span>
|
9605 | ${this.headersForEachRespStatus[status] && ((_this$headersForEachR = this.headersForEachRespStatus[status]) === null || _this$headersForEachR === void 0 ? void 0 : _this$headersForEachR.length) > 0 ? ke`${this.responseHeaderListTemplate(this.headersForEachRespStatus[status])}` : ''}
|
9606 | </div>
|
9607 | ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 0 ? '' : ke`
|
9608 | <div part="tab-panel" class="tab-panel col">
|
9609 | <div part="tab-btn-row" class="tab-buttons row" @click="${e => {
|
9610 | if (e.target.tagName.toLowerCase() === 'button') {
|
9611 | this.activeSchemaTab = e.target.dataset.tab;
|
9612 | }
|
9613 | }}" >
|
9614 | <button part="tab-btn" class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
|
9615 | <button part="tab-btn" class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema' >SCHEMA</button>
|
9616 | <div style="flex:1"></div>
|
9617 | ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 1 ? ke`<span class='small-font-size gray-text' style='align-self:center; margin-top:8px;'> ${Object.keys(this.mimeResponsesForEachStatus[status])[0]} </span>` : ke`${this.mimeTypeDropdownTemplate(Object.keys(this.mimeResponsesForEachStatus[status]))}`}
|
9618 | </div>
|
9619 | ${this.activeSchemaTab === 'example' ? ke`<div part="tab-content" class ='tab-content col' style = 'flex:1;'>
|
9620 | ${this.mimeExampleTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}
|
9621 | </div>` : ke`<div part="tab-content" class ='tab-content col' style = 'flex:1;'>
|
9622 | ${this.mimeSchemaTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}
|
9623 | </div>`}
|
9624 | </div>
|
9625 | `}</div>`;
|
9626 | })}
|
9627 | `;
|
9628 | }
|
9629 | responseHeaderListTemplate(respHeaders) {
|
9630 | return ke`
|
9631 | <div style="padding:16px 0 8px 0" class="resp-headers small-font-size bold-text">RESPONSE HEADERS</div>
|
9632 | <table role="presentation" style="border-collapse: collapse; margin-bottom:16px; border:1px solid var(--border-color); border-radius: var(--border-radius)" class="small-font-size mono-font">
|
9633 | ${respHeaders.map(v => {
|
9634 | var _v$schema, _v$schema2;
|
9635 | return ke`
|
9636 | <tr>
|
9637 | <td style="padding:8px; vertical-align: baseline; min-width:120px; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
|
9638 | ${v.name || ''}
|
9639 | </td>
|
9640 | <td style="padding:4px; vertical-align: baseline; padding:0 5px; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
|
9641 | ${((_v$schema = v.schema) === null || _v$schema === void 0 ? void 0 : _v$schema.type) || ''}
|
9642 | </td>
|
9643 | <td style="padding:8px; vertical-align: baseline; border-top: 1px solid var(--light-border-color);text-overflow: ellipsis;">
|
9644 | <div class="m-markdown-small regular-font" >${unsafe_html_ae(marked(v.description || ''))}</div>
|
9645 | </td>
|
9646 | <td style="padding:8px; vertical-align: baseline; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
|
9647 | ${((_v$schema2 = v.schema) === null || _v$schema2 === void 0 ? void 0 : _v$schema2.example) || ''}
|
9648 | </td>
|
9649 | </tr>
|
9650 | `;
|
9651 | })}
|
9652 | </table>`;
|
9653 | }
|
9654 | mimeTypeDropdownTemplate(mimeTypes) {
|
9655 | return ke`
|
9656 | <select aria-label='mime types' @change="${e => {
|
9657 | this.selectedMimeType = e.target.value;
|
9658 | }}" style='margin-bottom: -1px; z-index:1'>
|
9659 | ${mimeTypes.map(mimeType => ke`<option value='${mimeType}' ?selected = '${mimeType === this.selectedMimeType}'> ${mimeType} </option>`)}
|
9660 | </select>`;
|
9661 | }
|
9662 | onSelectExample(e) {
|
9663 | const exampleContainerEl = e.target.closest('.example-panel');
|
9664 | const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];
|
9665 | exampleEls.forEach(v => {
|
9666 | v.style.display = v.dataset.example === e.target.value ? 'block' : 'none';
|
9667 | });
|
9668 | }
|
9669 | mimeExampleTemplate(mimeRespDetails) {
|
9670 | if (!mimeRespDetails) {
|
9671 | return ke`
|
9672 | <pre style='color:var(--red)' class = '${this.renderStyle === 'read' ? 'read example-panel border pad-8-16' : 'example-panel border-top'}'> No example provided </pre>
|
9673 | `;
|
9674 | }
|
9675 | return ke`
|
9676 | ${mimeRespDetails.examples.length === 1 ? ke`
|
9677 | ${mimeRespDetails.examples[0].exampleFormat === 'json' ? ke`
|
9678 | ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? ke`<div style="padding: 4px 0"> ${mimeRespDetails.examples[0].exampleSummary} </div>` : ''}
|
9679 | ${mimeRespDetails.examples[0].exampleDescription ? ke`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_ae(marked(mimeRespDetails.examples[0].exampleDescription || ''))} </div>` : ''}
|
9680 | <json-tree
|
9681 | render-style = '${this.renderStyle}'
|
9682 | .data="${mimeRespDetails.examples[0].exampleValue}"
|
9683 | class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'
|
9684 | exportparts = "btn:btn, btn-fill:btn-fill, btn-copy:btn-copy"
|
9685 | ></json-tree>` : ke`
|
9686 | ${mimeRespDetails.examples[0].exampleSummary && mimeRespDetails.examples[0].exampleSummary.length > 80 ? ke`<div style="padding: 4px 0"> ${mimeRespDetails.examples[0].exampleSummary} </div>` : ''}
|
9687 | ${mimeRespDetails.examples[0].exampleDescription ? ke`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_ae(marked(mimeRespDetails.examples[0].exampleDescription || ''))} </div>` : ''}
|
9688 | <pre class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'>${mimeRespDetails.examples[0].exampleValue}</pre>
|
9689 | `}` : ke`
|
9690 | <span class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'>
|
9691 | <select aria-label='response examples' style="min-width:100px; max-width:100%" @change='${e => this.onSelectExample(e)}'>
|
9692 | ${mimeRespDetails.examples.map(v => ke`<option value="${v.exampleId}" ?selected=${v.exampleId === mimeRespDetails.selectedExample} >
|
9693 | ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary}
|
9694 | </option>`)}
|
9695 | </select>
|
9696 | ${mimeRespDetails.examples.map(v => ke`
|
9697 | <div class="example" data-example = '${v.exampleId}' style = "display: ${v.exampleId === mimeRespDetails.selectedExample ? 'block' : 'none'}">
|
9698 | ${v.exampleSummary && v.exampleSummary.length > 80 ? ke`<div style="padding: 4px 0"> ${v.exampleSummary} </div>` : ''}
|
9699 | ${v.exampleDescription ? ke`<div class="m-markdown-small" style="padding: 4px 0"> ${unsafe_html_ae(marked(v.exampleDescription || ''))} </div>` : ''}
|
9700 | ${v.exampleFormat === 'json' ? ke`
|
9701 | <json-tree
|
9702 | render-style = '${this.renderStyle}'
|
9703 | .data = '${v.exampleValue}'
|
9704 | exportparts = "btn:btn, btn-fill:btn-fill, btn-copy:btn-copy"
|
9705 | ></json-tree>` : ke`<pre>${v.exampleValue}</pre>`}
|
9706 | </div>
|
9707 | `)}
|
9708 | </span>
|
9709 | `}
|
9710 | `;
|
9711 | }
|
9712 | mimeSchemaTemplate(mimeRespDetails) {
|
9713 | if (!mimeRespDetails) {
|
9714 | return ke`
|
9715 | <pre style='color:var(--red)' class = '${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top'}'> Schema not found</pre>
|
9716 | `;
|
9717 | }
|
9718 | return ke`
|
9719 | ${this.schemaStyle === 'table' ? ke`
|
9720 | <schema-table
|
9721 | .data = "${mimeRespDetails.schemaTree}"
|
9722 | schema-expand-level = "${this.schemaExpandLevel}"
|
9723 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
9724 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
9725 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
9726 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
9727 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
9728 | > </schema-table> ` : ke`
|
9729 | <schema-tree
|
9730 | .data = '${mimeRespDetails.schemaTree}'
|
9731 | schema-expand-level = "${this.schemaExpandLevel}"
|
9732 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
9733 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
9734 | schema-hide-read-only = "${this.schemaHideReadOnly}"
|
9735 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
9736 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
9737 | > </schema-tree>`}`;
|
9738 | }
|
9739 |
|
9740 | }
|
9741 |
|
9742 |
|
9743 | customElements.define('api-response', ApiResponse);
|
9744 | ;
|
9745 |
|
9746 |
|
9747 |
|
9748 |
|
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 |
|
9754 |
|
9755 |
|
9756 | function headingRenderer(tagElementId) {
|
9757 | const renderer = new marked.Renderer();
|
9758 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="${tagElementId}--${slugger.slug(raw)}">${text}</h${level}>`;
|
9759 | return renderer;
|
9760 | }
|
9761 | function expandCollapseTagDescription(e) {
|
9762 | const tagDescriptionEl = e.target.closest('.tag-container').querySelector('.tag-description');
|
9763 | const tagIconEl = e.target.closest('.tag-container').querySelector('.tag-icon');
|
9764 | if (tagDescriptionEl && tagIconEl) {
|
9765 | const isExpanded = tagDescriptionEl.classList.contains('expanded');
|
9766 | if (isExpanded) {
|
9767 | tagDescriptionEl.style.maxHeight = 0;
|
9768 | tagDescriptionEl.classList.replace('expanded', 'collapsed');
|
9769 | tagIconEl.classList.replace('expanded', 'collapsed');
|
9770 | } else {
|
9771 | tagDescriptionEl.style.maxHeight = `${tagDescriptionEl.scrollHeight}px`;
|
9772 | tagDescriptionEl.classList.replace('collapsed', 'expanded');
|
9773 | tagIconEl.classList.replace('collapsed', 'expanded');
|
9774 | }
|
9775 | }
|
9776 | }
|
9777 | function expandedEndpointBodyTemplate(path, tagName = '', tagDescription = '') {
|
9778 | var _path$xBadges, _path$externalDocs, _path$externalDocs2, _path$externalDocs3, _path$externalDocs4, _path$externalDocs5, _path$externalDocs6, _path$servers, _this$selectedServer;
|
9779 | const acceptContentTypes = new Set();
|
9780 | for (const respStatus in path.responses) {
|
9781 | for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
9782 | var _path$responses$respS;
|
9783 | acceptContentTypes.add(acceptContentType.trim());
|
9784 | }
|
9785 | }
|
9786 | const accept = [...acceptContentTypes].join(', ');
|
9787 |
|
9788 |
|
9789 | const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => {
|
9790 | var _path$security;
|
9791 | return v.finalKeyValue && ((_path$security = path.security) === null || _path$security === void 0 ? void 0 : _path$security.some(ps => v.securitySchemeId in ps));
|
9792 | }) || [];
|
9793 |
|
9794 |
|
9795 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey && v.value !== '-');
|
9796 | if (rapiDocApiKey) {
|
9797 | nonEmptyApiKeys.push(rapiDocApiKey);
|
9798 | }
|
9799 | const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';
|
9800 | return ke`
|
9801 | ${this.renderStyle === 'read' ? ke`<div class='divider' part="operation-divider"></div>` : ''}
|
9802 | <div class='expanded-endpoint-body observe-me ${path.method} ${path.deprecated ? 'deprecated' : ''} ' part="section-operation ${path.elementId}" id='${path.elementId}'>
|
9803 | ${this.renderStyle === 'focused' && tagName !== 'General ⦂' ? ke`
|
9804 | <div class="tag-container" part="section-operation-tag">
|
9805 | <span class="upper" style="font-weight:bold; font-size:18px;"> ${tagName} </span>
|
9806 | ${tagDescription ? ke`
|
9807 | <svg class="tag-icon collapsed" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" fill="none" style="stroke:var(--primary-color); vertical-align:top; cursor:pointer"
|
9808 | @click="${e => {
|
9809 | expandCollapseTagDescription.call(this, e);
|
9810 | }}"
|
9811 | >
|
9812 | <path d="M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h8"></path><path d="M18 4v17"></path><path d="M15 18l3 3l3 -3"></path>
|
9813 | </svg>
|
9814 | <div class="tag-description collapsed" style="max-height:0px; overflow:hidden; margin-top:16px; border:1px solid var(--border-color)">
|
9815 | <div class="m-markdown" style="padding:8px"> ${unsafe_html_ae(marked(tagDescription))}</div>
|
9816 | </div>` : ''}
|
9817 | </div>
|
9818 | ` : ''}
|
9819 | ${path.deprecated ? ke`<div class="bold-text red-text"> DEPRECATED </div>` : ''}
|
9820 | ${ke`
|
9821 | ${path.xBadges && ((_path$xBadges = path.xBadges) === null || _path$xBadges === void 0 ? void 0 : _path$xBadges.length) > 0 ? ke`
|
9822 | <div style="display:flex; flex-wrap:wrap; margin-bottom: -24px; font-size: var(--font-size-small);">
|
9823 | ${path.xBadges.map(v => v.color === 'none' ? '' : ke`<span style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`)}
|
9824 | </div>
|
9825 | ` : ''}
|
9826 | <h2 part="section-operation-summary"> ${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2>
|
9827 | ${path.isWebhook ? ke`<span part="section-operation-webhook" style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>` : ke`
|
9828 | <div part="section-operation-webhook-method" class="mono-font regular-font-size" style="text-align:left; direction:ltr; padding: 8px 0; color:var(--fg3)">
|
9829 | <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span>
|
9830 | <span part="label-operation-path">${path.path}</span>
|
9831 | </div>
|
9832 | `}
|
9833 | <slot name="${path.elementId}"></slot>`}
|
9834 | ${path.description ? ke`<div class="m-markdown"> ${unsafe_html_ae(marked(path.description))}</div>` : ''}
|
9835 | ${pathSecurityTemplate.call(this, path.security)}
|
9836 | ${(_path$externalDocs = path.externalDocs) !== null && _path$externalDocs !== void 0 && _path$externalDocs.url || (_path$externalDocs2 = path.externalDocs) !== null && _path$externalDocs2 !== void 0 && _path$externalDocs2.description ? ke`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
|
9837 | <div class="m-markdown"> ${unsafe_html_ae(marked(((_path$externalDocs3 = path.externalDocs) === null || _path$externalDocs3 === void 0 ? void 0 : _path$externalDocs3.description) || ''))} </div>
|
9838 | ${(_path$externalDocs4 = path.externalDocs) !== null && _path$externalDocs4 !== void 0 && _path$externalDocs4.url ? ke`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${(_path$externalDocs5 = path.externalDocs) === null || _path$externalDocs5 === void 0 ? void 0 : _path$externalDocs5.url}" target="_blank">
|
9839 | ${(_path$externalDocs6 = path.externalDocs) === null || _path$externalDocs6 === void 0 ? void 0 : _path$externalDocs6.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
|
9840 | </a>` : ''}
|
9841 | </div>` : ''}
|
9842 | ${codeSampleTabPanel}
|
9843 | <div class='expanded-req-resp-container'>
|
9844 | <api-request
|
9845 | class = "${this.renderStyle}-mode"
|
9846 | style = "width:100%;"
|
9847 | webhook = "${path.isWebhook}"
|
9848 | method = "${path.method}"
|
9849 | path = "${path.path}"
|
9850 | .security = "${path.security}"
|
9851 | .parameters = "${path.parameters}"
|
9852 | .request_body = "${path.requestBody}"
|
9853 | .api_keys = "${nonEmptyApiKeys}"
|
9854 | .servers = "${path.servers}"
|
9855 | server-url = "${((_path$servers = path.servers) === null || _path$servers === void 0 || (_path$servers = _path$servers[0]) === null || _path$servers === void 0 ? void 0 : _path$servers.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}"
|
9856 | fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
9857 | allow-try = "${this.allowTry}"
|
9858 | show-curl-before-try = "${this.showCurlBeforeTry}"
|
9859 | accept = "${accept}"
|
9860 | render-style="${this.renderStyle}"
|
9861 | schema-style = "${this.schemaStyle}"
|
9862 | active-schema-tab = "${this.defaultSchemaTab}"
|
9863 | schema-expand-level = "${this.schemaExpandLevel}"
|
9864 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
9865 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
9866 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
9867 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
9868 | fetch-credentials = "${this.fetchCredentials}"
|
9869 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
9870 | tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
|
9871 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
9872 | anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
9873 | > </api-request>
|
9874 |
|
9875 | ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
9876 |
|
9877 | <api-response
|
9878 | class = "${this.renderStyle}-mode"
|
9879 | style = "width:100%;"
|
9880 | webhook = "${path.isWebhook}"
|
9881 | .responses = "${path.responses}"
|
9882 | render-style = "${this.renderStyle}"
|
9883 | schema-style = "${this.schemaStyle}"
|
9884 | active-schema-tab = "${this.defaultSchemaTab}"
|
9885 | schema-expand-level = "${this.schemaExpandLevel}"
|
9886 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
9887 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
9888 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
9889 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
9890 | selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
9891 | exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
|
9892 | tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
|
9893 | schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
9894 | > </api-response>
|
9895 | </div>
|
9896 | </div>
|
9897 | `;
|
9898 | }
|
9899 | function expandedEndpointTemplate() {
|
9900 | if (!this.resolvedSpec) {
|
9901 | return '';
|
9902 | }
|
9903 | return ke`
|
9904 | ${this.resolvedSpec.tags.map(tag => ke`
|
9905 | <section id="${tag.elementId}" part="section-tag" class="regular-font section-gap--read-mode observe-me" style="border-top:1px solid var(--primary-color);">
|
9906 | <div class="title tag" part="section-tag-title label-tag-title">${tag.displayName || tag.name}</div>
|
9907 | <slot name="${tag.elementId}"></slot>
|
9908 | <div class="regular-font-size">
|
9909 | ${unsafe_html_ae(`
|
9910 | <div class="m-markdown regular-font">
|
9911 | ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? {
|
9912 | renderer: headingRenderer(tag.elementId)
|
9913 | } : undefined)}
|
9914 | </div>`)}
|
9915 | </div>
|
9916 | </section>
|
9917 | <section class="regular-font section-gap--read-mode" part="section-operations-in-tag">
|
9918 | ${tag.paths.map(path => expandedEndpointBodyTemplate.call(this, path))}
|
9919 | </section>
|
9920 | `)}
|
9921 | `;
|
9922 | }
|
9923 |
|
9924 | ;
|
9925 |
|
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 | function schemaBodyTemplate(sComponent) {
|
9933 | return ke`
|
9934 | <div class='divider'></div>
|
9935 | <div class='expanded-endpoint-body observe-me ${sComponent.name}' id='cmp--${sComponent.id}' >
|
9936 | <div style="font-weight:bold"> ${sComponent.name} <span style="color:var(--light-fg); font-size:var(--font-size-small); font-weight:400;"> Schema </span></div>
|
9937 | ${this.schemaStyle === 'table' ? ke`
|
9938 | <schema-table
|
9939 | .data = '${schemaInObjectNotation(sComponent.component, {})}'
|
9940 | schema-expand-level = "${this.schemaExpandLevel}"
|
9941 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
9942 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
9943 | schema-hide-read-only = "false"
|
9944 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
9945 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
9946 | > </schema-table>` : ke`
|
9947 | <schema-tree
|
9948 | .data = '${schemaInObjectNotation(sComponent.component, {})}'
|
9949 | schema-expand-level = "${this.schemaExpandLevel}"
|
9950 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
9951 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
9952 | schema-hide-read-only = "false"
|
9953 | schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
9954 | exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
9955 | > </schema-tree>`}
|
9956 | </div>`;
|
9957 | }
|
9958 | function componentBodyTemplate(sComponent, componentType) {
|
9959 | if (sComponent.id.indexOf('schemas-') !== -1) {
|
9960 | return schemaBodyTemplate.call(this, sComponent);
|
9961 | }
|
9962 | return ke`
|
9963 | <div class='divider'></div>
|
9964 | <div class='expanded-endpoint-body observe-me ${sComponent.name}' id='cmp--${sComponent.id}' >
|
9965 | ${ke`
|
9966 | <div style="font-weight:bold"> ${sComponent.name} <span style="color:var(--light-fg); font-size:var(--font-size-small); font-weight:400"> ${componentType} </span> </div>
|
9967 | ${sComponent.component ? ke`
|
9968 | <div class='mono-font regular-font-size' style='padding: 8px 0; color:var(--fg2)'>
|
9969 | <json-tree class="border tree" render-style='${this.renderStyle}' .data="${sComponent.component}"> </json-tree>
|
9970 | </div>` : ''}
|
9971 | `}
|
9972 | </div>
|
9973 | `;
|
9974 | }
|
9975 | function componentsTemplate() {
|
9976 | if (!this.resolvedSpec) {
|
9977 | return '';
|
9978 | }
|
9979 | return ke`
|
9980 | ${this.resolvedSpec.components.map(component => ke`
|
9981 | <div id="cmp--${component.name.toLowerCase()}" class='regular-font section-gap--read-mode observe-me' style="border-top:1px solid var(--primary-color);">
|
9982 | <div class="title tag">${component.name}</div>
|
9983 | <div class="regular-font-size">
|
9984 | ${unsafe_html_ae(`<div class='m-markdown regular-font'>${marked(component.description ? component.description : '')}</div>`)}
|
9985 | </div>
|
9986 | </div>
|
9987 | <div class='regular-font section-gap--read-mode'>
|
9988 | ${component.subComponents.filter(c => c.expanded !== false).map(sComponent => componentBodyTemplate.call(this, sComponent, component.name))}
|
9989 | </div>
|
9990 | `)}
|
9991 | `;
|
9992 | }
|
9993 |
|
9994 | ;
|
9995 |
|
9996 |
|
9997 |
|
9998 |
|
9999 |
|
10000 |
|
10001 | function overview_template_headingRenderer() {
|
10002 | const renderer = new marked.Renderer();
|
10003 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="overview--${slugger.slug(raw)}">${text}</h${level}>`;
|
10004 | return renderer;
|
10005 | }
|
10006 | function overviewTemplate() {
|
10007 | var _this$resolvedSpec, _this$resolvedSpec$in, _this$resolvedSpec$in2, _this$specUrl;
|
10008 | return ke`
|
10009 | <section id="overview" part="section-overview"
|
10010 | class="observe-me ${this.renderStyle === 'view' ? 'section-gap' : 'section-gap--read-mode'}">
|
10011 | ${(_this$resolvedSpec = this.resolvedSpec) !== null && _this$resolvedSpec !== void 0 && _this$resolvedSpec.info ? ke`
|
10012 | <div id="api-title" part="section-overview-title" style="font-size:32px">
|
10013 | ${this.resolvedSpec.info.title}
|
10014 | ${!this.resolvedSpec.info.version ? '' : ke`
|
10015 | <span style = 'font-size:var(--font-size-small);font-weight:bold'>
|
10016 | ${this.resolvedSpec.info.version}
|
10017 | </span>`}
|
10018 | </div>
|
10019 | <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px); margin-top:8px;">
|
10020 | ${(_this$resolvedSpec$in = this.resolvedSpec.info.contact) !== null && _this$resolvedSpec$in !== void 0 && _this$resolvedSpec$in.email ? ke`<span>${this.resolvedSpec.info.contact.name || 'Email'}:
|
10021 | <a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a>
|
10022 | </span>` : ''}
|
10023 | ${(_this$resolvedSpec$in2 = this.resolvedSpec.info.contact) !== null && _this$resolvedSpec$in2 !== void 0 && _this$resolvedSpec$in2.url ? ke`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''}
|
10024 | ${this.resolvedSpec.info.license ? ke`<span>License:
|
10025 | ${this.resolvedSpec.info.license.url ? ke`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''}
|
10026 | ${this.resolvedSpec.info.termsOfService ? ke`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">Terms of Service</a></span>` : ''}
|
10027 | ${this.specUrl && this.allowSpecFileDownload === 'true' ? ke`
|
10028 | <div style="display:flex; margin:12px 0; gap:8px; justify-content: start;">
|
10029 | <button class="m-btn thin-border" style="min-width:170px" part="btn btn-outline" @click='${e => {
|
10030 | downloadResource(this.specUrl, 'openapi-spec', e);
|
10031 | }}'>Download OpenAPI spec</button>
|
10032 | ${(_this$specUrl = this.specUrl) !== null && _this$specUrl !== void 0 && _this$specUrl.trim().toLowerCase().endsWith('json') ? ke`<button class="m-btn thin-border" style="width:200px" part="btn btn-outline" @click='${e => {
|
10033 | viewResource(this.specUrl, e);
|
10034 | }}'>View OpenAPI spec (New Tab)</button>` : ''}
|
10035 | </div>` : ''}
|
10036 | </div>
|
10037 | <slot name="overview"></slot>
|
10038 | <div id="api-description">
|
10039 | ${this.resolvedSpec.info.description ? ke`${unsafe_html_ae(`
|
10040 | <div class="m-markdown regular-font">
|
10041 | ${marked(this.resolvedSpec.info.description, this.infoDescriptionHeadingsInNavBar === 'true' ? {
|
10042 | renderer: overview_template_headingRenderer()
|
10043 | } : undefined)}
|
10044 | </div>`)}` : ''}
|
10045 | </div>
|
10046 | ` : ''}
|
10047 | </section>
|
10048 | `;
|
10049 | }
|
10050 |
|
10051 | ;
|
10052 |
|
10053 |
|
10054 |
|
10055 | function setApiServer(serverUrl) {
|
10056 | var _this$resolvedSpec;
|
10057 | const serverObj = (_this$resolvedSpec = this.resolvedSpec) === null || _this$resolvedSpec === void 0 ? void 0 : _this$resolvedSpec.servers.find(s => s.url === serverUrl);
|
10058 | if (!serverObj) {
|
10059 | return false;
|
10060 | }
|
10061 | this.selectedServer = serverObj;
|
10062 | this.requestUpdate();
|
10063 | this.dispatchEvent(new CustomEvent('api-server-change', {
|
10064 | bubbles: true,
|
10065 | composed: true,
|
10066 | detail: {
|
10067 | selectedServer: serverObj
|
10068 | }
|
10069 | }));
|
10070 | return true;
|
10071 | }
|
10072 | function onApiServerVarChange(e, serverObj) {
|
10073 | const inputEls = [...e.currentTarget.closest('table').querySelectorAll('input, select')];
|
10074 | let tempUrl = serverObj.url;
|
10075 | inputEls.forEach(v => {
|
10076 | const regex = new RegExp(`{${v.dataset.var}}`, 'g');
|
10077 | tempUrl = tempUrl.replace(regex, v.value);
|
10078 | });
|
10079 | serverObj.computedUrl = tempUrl;
|
10080 | this.requestUpdate();
|
10081 | }
|
10082 |
|
10083 |
|
10084 | function serverVarsTemplate() {
|
10085 |
|
10086 | return this.selectedServer && this.selectedServer.variables ? ke`
|
10087 | <div class="table-title">SERVER VARIABLES</div>
|
10088 | <table class='m-table' role='presentation'>
|
10089 | ${Object.entries(this.selectedServer.variables).map(kv => ke`
|
10090 | <tr>
|
10091 | <td style="vertical-align: middle;" >${kv[0]}</td>
|
10092 | <td>
|
10093 | ${kv[1].enum ? ke`
|
10094 | <select
|
10095 | data-var = "${kv[0]}"
|
10096 | @input = ${e => {
|
10097 | onApiServerVarChange.call(this, e, this.selectedServer);
|
10098 | }}
|
10099 | >
|
10100 | ${Object.entries(kv[1].enum).map(e => kv[1].default === e[1] ? ke`
|
10101 | <option
|
10102 | selected
|
10103 | label = ${e[1]}
|
10104 | value = ${e[1]}
|
10105 | />` : ke`
|
10106 | <option
|
10107 | label = ${e[1]}
|
10108 | value = ${e[1]}
|
10109 | />`)}
|
10110 | </select>` : ke`
|
10111 | <input
|
10112 | type = "text"
|
10113 | part="textbox textbox-server-var"
|
10114 | spellcheck = "false"
|
10115 | data-var = "${kv[0]}"
|
10116 | value = "${kv[1].default}"
|
10117 | @input = ${e => {
|
10118 | onApiServerVarChange.call(this, e, this.selectedServer);
|
10119 | }}
|
10120 | />`}
|
10121 | </td>
|
10122 | </tr>
|
10123 | ${kv[1].description ? ke`<tr><td colspan="2" style="border:none"><span class="m-markdown-small"> ${unsafe_html_ae(marked(kv[1].description))} </span></td></tr>` : ''}
|
10124 | `)}
|
10125 | </table>
|
10126 | ` : '';
|
10127 | }
|
10128 | function serverTemplate() {
|
10129 | var _this$resolvedSpec$se, _this$resolvedSpec2, _this$selectedServer;
|
10130 | if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {
|
10131 | return '';
|
10132 | }
|
10133 | return ke`
|
10134 | <section id = 'servers' part="section-servers" style="text-align:left; direction:ltr; margin-top:24px; margin-bottom:24px;" class='regular-font observe-me ${'read focused'.includes(this.renderStyle) ? 'section-gap--read-mode' : 'section-gap'}'>
|
10135 | <div part = "section-servers-title" class = "sub-title">API SERVER</div>
|
10136 | <div class = 'mono-font' style='margin: 12px 0; font-size:calc(var(--font-size-small) + 1px);'>
|
10137 | ${!this.resolvedSpec.servers || ((_this$resolvedSpec$se = this.resolvedSpec.servers) === null || _this$resolvedSpec$se === void 0 ? void 0 : _this$resolvedSpec$se.length) === 0 ? '' : ke`
|
10138 | ${(_this$resolvedSpec2 = this.resolvedSpec) === null || _this$resolvedSpec2 === void 0 ? void 0 : _this$resolvedSpec2.servers.map((server, i) => ke`
|
10139 | <input type = 'radio'
|
10140 | name = 'api_server'
|
10141 | id = 'srvr-opt-${i}'
|
10142 | value = '${server.url}'
|
10143 | @change = ${() => {
|
10144 | setApiServer.call(this, server.url);
|
10145 | }}
|
10146 | .checked = '${this.selectedServer.url === server.url}'
|
10147 | style = 'margin:4px 0; cursor:pointer'
|
10148 | />
|
10149 | <label style='cursor:pointer' for='srvr-opt-${i}'>
|
10150 | ${server.url} ${server.description ? ke`- <span class='regular-font'>${server.description} </span>` : ''}
|
10151 | </label>
|
10152 | <br/>
|
10153 | `)}
|
10154 | `}
|
10155 | <div class="table-title primary-text" part="label-selected-server"> SELECTED: ${((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl) || 'none'}</div>
|
10156 | </div>
|
10157 | <slot name="servers"></slot>
|
10158 | ${serverVarsTemplate.call(this)}
|
10159 | </section>`;
|
10160 | }
|
10161 |
|
10162 | ;
|
10163 |
|
10164 |
|
10165 |
|
10166 | function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {
|
10167 | const tagAndPathEl = navLinkEl === null || navLinkEl === void 0 ? void 0 : navLinkEl.closest('.nav-bar-tag-and-paths');
|
10168 | const pathsUnderTagEl = tagAndPathEl === null || tagAndPathEl === void 0 ? void 0 : tagAndPathEl.querySelector('.nav-bar-paths-under-tag');
|
10169 | if (tagAndPathEl) {
|
10170 | const isExpanded = tagAndPathEl.classList.contains('expanded');
|
10171 | if (isExpanded && (action === 'toggle' || action === 'collapse')) {
|
10172 | pathsUnderTagEl.style.maxHeight = 0;
|
10173 | tagAndPathEl.classList.replace('expanded', 'collapsed');
|
10174 | } else if (!isExpanded && (action === 'toggle' || action === 'expand')) {
|
10175 | tagAndPathEl.classList.replace('collapsed', 'expanded');
|
10176 | pathsUnderTagEl.style.maxHeight = `${pathsUnderTagEl.scrollHeight}px`;
|
10177 | }
|
10178 | }
|
10179 | }
|
10180 | function expandCollapseAll(event, action = 'expand-all') {
|
10181 | if (!(event.type === 'click' || event.type === 'keyup' && event.keyCode === 13)) {
|
10182 | return;
|
10183 | }
|
10184 | const navEl = event.target.closest('.nav-scroll');
|
10185 | const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];
|
10186 | if (action === 'expand-all') {
|
10187 | elList.forEach(el => {
|
10188 | const navBarPathsUnderTagEl = el.querySelector('.nav-bar-paths-under-tag');
|
10189 | el.classList.replace('collapsed', 'expanded');
|
10190 | navBarPathsUnderTagEl.style.maxHeight = `${navBarPathsUnderTagEl === null || navBarPathsUnderTagEl === void 0 ? void 0 : navBarPathsUnderTagEl.scrollHeight}px`;
|
10191 | });
|
10192 | } else {
|
10193 | elList.forEach(el => {
|
10194 | el.classList.replace('expanded', 'collapsed');
|
10195 | el.querySelector('.nav-bar-paths-under-tag').style.maxHeight = 0;
|
10196 | });
|
10197 | }
|
10198 | }
|
10199 | function navBarClickAndEnterHandler(event) {
|
10200 | var _navEl$dataset, _navEl$dataset2, _navEl$dataset3, _navEl$dataset4;
|
10201 | if (!(event.type === 'click' || event.type === 'keyup' && event.keyCode === 13)) {
|
10202 | return;
|
10203 | }
|
10204 | const navEl = event.target;
|
10205 | event.stopPropagation();
|
10206 | if (((_navEl$dataset = navEl.dataset) === null || _navEl$dataset === void 0 ? void 0 : _navEl$dataset.action) === 'navigate') {
|
10207 | this.scrollToEventTarget(event, false);
|
10208 | } else if (((_navEl$dataset2 = navEl.dataset) === null || _navEl$dataset2 === void 0 ? void 0 : _navEl$dataset2.action) === 'expand-all' || ((_navEl$dataset3 = navEl.dataset) === null || _navEl$dataset3 === void 0 ? void 0 : _navEl$dataset3.action) === 'collapse-all') {
|
10209 | expandCollapseAll(event, navEl.dataset.action);
|
10210 | } else if (((_navEl$dataset4 = navEl.dataset) === null || _navEl$dataset4 === void 0 ? void 0 : _navEl$dataset4.action) === 'expand-collapse-tag') {
|
10211 | expandCollapseNavBarTag(navEl, 'toggle');
|
10212 | }
|
10213 | }
|
10214 |
|
10215 |
|
10216 | function navbarTemplate() {
|
10217 | var _this$resolvedSpec$in, _this$resolvedSpec$in2;
|
10218 | if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {
|
10219 | return ke`
|
10220 | <nav class='nav-bar' part='section-navbar'>
|
10221 | <slot name='nav-logo' class='logo'></slot>
|
10222 | </nav>
|
10223 | `;
|
10224 | }
|
10225 | return ke`
|
10226 | <nav class='nav-bar ${this.renderStyle}' part='section-navbar'>
|
10227 | <slot name='nav-logo' class='logo'></slot>
|
10228 | ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : ke`
|
10229 | <div style='display:flex; flex-direction:row; justify-content:center; align-items:stretch; padding:8px 24px 12px 24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}' part='section-navbar-search'>
|
10230 | ${this.allowSearch === 'false' ? '' : ke`
|
10231 | <div style = 'display:flex; flex:1; line-height:22px;'>
|
10232 | <input id = 'nav-bar-search'
|
10233 | part = 'textbox textbox-nav-filter'
|
10234 | style = 'width:100%; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)'
|
10235 | type = 'text'
|
10236 | placeholder = 'Filter'
|
10237 | @change = '${this.onSearchChange}'
|
10238 | spellcheck = 'false'
|
10239 | >
|
10240 | <div style='margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;'>↩</div>
|
10241 | </div>
|
10242 | ${this.searchVal ? ke`
|
10243 | <button @click = '${this.onClearSearch}' class='m-btn thin-border' style='margin-left:5px; color:var(--nav-text-color); width:75px; padding:6px 8px;' part='btn btn-outline btn-clear-filter'>
|
10244 | CLEAR
|
10245 | </button>` : ''}
|
10246 | `}
|
10247 | ${this.allowAdvancedSearch === 'false' || this.searchVal ? '' : ke`
|
10248 | <button class='m-btn primary' part='btn btn-fill btn-search' style='margin-left:5px; padding:6px 8px; width:75px' @click='${this.onShowSearchModalClicked}'>
|
10249 | SEARCH
|
10250 | </button>
|
10251 | `}
|
10252 | </div>
|
10253 | `}
|
10254 | ${ke`<nav class='nav-scroll' tabindex='-1' part='section-navbar-scroll' @click='${e => navBarClickAndEnterHandler.call(this, e)}' @keyup='${e => navBarClickAndEnterHandler.call(this, e)}' >
|
10255 | ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : ke`
|
10256 | ${this.infoDescriptionHeadingsInNavBar === 'true' ? ke`
|
10257 | ${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? ke`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-overview' data-content-id='overview' data-action='navigate' tabindex='0' part='section-navbar-item section-navbar-overview'>
|
10258 | ${((_this$resolvedSpec$in = this.resolvedSpec.info) === null || _this$resolvedSpec$in === void 0 || (_this$resolvedSpec$in = _this$resolvedSpec$in.title) === null || _this$resolvedSpec$in === void 0 ? void 0 : _this$resolvedSpec$in.trim()) || 'Overview'}
|
10259 | </div>` : ''}
|
10260 | <div class='overview-headers'>
|
10261 | ${this.resolvedSpec.infoDescriptionHeaders.map(header => ke`
|
10262 | <div
|
10263 | class='nav-bar-h${header.depth} ${this.navActiveItemMarker}'
|
10264 | id='link-overview--${new marked.Slugger().slug(header.text)}'
|
10265 | data-action='navigate'
|
10266 | data-content-id='overview--${new marked.Slugger().slug(header.text)}'
|
10267 | >
|
10268 | ${header.text}
|
10269 | </div>`)}
|
10270 | </div>
|
10271 | ${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? ke`<hr style='border-top: 1px solid var(--nav-hover-bg-color); border-width:1px 0 0 0; margin: 15px 0 0 0'/>` : ''}
|
10272 | ` : ke`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-overview' data-action='navigate' data-content-id='overview' tabindex='0'>
|
10273 | ${((_this$resolvedSpec$in2 = this.resolvedSpec.info) === null || _this$resolvedSpec$in2 === void 0 || (_this$resolvedSpec$in2 = _this$resolvedSpec$in2.title) === null || _this$resolvedSpec$in2 === void 0 ? void 0 : _this$resolvedSpec$in2.trim()) || 'Overview'}
|
10274 | </div>`}
|
10275 | `}
|
10276 |
|
10277 | ${this.allowServerSelection === 'false' ? '' : ke`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-servers' data-action='navigate' data-content-id='servers' tabindex='0' part='section-navbar-item section-navbar-servers'> API Servers </div>`}
|
10278 | ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : ke`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-auth' data-action='navigate' data-content-id='auth' tabindex='0' part='section-navbar-item section-navbar-auth'> Authentication </div>`}
|
10279 |
|
10280 | <div id='link-operations-top' class='nav-bar-section operations' data-action='navigate' data-content-id='${this.renderStyle === 'focused' ? '' : 'operations-top'}' part='section-navbar-item section-navbar-operations-top'>
|
10281 | <div style='font-size:16px; display:flex; margin-left:10px;'>
|
10282 | ${this.renderStyle === 'focused' ? ke`
|
10283 | <div class='nav-bar-expand-all'
|
10284 | data-action='expand-all'
|
10285 | tabindex='0'
|
10286 | title='Expand all'
|
10287 | >▸</div>
|
10288 | <div class='nav-bar-collapse-all'
|
10289 | data-action='collapse-all'
|
10290 | tabindex='0'
|
10291 | title='Collapse all'
|
10292 | >▸</div>` : ''}
|
10293 | </div>
|
10294 | <div class='nav-bar-section-title'> OPERATIONS </div>
|
10295 | </div>
|
10296 |
|
10297 | <!-- TAGS AND PATHS-->
|
10298 | ${this.resolvedSpec.tags.filter(tag => tag.paths.filter(path => getMatchedPaths(this.searchVal, path, tag.name)).length).map(tag => {
|
10299 | var _tag$paths;
|
10300 | return ke`
|
10301 | <div class='nav-bar-tag-and-paths ${this.renderStyle === 'read' ? 'expanded' : tag.expanded ? 'expanded' : 'collapsed'}' >
|
10302 | ${tag.name === 'General ⦂' ? ke`<hr style='border:none; border-top: 1px dotted var(--nav-text-color); opacity:0.3; margin:-1px 0 0 0;'/>` : ke`
|
10303 | <div
|
10304 | class='nav-bar-tag ${this.navActiveItemMarker}'
|
10305 | part='section-navbar-item section-navbar-tag'
|
10306 | id='link-${tag.elementId}'
|
10307 | data-action='${(this.renderStyle === 'read' ? 'navigate' : this.onNavTagClick === 'show-description') ? 'navigate' : 'expand-collapse-tag'}'
|
10308 | data-content-id='${(this.renderStyle === 'read' ? `${tag.elementId}` : this.onNavTagClick === 'show-description') ? `${tag.elementId}` : ''}'
|
10309 | data-first-path-id='${tag.firstPathId}'
|
10310 | tabindex='0'
|
10311 | >
|
10312 | <div style="pointer-events:none;">${tag.displayName || tag.name}</div>
|
10313 | <div class='nav-bar-tag-icon' tabindex='0' data-action='expand-collapse-tag'></div>
|
10314 | </div>
|
10315 | `}
|
10316 | ${this.infoDescriptionHeadingsInNavBar === 'true' ? ke`
|
10317 | ${this.renderStyle === 'focused' && this.onNavTagClick === 'expand-collapse' ? '' : ke`
|
10318 | <div class='tag-headers'>
|
10319 | ${tag.headers.map(header => ke`
|
10320 | <div
|
10321 | class='nav-bar-h${header.depth} ${this.navActiveItemMarker}'
|
10322 | part='section-navbar-item section-navbar-h${header.depth}'
|
10323 | id='link-${tag.elementId}--${new marked.Slugger().slug(header.text)}'
|
10324 | data-action='navigate'
|
10325 | data-content-id='${tag.elementId}--${new marked.Slugger().slug(header.text)}'
|
10326 | tabindex='0'
|
10327 | > ${header.text}</div>`)}
|
10328 | </div>`}` : ''}
|
10329 | <div class='nav-bar-paths-under-tag' style='max-height:${tag.expanded || this.renderStyle === 'read' ? (((_tag$paths = tag.paths) === null || _tag$paths === void 0 ? void 0 : _tag$paths.length) || 1) * 50 : 0}px;'>
|
10330 | <!-- Paths in each tag (endpoints) -->
|
10331 | ${tag.paths.filter(v => {
|
10332 | if (this.searchVal) {
|
10333 | return getMatchedPaths(this.searchVal, v, tag.name);
|
10334 | }
|
10335 | return true;
|
10336 | }).map(p => ke`
|
10337 | <div
|
10338 | class='nav-bar-path ${this.navActiveItemMarker} ${this.usePathInNavBar === 'true' ? 'small-font' : ''}'
|
10339 | part='section-navbar-item section-navbar-path'
|
10340 | data-action='navigate'
|
10341 | data-content-id='${p.elementId}'
|
10342 | id='link-${p.elementId}'
|
10343 | tabindex='0'
|
10344 | >
|
10345 | <span style = 'display:flex; pointer-events: none; align-items:start; ${p.deprecated ? 'filter:opacity(0.5)' : ''}'>
|
10346 | ${ke`<span class='nav-method ${this.showMethodInNavBar} ${p.method}' style='pointer-events: none;'>
|
10347 | ${this.showMethodInNavBar === 'as-colored-block' ? p.method.substring(0, 3).toUpperCase() : p.method.toUpperCase()}
|
10348 | </span>`}
|
10349 | ${p.isWebhook ? ke`<span style='font-weight:bold; pointer-events: none; margin-right:8px; font-size: calc(var(--font-size-small) - 2px)'>WEBHOOK</span>` : ''}
|
10350 | ${this.usePathInNavBar === 'true' ? ke`<span style='pointer-events: none;' class='mono-font'>${p.path}</span>` : p.summary || p.shortSummary}
|
10351 | </span>
|
10352 | </div>`)}
|
10353 | </div>
|
10354 | </div>
|
10355 | `;
|
10356 | })}
|
10357 |
|
10358 | <!-- COMPONENTS -->
|
10359 | ${this.resolvedSpec.components && this.showComponents === 'true' && this.renderStyle === 'focused' ? ke`
|
10360 | <div id='link-components' class='nav-bar-section components'>
|
10361 | <div></div>
|
10362 | <div class='nav-bar-section-title'>COMPONENTS</div>
|
10363 | </div>
|
10364 | ${this.resolvedSpec.components.map(component => component.subComponents.length ? ke`
|
10365 | <div class='nav-bar-tag'
|
10366 | part='section-navbar-item section-navbar-tag'
|
10367 | data-action='navigate'
|
10368 | data-content-id='cmp--${component.name.toLowerCase()}'
|
10369 | id='link-cmp--${component.name.toLowerCase()}'
|
10370 | >
|
10371 | ${component.name}
|
10372 | </div>
|
10373 | ${component.subComponents.filter(p => p.expanded !== false).map(p => ke`
|
10374 | <div class='nav-bar-path' data-action='navigate' data-content-id='cmp--${p.id}' id='link-cmp--${p.id}'>
|
10375 | <span style = 'pointer-events: none;'> ${p.name} </span>
|
10376 | </div>`)}` : '')}` : ''}
|
10377 | </nav>`}
|
10378 | </nav>
|
10379 | `;
|
10380 | }
|
10381 | /* eslint-enable indent */
|
10382 | ;// ./src/templates/focused-endpoint-template.js
|
10383 |
|
10384 | // eslint-disable-line import/extensions
|
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 |
|
10390 |
|
10391 |
|
10392 |
|
10393 |
|
10394 | function focused_endpoint_template_headingRenderer(tagElementId) {
|
10395 | const renderer = new marked.Renderer();
|
10396 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="${tagElementId}--${slugger.slug(raw)}">${text}</h${level}>`;
|
10397 | return renderer;
|
10398 | }
|
10399 | function wrapFocusedTemplate(templateToWrap) {
|
10400 | return ke`
|
10401 | <div class='regular-font section-gap--focused-mode' part="section-operations-in-tag">
|
10402 | ${templateToWrap}
|
10403 | </div>`;
|
10404 | }
|
10405 | function defaultContentTemplate() {
|
10406 | var _this$resolvedSpec$ta;
|
10407 |
|
10408 | if (this.showInfo === 'true') {
|
10409 | return wrapFocusedTemplate(overviewTemplate.call(this));
|
10410 | }
|
10411 | const selectedTagObj = this.resolvedSpec.tags[0];
|
10412 | const selectedPathObj = (_this$resolvedSpec$ta = this.resolvedSpec.tags[0]) === null || _this$resolvedSpec$ta === void 0 ? void 0 : _this$resolvedSpec$ta.paths[0];
|
10413 | return selectedTagObj && selectedPathObj ? wrapFocusedTemplate(expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name)) : wrapFocusedTemplate('');
|
10414 | }
|
10415 |
|
10416 |
|
10417 | function focusedTagBodyTemplate(tag) {
|
10418 | return ke`
|
10419 | <h1 id="${tag.elementId}">${tag.displayName || tag.name}</h1>
|
10420 | ${this.onNavTagClick === 'show-description' && tag.description ? ke`
|
10421 | <div class="m-markdown">
|
10422 | ${unsafe_html_ae(`
|
10423 | <div class="m-markdown regular-font">
|
10424 | ${marked(tag.description || '', this.infoDescriptionHeadingsInNavBar === 'true' ? {
|
10425 | renderer: focused_endpoint_template_headingRenderer(tag.elementId)
|
10426 | } : undefined)}
|
10427 | </div>`)}
|
10428 | </div>` : ''}
|
10429 | `;
|
10430 | }
|
10431 | function focusedEndpointTemplate() {
|
10432 | if (!this.focusedElementId || !this.resolvedSpec) {
|
10433 | return;
|
10434 | }
|
10435 | const focusElId = this.focusedElementId;
|
10436 | let selectedPathObj = null;
|
10437 | let selectedTagObj = null;
|
10438 | let focusedTemplate;
|
10439 | let i = 0;
|
10440 | if (focusElId.startsWith('overview') && this.showInfo === 'true') {
|
10441 | focusedTemplate = overviewTemplate.call(this);
|
10442 | } else if (focusElId === 'auth' && this.allowAuthentication === 'true') {
|
10443 | focusedTemplate = securitySchemeTemplate.call(this);
|
10444 | } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {
|
10445 | focusedTemplate = serverTemplate.call(this);
|
10446 | } else if (focusElId === 'operations-top') {
|
10447 | focusedTemplate = ke`
|
10448 | <div id="operations-top" class="observe-me">
|
10449 | <slot name="operations-top"></slot>
|
10450 | </div>`;
|
10451 | } else if (focusElId.startsWith('cmp--') && this.showComponents === 'true') {
|
10452 | focusedTemplate = componentsTemplate.call(this);
|
10453 | } else if (focusElId.startsWith('tag--')) {
|
10454 | const idToFocus = focusElId.indexOf('--', 4) > 0 ? focusElId.substring(0, focusElId.indexOf('--', 5)) : focusElId;
|
10455 | selectedTagObj = this.resolvedSpec.tags.find(v => v.elementId === idToFocus);
|
10456 | if (selectedTagObj) {
|
10457 | focusedTemplate = wrapFocusedTemplate.call(this, focusedTagBodyTemplate.call(this, selectedTagObj));
|
10458 | } else {
|
10459 | focusedTemplate = defaultContentTemplate.call(this);
|
10460 | }
|
10461 | } else {
|
10462 | for (i = 0; i < this.resolvedSpec.tags.length; i += 1) {
|
10463 | selectedTagObj = this.resolvedSpec.tags[i];
|
10464 | selectedPathObj = this.resolvedSpec.tags[i].paths.find(v => `${v.elementId}` === focusElId);
|
10465 | if (selectedPathObj) {
|
10466 | break;
|
10467 | }
|
10468 | }
|
10469 | if (selectedPathObj) {
|
10470 |
|
10471 | const newNavEl = this.shadowRoot.getElementById(`link-${focusElId}`);
|
10472 | expandCollapseNavBarTag(newNavEl, 'expand');
|
10473 | focusedTemplate = wrapFocusedTemplate.call(this, expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name || '', selectedTagObj.description || ''));
|
10474 | } else {
|
10475 |
|
10476 | focusedTemplate = defaultContentTemplate.call(this);
|
10477 | }
|
10478 | }
|
10479 | return focusedTemplate;
|
10480 | }
|
10481 |
|
10482 | ;
|
10483 |
|
10484 |
|
10485 |
|
10486 |
|
10487 |
|
10488 |
|
10489 |
|
10490 |
|
10491 |
|
10492 | function toggleExpand(path) {
|
10493 | if (path.expanded) {
|
10494 | path.expanded = false;
|
10495 | if (this.updateRoute === 'true') {
|
10496 | this.replaceHistoryState('');
|
10497 | }
|
10498 | } else {
|
10499 | path.expanded = true;
|
10500 | if (this.updateRoute === 'true') {
|
10501 | const newHash = `${this.routePrefix || '#'}${path.elementId}`;
|
10502 | if (window.location.hash !== newHash) {
|
10503 | this.replaceHistoryState(path.elementId);
|
10504 | }
|
10505 | }
|
10506 | }
|
10507 | this.requestUpdate();
|
10508 | }
|
10509 | function endpoint_template_expandCollapseAll(operationsRootEl, action = 'expand-all') {
|
10510 | const elList = [...operationsRootEl.querySelectorAll('.section-tag')];
|
10511 | if (action === 'expand-all') {
|
10512 | elList.map(el => {
|
10513 | el.classList.replace('collapsed', 'expanded');
|
10514 | });
|
10515 | } else {
|
10516 | elList.map(el => {
|
10517 | el.classList.replace('expanded', 'collapsed');
|
10518 | });
|
10519 | }
|
10520 | }
|
10521 | function onExpandCollapseAll(e, action = 'expand-all') {
|
10522 | endpoint_template_expandCollapseAll.call(this, e.target.closest('.operations-root'), action);
|
10523 | }
|
10524 |
|
10525 |
|
10526 | function endpointHeadTemplate(path, pathsExpanded = false) {
|
10527 | return ke`
|
10528 | <summary @click="${e => {
|
10529 | toggleExpand.call(this, path, e);
|
10530 | }}" part="section-endpoint-head-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
10531 | <div part="section-endpoint-head-method" class="method ${path.method} ${path.deprecated ? 'deprecated' : ''}"> ${path.method} </div>
|
10532 | <div part="section-endpoint-head-path" class="path ${path.deprecated ? 'deprecated' : ''}">
|
10533 | ${path.path}
|
10534 | ${path.isWebhook ? ke`<span style="font-family: var(--font-regular); font-size: var(--); font-size: var(--font-size-small); color:var(--primary-color); margin-left: 16px"> Webhook</span>` : ''}
|
10535 | </div>
|
10536 | ${path.deprecated ? ke`
|
10537 | <span style="font-size:var(--font-size-small); text-transform:uppercase; font-weight:bold; color:var(--red); margin:2px 0 0 5px;">
|
10538 | deprecated
|
10539 | </span>` : ''}
|
10540 | ${this.showSummaryWhenCollapsed ? ke`
|
10541 | <div class="only-large-screen" style="min-width:60px; flex:1"></div>
|
10542 | <div part="section-endpoint-head-description" class="descr">${path.summary || path.shortSummary} </div>` : ''}
|
10543 | </summary>
|
10544 | `;
|
10545 | }
|
10546 | function endpointBodyTemplate(path) {
|
10547 | var _path$xBadges, _path$externalDocs, _path$externalDocs2, _path$externalDocs3, _path$externalDocs4, _path$externalDocs5, _path$externalDocs6, _this$selectedServer;
|
10548 | const acceptContentTypes = new Set();
|
10549 | for (const respStatus in path.responses) {
|
10550 | for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
10551 | var _path$responses$respS;
|
10552 | acceptContentTypes.add(acceptContentType.trim());
|
10553 | }
|
10554 | }
|
10555 | const accept = [...acceptContentTypes].join(', ');
|
10556 |
|
10557 | const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => {
|
10558 | var _path$security;
|
10559 | return v.finalKeyValue && ((_path$security = path.security) === null || _path$security === void 0 ? void 0 : _path$security.some(ps => v.securitySchemeId in ps));
|
10560 | }) || [];
|
10561 |
|
10562 |
|
10563 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey && v.value !== '-');
|
10564 | if (rapiDocApiKey) {
|
10565 | nonEmptyApiKeys.push(rapiDocApiKey);
|
10566 | }
|
10567 | const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';
|
10568 | return ke`
|
10569 | <div part="section-endpoint-body-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-body ${path.method} ${path.deprecated ? 'deprecated' : ''}'>
|
10570 | <div class="summary">
|
10571 | ${path.summary ? ke`<div class="title" part="section-endpoint-body-title">${path.summary}</div>` : path.shortSummary !== path.description ? ke`<div class="title" part="section-endpoint-body-title">${path.shortSummary}</div>` : ''}
|
10572 | ${path.xBadges && ((_path$xBadges = path.xBadges) === null || _path$xBadges === void 0 ? void 0 : _path$xBadges.length) > 0 ? ke`
|
10573 | <div style="display:flex; flex-wrap:wrap;font-size: var(--font-size-small);">
|
10574 | ${path.xBadges.map(v => v.color === 'none' ? '' : ke`<span part="endpoint-badge" style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`)}
|
10575 | </div>
|
10576 | ` : ''}
|
10577 |
|
10578 | ${path.description ? ke`<div part="section-endpoint-body-description" class="m-markdown"> ${unsafe_html_ae(marked(path.description))}</div>` : ''}
|
10579 | ${(_path$externalDocs = path.externalDocs) !== null && _path$externalDocs !== void 0 && _path$externalDocs.url || (_path$externalDocs2 = path.externalDocs) !== null && _path$externalDocs2 !== void 0 && _path$externalDocs2.description ? ke`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
|
10580 | <div class="m-markdown"> ${unsafe_html_ae(marked(((_path$externalDocs3 = path.externalDocs) === null || _path$externalDocs3 === void 0 ? void 0 : _path$externalDocs3.description) || ''))} </div>
|
10581 | ${(_path$externalDocs4 = path.externalDocs) !== null && _path$externalDocs4 !== void 0 && _path$externalDocs4.url ? ke`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${(_path$externalDocs5 = path.externalDocs) === null || _path$externalDocs5 === void 0 ? void 0 : _path$externalDocs5.url}" target="_blank">
|
10582 | ${(_path$externalDocs6 = path.externalDocs) === null || _path$externalDocs6 === void 0 ? void 0 : _path$externalDocs6.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
|
10583 | </a>` : ''}
|
10584 | </div>` : ''}
|
10585 | <slot name="${path.elementId}"></slot>
|
10586 | ${pathSecurityTemplate.call(this, path.security)}
|
10587 | ${codeSampleTabPanel}
|
10588 | </div>
|
10589 | <div class='req-resp-container'>
|
10590 | <div style="display:flex; flex-direction:column" class="view-mode-request ${this.layout}-layout">
|
10591 | <api-request
|
10592 | class = "${this.renderStyle}-mode ${this.layout}-layout"
|
10593 | style = "width:100%;"
|
10594 | webhook = "${path.isWebhook}"
|
10595 | method = "${path.method}"
|
10596 | path = "${path.path}"
|
10597 | .security = "${path.security}"
|
10598 | .parameters = "${path.parameters}"
|
10599 | .request_body = "${path.requestBody}"
|
10600 | .api_keys = "${nonEmptyApiKeys}"
|
10601 | .servers = "${path.servers}"
|
10602 | server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : (_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl}"
|
10603 | active-schema-tab = "${this.defaultSchemaTab}"
|
10604 | fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
10605 | allow-try = "${this.allowTry}"
|
10606 | show-curl-before-try = "${this.showCurlBeforeTry}"
|
10607 | accept = "${accept}"
|
10608 | render-style="${this.renderStyle}"
|
10609 | schema-style = "${this.schemaStyle}"
|
10610 | schema-expand-level = "${this.schemaExpandLevel}"
|
10611 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
10612 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
10613 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
10614 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
10615 | fetch-credentials = "${this.fetchCredentials}"
|
10616 | exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
10617 | tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
|
10618 | file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
10619 | anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
10620 | > </api-request>
|
10621 |
|
10622 | ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
10623 | </div>
|
10624 |
|
10625 | <api-response
|
10626 | class = "${this.renderStyle}-mode"
|
10627 | style = "width:100%;"
|
10628 | webhook = "${path.isWebhook}"
|
10629 | .responses="${path.responses}"
|
10630 | active-schema-tab = "${this.defaultSchemaTab}"
|
10631 | render-style="${this.renderStyle}"
|
10632 | schema-style="${this.schemaStyle}"
|
10633 | schema-expand-level = "${this.schemaExpandLevel}"
|
10634 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
10635 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
10636 | schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
10637 | schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
10638 | selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
10639 | exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
|
10640 | textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
|
10641 | tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
|
10642 | schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
10643 | > </api-response>
|
10644 | </div>
|
10645 | </div>`;
|
10646 | }
|
10647 | function endpointTemplate(isMini = false, pathsExpanded = false) {
|
10648 | if (!this.resolvedSpec) {
|
10649 | return '';
|
10650 | }
|
10651 | return ke`
|
10652 | ${isMini ? '' : ke`
|
10653 | <div style="display:flex; justify-content:flex-end;">
|
10654 | <span @click="${e => onExpandCollapseAll(e, 'expand-all')}" style="color:var(--primary-color); cursor:pointer;">
|
10655 | Expand all
|
10656 | </span>
|
10657 | |
|
10658 | <span @click="${e => onExpandCollapseAll(e, 'collapse-all')}" style="color:var(--primary-color); cursor:pointer;" >
|
10659 | Collapse all
|
10660 | </span>
|
10661 | sections
|
10662 | </div>`}
|
10663 | ${this.resolvedSpec.tags.map(tag => ke`
|
10664 | ${isMini ? ke`
|
10665 | <div class='section-tag-body'>
|
10666 | ${tag.paths.filter(path => {
|
10667 | if (this.searchVal) {
|
10668 | return getMatchedPaths(this.searchVal, path, tag.name);
|
10669 | }
|
10670 | return true;
|
10671 | }).map(path => ke`
|
10672 | <section id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
10673 | ${endpointHeadTemplate.call(this, path, pathsExpanded)}
|
10674 | ${pathsExpanded || path.expanded ? endpointBodyTemplate.call(this, path) : ''}
|
10675 | </section>`)}
|
10676 | </div>
|
10677 | ` : ke`
|
10678 | <div class='regular-font section-gap section-tag ${tag.expanded ? 'expanded' : 'collapsed'}'>
|
10679 | <div class='section-tag-header' @click="${() => {
|
10680 | tag.expanded = !tag.expanded;
|
10681 | this.requestUpdate();
|
10682 | }}">
|
10683 | <div id='${tag.elementId}' class="sub-title tag" style="color:var(--primary-color)">${tag.displayName || tag.name}</div>
|
10684 | </div>
|
10685 | <div class='section-tag-body'>
|
10686 | <slot name="${tag.elementId}"></slot>
|
10687 | <div class="regular-font regular-font-size m-markdown" style="padding-bottom:12px">
|
10688 | ${unsafe_html_ae(marked(tag.description || ''))}
|
10689 | </div>
|
10690 | ${tag.paths.filter(v => {
|
10691 | if (this.searchVal) {
|
10692 | return getMatchedPaths(this.searchVal, v, tag.name);
|
10693 | }
|
10694 | return true;
|
10695 | }).map(path => ke`
|
10696 | <section part="section-endpoint" id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
|
10697 | ${endpointHeadTemplate.call(this, path, pathsExpanded)}
|
10698 | ${pathsExpanded || path.expanded ? endpointBodyTemplate.call(this, path) : ''}
|
10699 | </section>`)}
|
10700 | </div>
|
10701 | </div>
|
10702 | `}
|
10703 | `)}`;
|
10704 | }
|
10705 | /* eslint-enable indent */
|
10706 | ;// ./src/templates/logo-template.js
|
10707 |
|
10708 |
|
10709 | /* eslint-disable indent */
|
10710 | function logoTemplate(style) {
|
10711 | return ke`
|
10712 | <div style=${style}>
|
10713 | <svg viewBox="1 0 511 512">
|
10714 | <path d="M351 411a202 202 0 01-350 0 203 203 0 01333-24 203 203 0 0117 24zm0 0" fill="#adc165"/>
|
10715 | <path d="M334 387a202 202 0 01-216-69 202 202 0 01216 69zm78 32H85a8 8 0 01-8-8 8 8 0 018-8h327a8 8 0 017 8 8 8 0 01-7 8zm0 0" fill="#99aa52"/>
|
10716 | <path d="M374 338l-5 30a202 202 0 01-248-248 203 203 0 01253 218zm0 0" fill="#ffc73b"/>
|
10717 | <path d="M374 338a202 202 0 01-100-197 203 203 0 01100 197zm38 81l-6-2-231-231a8 8 0 0111-11l231 230a8 8 0 01-5 14zm0 0" fill="#efb025"/>
|
10718 | <path d="M311 175c0 75 40 140 101 175a202 202 0 000-350 202 202 0 00-101 175zm0 0" fill="#ff903e"/>
|
10719 | <path d="M412 419a8 8 0 01-8-8V85a8 8 0 0115 0v326a8 8 0 01-7 8zm0 0" fill="#e87425"/>
|
10720 | </svg>
|
10721 | </div>
|
10722 | `;
|
10723 | }
|
10724 | /* eslint-enable indent */
|
10725 | ;// ./src/templates/header-template.js
|
10726 |
|
10727 |
|
10728 |
|
10729 | /* eslint-disable indent */
|
10730 | function headerTemplate() {
|
10731 | return ke`
|
10732 | <header class="row main-header regular-font" part="section-header" style="padding:8px 4px 8px 4px;min-height:48px;">
|
10733 | <div class="only-large-screen-flex" style="align-items: center;">
|
10734 | <slot name="logo" class="logo" part="section-logo">
|
10735 | ${logoTemplate('height:36px;width:36px;margin-left:5px')}
|
10736 | <!-- m-logo style="height:36px;width:36px;margin-left:5px"></m-logo -->
|
10737 | </slot>
|
10738 | <div class="header-title" part="label-header-title">${this.headingText}</div>
|
10739 | </div>
|
10740 | <div style="margin: 0px 8px;display:flex;flex:1">
|
10741 | ${this.allowSpecUrlLoad === 'false' ? '' : ke`
|
10742 | <input id="spec-url"
|
10743 | type="text"
|
10744 | style="font-size:var(--font-size-small)"
|
10745 | class="header-input mono-font"
|
10746 | part="textbox textbox-spec-url"
|
10747 | placeholder="Spec URL"
|
10748 | value="${this.specUrl || ''}"
|
10749 | @change="${this.onSpecUrlChange}"
|
10750 | spellcheck="false"
|
10751 | >
|
10752 | <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
10753 | `}
|
10754 | ${this.allowSpecFileLoad === 'false' ? '' : ke`
|
10755 | <input id="spec-file"
|
10756 | part = "file-input"
|
10757 | type="file"
|
10758 | style="display:none"
|
10759 | value="${this.specFile || ''}"
|
10760 | @change="${this.onSpecFileChange}"
|
10761 | spellcheck="false"
|
10762 | >
|
10763 | <button class="m-btn primary only-large-screen" style="margin-left:10px;" part="btn btn-fill" @click="${this.onFileLoadClick}"> LOCAL JSON FILE </button>
|
10764 | `}
|
10765 | <slot name="header"></slot>
|
10766 | ${this.allowSearch === 'false' || 'read focused'.includes(this.renderStyle) ? '' : ke`
|
10767 | <input id="search" class="header-input" type="text" part="textbox textbox-header-filter" placeholder="Filter" @change="${this.onSearchChange}" style="max-width:130px;margin-left:10px;" spellcheck="false" >
|
10768 | <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
10769 | `}
|
10770 |
|
10771 | ${this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle) ? '' : ke`
|
10772 | <button class="m-btn primary only-large-screen" part="btn btn-fill btn-search" style="margin-left:10px;" @click="${this.onShowSearchModalClicked}">
|
10773 | Search
|
10774 | </button>
|
10775 | `}
|
10776 | </div>
|
10777 | </header>`;
|
10778 | }
|
10779 |
|
10780 | ;
|
10781 |
|
10782 | const dialog_box_styles = (i`
|
10783 | *, *:before, *:after { box-sizing: border-box; }
|
10784 |
|
10785 | .dialog-box-overlay {
|
10786 | background-color: var(--overlay-bg);
|
10787 | position: fixed;
|
10788 | left: 0;
|
10789 | top: 0;
|
10790 | width: 100vw;
|
10791 | height: 100vh;
|
10792 | overflow: hidden;
|
10793 | z-index: var(--dialog-z-index);
|
10794 | }
|
10795 |
|
10796 | .dialog-box {
|
10797 | position: fixed;
|
10798 | top: 100px;
|
10799 | left: 50%;
|
10800 | transform: translate(-50%, 0%);
|
10801 | display: flex;
|
10802 | flex-direction: column;
|
10803 | width: 70vw;
|
10804 | background-color: var(--bg2);
|
10805 | color: var(--fg2);
|
10806 | border-radius: 4px;
|
10807 | max-height: 500px;
|
10808 | overflow: hidden;
|
10809 | border: 1px solid var(--border-color);
|
10810 | box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
|
10811 | }
|
10812 |
|
10813 | .dialog-box-header {
|
10814 | position: sticky;
|
10815 | top: 0;
|
10816 | align-self: stretch;
|
10817 | display: flex;
|
10818 | align-items: center;
|
10819 | padding: 0px 16px;
|
10820 | min-height: 60px;
|
10821 | max-height: 60px;
|
10822 | border-bottom: 1px solid var(--light-border-color);
|
10823 | overflow: hidden;
|
10824 | }
|
10825 |
|
10826 | .dialog-box-header button {
|
10827 | font-size: 1.5rem;
|
10828 | font-weight: 700;
|
10829 | line-height: 1;
|
10830 | color: var(--fg);
|
10831 | border: none;
|
10832 | outline: none;
|
10833 | background-color: transparent;
|
10834 | cursor:pointer;
|
10835 | border: 1px solid transparent;
|
10836 | border-radius: 50%;
|
10837 | margin-right: -8px;
|
10838 | }
|
10839 | .dialog-box-header button:hover {
|
10840 | border-color: var(--primary-color);
|
10841 | }
|
10842 |
|
10843 | .dialog-box-content {
|
10844 | padding: 16px;
|
10845 | display:block;
|
10846 | overflow: auto;
|
10847 | height: 100%;
|
10848 | }
|
10849 |
|
10850 | .dialog-box-title {
|
10851 | flex-grow: 1;
|
10852 | font-size:24px;
|
10853 | }
|
10854 | `);
|
10855 | ;
|
10856 |
|
10857 |
|
10858 | class DialogBox extends lit_element_h {
|
10859 | static get properties() {
|
10860 | return {
|
10861 | heading: {
|
10862 | type: String,
|
10863 | attribute: 'heading'
|
10864 | },
|
10865 | show: {
|
10866 | type: String,
|
10867 | attribute: 'show'
|
10868 | }
|
10869 | };
|
10870 | }
|
10871 | static get styles() {
|
10872 | return [dialog_box_styles];
|
10873 | }
|
10874 | connectedCallback() {
|
10875 | super.connectedCallback();
|
10876 | document.addEventListener('keydown', e => {
|
10877 | if (e.code === 'Escape') {
|
10878 | this.onClose();
|
10879 | }
|
10880 | });
|
10881 | }
|
10882 | attributeChangedCallback(name, oldVal, newVal) {
|
10883 | if (oldVal !== newVal) {
|
10884 | if (name === 'heading') {
|
10885 | this.heading = newVal;
|
10886 | }
|
10887 | if (name === 'show') {
|
10888 | this.show = newVal;
|
10889 | if (newVal === 'true') {
|
10890 | document.dispatchEvent(new CustomEvent('open', {
|
10891 | bubbles: true,
|
10892 | composed: true,
|
10893 | detail: this
|
10894 | }));
|
10895 | }
|
10896 | }
|
10897 | }
|
10898 | super.attributeChangedCallback(name, oldVal, newVal);
|
10899 | }
|
10900 |
|
10901 |
|
10902 | render() {
|
10903 | return ke`
|
10904 | ${this.show === 'true' ? ke`
|
10905 | <div class="dialog-box-overlay">
|
10906 | <div class="dialog-box">
|
10907 | <header class="dialog-box-header">
|
10908 | <span class="dialog-box-title">${this.heading}</span>
|
10909 | <button type="button" @click="${this.onClose}">×</button>
|
10910 | </header>
|
10911 | <div class="dialog-box-content">
|
10912 | <slot></slot>
|
10913 | </div>
|
10914 | </div>
|
10915 | </div>` : ''}`;
|
10916 | }
|
10917 |
|
10918 |
|
10919 | onClose() {
|
10920 | document.dispatchEvent(new CustomEvent('close', {
|
10921 | bubbles: true,
|
10922 | composed: true
|
10923 | }));
|
10924 | }
|
10925 | }
|
10926 | customElements.define('dialog-box', DialogBox);
|
10927 | ;
|
10928 |
|
10929 |
|
10930 |
|
10931 |
|
10932 | function searchByPropertiesModalTemplate() {
|
10933 | var _this$advancedSearchM;
|
10934 | document.addEventListener('close', () => {
|
10935 | this.showAdvancedSearchDialog = false;
|
10936 | });
|
10937 | document.addEventListener('open', this.onOpenSearchDialog);
|
10938 | return ke`
|
10939 | <dialog-box
|
10940 | heading="Search"
|
10941 | show="${!!this.showAdvancedSearchDialog}"
|
10942 | >
|
10943 | <span class="advanced-search-options">
|
10944 | <input
|
10945 | id="input-advanced-search-dialog"
|
10946 | style="width:100%; padding-right:20px;"
|
10947 | type="text"
|
10948 | part="textbox textbox-search-dialog"
|
10949 | placeholder="search text..."
|
10950 | spellcheck="false"
|
10951 | @keyup = "${e => this.onAdvancedSearch(e, 400)}"
|
10952 | >
|
10953 | <div style="display:flex; margin:8px 0 24px;">
|
10954 | <div>
|
10955 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-path" checked @change = "${e => this.onAdvancedSearch(e, 0)}">
|
10956 | <label for="search-api-path" style="cursor:pointer;"> API Path </label>
|
10957 | </div>
|
10958 | <div style="margin-left: 16px;">
|
10959 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-descr" checked @change = "${e => this.onAdvancedSearch(e, 0)}">
|
10960 | <label style="cursor:pointer;" for="search-api-descr"> API Description </label>
|
10961 | </div>
|
10962 | <div style="margin-left: 16px;">
|
10963 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-params" @change = "${e => this.onAdvancedSearch(e, 0)}">
|
10964 | <label style="cursor:pointer;" for="search-api-params"> API Parameters </label>
|
10965 | </div>
|
10966 | <div style="margin-left: 16px;">
|
10967 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-request-body" @change = "${e => this.onAdvancedSearch(e, 0)}">
|
10968 | <label style="cursor:pointer;" for="search-api-request-body"> Request Body Parameters </label>
|
10969 | </div>
|
10970 | <div style="margin-left: 16px;">
|
10971 | <input style="cursor:pointer;" type="checkbox" part="checkbox checkbox-search-dialog" id="search-api-resp-descr" @change = "${e => this.onAdvancedSearch(e, 0)}">
|
10972 | <label style="cursor:pointer;" for="search-api-resp-descr"> Response Description </label>
|
10973 | </div>
|
10974 | </div>
|
10975 | </span>
|
10976 |
|
10977 | ${(_this$advancedSearchM = this.advancedSearchMatches) === null || _this$advancedSearchM === void 0 ? void 0 : _this$advancedSearchM.map(path => ke`
|
10978 | <div
|
10979 | class="mono-font small-font-size hover-bg"
|
10980 | style='padding: 5px; cursor: pointer; border-bottom: 1px solid var(--light-border-color); ${path.deprecated ? 'filter:opacity(0.5);' : ''}'
|
10981 | data-content-id='${path.elementId}'
|
10982 | tabindex = '0'
|
10983 | @click="${e => {
|
10984 | this.searchVal = ''; // clear quick filter if applied
|
10985 | this.showAdvancedSearchDialog = false; // Hide Search Dialog
|
10986 | this.requestUpdate();
|
10987 | this.scrollToEventTarget(e, true);
|
10988 | }}"
|
10989 | >
|
10990 | <span style="pointer-events: none" class="upper bold-text method-fg ${path.method}">${path.method}</span>
|
10991 | <span style="pointer-events: none">${path.path}</span>
|
10992 | <span style="pointer-events: none" class="regular-font gray-text">${path.summary}</span>
|
10993 | </div>
|
10994 | `)}
|
10995 | </dialog-box>
|
10996 | `;
|
10997 | }
|
10998 |
|
10999 | ;
|
11000 | const color_utils = ({
|
11001 | color: {
|
11002 | inputReverseFg: '#fff',
|
11003 | inputReverseBg: '#333',
|
11004 | headerBg: '#444',
|
11005 | getRgb(hex) {
|
11006 | if (hex.indexOf('#') === 0) {
|
11007 | hex = hex.slice(1, 7);
|
11008 | }
|
11009 |
|
11010 | if (hex.length === 3 || hex.length === 4) {
|
11011 | hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
11012 | }
|
11013 | if (hex.length !== 6) {
|
11014 | throw new Error('Invalid HEX color.');
|
11015 | }
|
11016 | return {
|
11017 | r: parseInt(hex.slice(0, 2), 16),
|
11018 | g: parseInt(hex.slice(2, 4), 16),
|
11019 | b: parseInt(hex.slice(4, 6), 16)
|
11020 | };
|
11021 | },
|
11022 | luminanace(hexColorCode) {
|
11023 | const rgb = this.getRgb(hexColorCode);
|
11024 | return rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114;
|
11025 | },
|
11026 | invert(hexColorCode) {
|
11027 | return this.luminanace(hexColorCode) > 135 ? '#000' : '#fff';
|
11028 | },
|
11029 | opacity(hex, opacity) {
|
11030 | const rgb = this.getRgb(hex);
|
11031 | return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
11032 | },
|
11033 | brightness(hex, amt) {
|
11034 | const rgb = this.getRgb(hex);
|
11035 | rgb.r += amt;
|
11036 | rgb.g += amt;
|
11037 | rgb.b += amt;
|
11038 | if (rgb.r > 255) rgb.r = 255;else if (rgb.r < 0) rgb.r = 0;
|
11039 | if (rgb.g > 255) rgb.g = 255;else if (rgb.g < 0) rgb.g = 0;
|
11040 | if (rgb.b > 255) rgb.b = 255;else if (rgb.b < 0) rgb.b = 0;
|
11041 | return `#${rgb.r.toString(16).padStart(2, '0')}${rgb.g.toString(16).padStart(2, '0')}${rgb.b.toString(16).padStart(2, '0')}`;
|
11042 | },
|
11043 | hasGoodContrast(hexColorCode1, hexColorCode2) {
|
11044 | const lum1 = this.luminanace(hexColorCode1);
|
11045 | const lum2 = this.luminanace(hexColorCode2);
|
11046 | return lum1 - lum2;
|
11047 | }
|
11048 | }
|
11049 | });
|
11050 | function isValidHexColor(colorCode) {
|
11051 | return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/i.test(colorCode);
|
11052 | }
|
11053 | ;
|
11054 |
|
11055 |
|
11056 |
|
11057 | function setTheme(baseTheme, theme = {}) {
|
11058 | let newTheme = {};
|
11059 |
|
11060 |
|
11061 | const primaryColor = theme.primaryColor ? theme.primaryColor : baseTheme === 'dark' ? '#f76b39' : '#ff591e';
|
11062 | const primaryColorInvert = color_utils.color.invert(primaryColor);
|
11063 | const primaryColorTrans = color_utils.color.opacity(primaryColor, '0.4');
|
11064 |
|
11065 |
|
11066 | if (baseTheme === 'dark') {
|
11067 | const bg1 = theme.bg1 ? theme.bg1 : '#2a2b2c';
|
11068 | const fg1 = theme.fg1 ? theme.fg1 : '#bbb';
|
11069 | const bg2 = theme.bg2 ? theme.bg2 : color_utils.color.brightness(bg1, 5);
|
11070 | const bg3 = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, 17);
|
11071 | const lightBg = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, 35);
|
11072 | const fg2 = theme.fg2 ? theme.fg2 : color_utils.color.brightness(fg1, -15);
|
11073 | const fg3 = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, -20);
|
11074 | const lightFg = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, -65);
|
11075 | const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : '#aaa';
|
11076 | const selectionBg = fg2;
|
11077 | const selectionFg = bg2;
|
11078 | const headerColor = theme.headerColor ? theme.headerColor : color_utils.color.brightness(bg1, 10);
|
11079 | const navBgColor = theme.navBgColor ? theme.navBgColor : color_utils.color.brightness(bg1, 10);
|
11080 | const navTextColor = theme.navTextColor ? theme.navTextColor : color_utils.color.opacity(color_utils.color.invert(navBgColor), '0.50');
|
11081 | const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : color_utils.color.brightness(navBgColor, -15);
|
11082 | const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : color_utils.color.invert(navBgColor);
|
11083 | const navAccentColor = theme.navAccentColor ? theme.navAccentColor : color_utils.color.brightness(primaryColor, 25);
|
11084 | const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : color_utils.color.invert(navAccentColor);
|
11085 | const overlayBg = 'rgba(80, 80, 80, 0.4)';
|
11086 | newTheme = {
|
11087 | bg1,
|
11088 | bg2,
|
11089 | bg3,
|
11090 | lightBg,
|
11091 | fg1,
|
11092 | fg2,
|
11093 | fg3,
|
11094 | lightFg,
|
11095 | inlineCodeFg,
|
11096 | primaryColor,
|
11097 | primaryColorTrans,
|
11098 | primaryColorInvert,
|
11099 | selectionBg,
|
11100 | selectionFg,
|
11101 | overlayBg,
|
11102 | navBgColor,
|
11103 | navTextColor,
|
11104 | navHoverBgColor,
|
11105 | navHoverTextColor,
|
11106 | navAccentColor,
|
11107 | navAccentTextColor,
|
11108 | headerColor,
|
11109 | headerColorInvert: color_utils.color.invert(headerColor),
|
11110 | headerColorDarker: color_utils.color.brightness(headerColor, -20),
|
11111 | headerColorBorder: color_utils.color.brightness(headerColor, 10),
|
11112 | borderColor: theme.borderColor || color_utils.color.brightness(bg1, 20),
|
11113 |
|
11114 | lightBorderColor: theme.lightBorderColor || color_utils.color.brightness(bg1, 15),
|
11115 |
|
11116 | codeBorderColor: theme.codeBorderColor || color_utils.color.brightness(bg1, 30),
|
11117 | inputBg: theme.inputBg || color_utils.color.brightness(bg1, -5),
|
11118 |
|
11119 | placeHolder: theme.placeHolder || color_utils.color.opacity(fg1, '0.3'),
|
11120 | hoverColor: theme.hoverColor || color_utils.color.brightness(bg1, -10),
|
11121 |
|
11122 |
|
11123 | red: theme.red ? theme.red : '#F06560',
|
11124 | lightRed: theme.lightRed ? theme.lightRed : color_utils.color.brightness(bg1, -10),
|
11125 |
|
11126 |
|
11127 | pink: theme.pink ? theme.pink : '#ffb2b2',
|
11128 | lightPink: theme.lightPink || color_utils.color.brightness(bg1, -10),
|
11129 | green: theme.green || '#7ec699',
|
11130 | lightGreen: theme.lightGreen || color_utils.color.brightness(bg1, -10),
|
11131 |
|
11132 |
|
11133 | blue: theme.blue || '#71b7ff',
|
11134 | lightBlue: theme.lightBlue || color_utils.color.brightness(bg1, -10),
|
11135 |
|
11136 |
|
11137 | orange: theme.orange ? theme.orange : '#f08d49',
|
11138 | lightOrange: theme.lightOrange || color_utils.color.brightness(bg1, -10),
|
11139 |
|
11140 |
|
11141 | yellow: theme.yellow || '#827717',
|
11142 | lightYellow: theme.lightYellow || color_utils.color.brightness(bg1, -10),
|
11143 |
|
11144 |
|
11145 | purple: theme.purple || '#786FF1',
|
11146 | brown: theme.brown || '#D4AC0D',
|
11147 | codeBg: theme.codeBg || color_utils.color.opacity(color_utils.color.brightness(bg1, -15), 0.7),
|
11148 | codeFg: theme.codeFg || '#aaa',
|
11149 | codePropertyColor: theme.codePropertyColor || '#f8c555',
|
11150 | codeKeywordColor: theme.codeKeywordColor || '#cc99cd',
|
11151 | codeOperatorColor: theme.codeOperatorColor || '#67cdcc'
|
11152 | };
|
11153 | } else {
|
11154 | const bg1 = theme.bg1 ? theme.bg1 : '#fafbfc';
|
11155 | const fg1 = theme.fg1 ? theme.fg1 : '#444444';
|
11156 | const bg2 = theme.bg2 ? theme.bg2 : color_utils.color.brightness(bg1, -5);
|
11157 | const bg3 = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, -15);
|
11158 | const lightBg = theme.bg3 ? theme.bg3 : color_utils.color.brightness(bg1, -45);
|
11159 | const fg2 = theme.fg2 ? theme.fg2 : color_utils.color.brightness(fg1, 17);
|
11160 | const fg3 = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, 30);
|
11161 | const lightFg = theme.fg3 ? theme.fg3 : color_utils.color.brightness(fg1, 70);
|
11162 | const inlineCodeFg = theme.inlineCodeFg ? theme.inlineCodeFg : 'brown';
|
11163 | const selectionBg = fg2;
|
11164 | const selectionFg = bg2;
|
11165 | const headerColor = theme.headerColor ? theme.headerColor : color_utils.color.brightness(bg1, -180);
|
11166 |
|
11167 | |
11168 |
|
11169 |
|
11170 |
|
11171 |
|
11172 |
|
11173 |
|
11174 | const navBgColor = theme.navBgColor ? theme.navBgColor : color_utils.color.brightness(bg1, -200);
|
11175 | const navTextColor = theme.navTextColor ? theme.navTextColor : color_utils.color.opacity(color_utils.color.invert(navBgColor), '0.65');
|
11176 | const navHoverBgColor = theme.navHoverBgColor ? theme.navHoverBgColor : color_utils.color.brightness(navBgColor, -15);
|
11177 | const navHoverTextColor = theme.navHoverTextColor ? theme.navHoverTextColor : color_utils.color.invert(navBgColor);
|
11178 | const navAccentColor = theme.navAccentColor ? theme.navAccentColor : color_utils.color.brightness(primaryColor, 25);
|
11179 | const navAccentTextColor = theme.navAccentTextColor ? theme.navAccenttextColor : color_utils.color.invert(navAccentColor);
|
11180 | const overlayBg = 'rgba(0, 0, 0, 0.4)';
|
11181 | newTheme = {
|
11182 | bg1,
|
11183 | bg2,
|
11184 | bg3,
|
11185 | lightBg,
|
11186 | fg1,
|
11187 | fg2,
|
11188 | fg3,
|
11189 | lightFg,
|
11190 | inlineCodeFg,
|
11191 | primaryColor,
|
11192 | primaryColorTrans,
|
11193 | primaryColorInvert,
|
11194 | selectionBg,
|
11195 | selectionFg,
|
11196 | overlayBg,
|
11197 | navBgColor,
|
11198 | navTextColor,
|
11199 | navHoverBgColor,
|
11200 | navHoverTextColor,
|
11201 | navAccentColor,
|
11202 | navAccentTextColor,
|
11203 | headerColor,
|
11204 | headerColorInvert: color_utils.color.invert(headerColor),
|
11205 | headerColorDarker: color_utils.color.brightness(headerColor, -20),
|
11206 | headerColorBorder: color_utils.color.brightness(headerColor, 10),
|
11207 | borderColor: theme.borderColor || color_utils.color.brightness(bg1, -38),
|
11208 | lightBorderColor: theme.lightBorderColor || color_utils.color.brightness(bg1, -23),
|
11209 | codeBorderColor: theme.codeBorderColor || 'transparent',
|
11210 | inputBg: theme.inputBg || color_utils.color.brightness(bg1, 10),
|
11211 |
|
11212 | placeHolder: theme.placeHolder || color_utils.color.brightness(lightFg, 20),
|
11213 |
|
11214 | hoverColor: theme.hoverColor || color_utils.color.brightness(bg1, -5),
|
11215 |
|
11216 |
|
11217 | red: theme.red || '#F06560',
|
11218 | lightRed: theme.lightRed || '#fff0f0',
|
11219 | pink: theme.pink ? theme.pink : '#990055',
|
11220 | lightPink: theme.lightPink ? theme.lightPink : '#ffb2b2',
|
11221 | green: theme.green || '#690',
|
11222 | lightGreen: theme.lightGreen || '#fbfff0',
|
11223 | blue: theme.blue || '#47AFE8',
|
11224 | lightBlue: theme.lightBlue || '#eff8fd',
|
11225 | orange: theme.orange || '#FF9900',
|
11226 | lightOrange: theme.lightOrange || '#fff5e6',
|
11227 | yellow: theme.yellow || '#827717',
|
11228 | lightYellow: theme.lightYellow || '#fff5cc',
|
11229 | purple: theme.purple || '#786FF1',
|
11230 | brown: theme.brown || '#D4AC0D',
|
11231 | codeBg: theme.codeBg || color_utils.color.opacity(color_utils.color.brightness(bg1, -15), 0.7),
|
11232 | codeFg: theme.codeFg || '#666',
|
11233 | codePropertyColor: theme.codePropertyColor || '#905',
|
11234 | codeKeywordColor: theme.codeKeywordColor || '#07a',
|
11235 | codeOperatorColor: theme.codeOperatorColor || '#9a6e3a'
|
11236 | };
|
11237 | }
|
11238 | return ke`
|
11239 | <style>
|
11240 | *, *:before, *:after { box-sizing: border-box; }
|
11241 |
|
11242 | :host {
|
11243 | /* Common Styles - irrespective of themes */
|
11244 | --border-radius: 2px;
|
11245 | --layout: ${this.layout || 'row'};
|
11246 | --font-mono: ${this.monoFont || 'Monaco, "Andale Mono", "Roboto Mono", Consolas, monospace'};
|
11247 | --font-regular: ${this.regularFont || '"Open Sans", Avenir, "Segoe UI", Arial, sans-serif'};
|
11248 | --scroll-bar-width: 8px;
|
11249 | --nav-item-padding: ${this.navItemSpacing === 'relaxed' ? '10px 16px 10px 10px' : this.navItemSpacing === 'compact' ? '5px 16px 5px 10px' : '7px 16px 7px 10px'};
|
11250 |
|
11251 | --resp-area-height: ${this.responseAreaHeight};
|
11252 | --font-size-small: ${this.fontSize === 'default' ? '12px' : this.fontSize === 'large' ? '13px' : '14px'};
|
11253 | --font-size-mono: ${this.fontSize === 'default' ? '13px' : this.fontSize === 'large' ? '14px' : '15px'};
|
11254 | --font-size-regular: ${this.fontSize === 'default' ? '14px' : this.fontSize === 'large' ? '15px' : '16px'};
|
11255 | --dialog-z-index: 1000;
|
11256 |
|
11257 | --focus-shadow: 0 0 0 1px transparent, 0 0 0 3px ${newTheme.primaryColorTrans};
|
11258 |
|
11259 | /* Theme specific styles */
|
11260 | --bg:${newTheme.bg1};
|
11261 | --bg2:${newTheme.bg2};
|
11262 | --bg3:${newTheme.bg3};
|
11263 | --light-bg:${newTheme.lightBg};
|
11264 | --fg:${newTheme.fg1};
|
11265 | --fg2:${newTheme.fg2};
|
11266 | --fg3:${newTheme.fg3};
|
11267 | --light-fg:${newTheme.lightFg};
|
11268 | --selection-bg:${newTheme.selectionBg};
|
11269 | --selection-fg:${newTheme.selectionFg};
|
11270 | --overlay-bg:${newTheme.overlayBg};
|
11271 |
|
11272 | /* Border Colors */
|
11273 | --border-color:${newTheme.borderColor};
|
11274 | --light-border-color:${newTheme.lightBorderColor};
|
11275 | --code-border-color:${newTheme.codeBorderColor};
|
11276 |
|
11277 | --input-bg:${newTheme.inputBg};
|
11278 | --placeholder-color:${newTheme.placeHolder};
|
11279 | --hover-color:${newTheme.hoverColor};
|
11280 | --red:${newTheme.red};
|
11281 | --light-red:${newTheme.lightRed};
|
11282 | --pink:${newTheme.pink};
|
11283 | --light-pink:${newTheme.lightPink};
|
11284 | --green:${newTheme.green};
|
11285 | --light-green:${newTheme.lightGreen};
|
11286 | --blue:${newTheme.blue};
|
11287 | --light-blue:${newTheme.lightBlue};
|
11288 | --orange:${newTheme.orange};
|
11289 | --light-orange:${newTheme.lightOrange};
|
11290 | --yellow:${newTheme.yellow};
|
11291 | --light-yellow:${newTheme.lightYellow};
|
11292 | --purple:${newTheme.purple};
|
11293 | --brown:${newTheme.brown};
|
11294 |
|
11295 | /* Header Color */
|
11296 | --header-bg:${newTheme.headerColor};
|
11297 | --header-fg:${newTheme.headerColorInvert};
|
11298 | --header-color-darker:${newTheme.headerColorDarker};
|
11299 | --header-color-border:${newTheme.headerColorBorder};
|
11300 |
|
11301 | /* Nav Colors */
|
11302 | --nav-bg-color:${newTheme.navBgColor};
|
11303 | --nav-text-color:${newTheme.navTextColor};
|
11304 | --nav-hover-bg-color:${newTheme.navHoverBgColor};
|
11305 | --nav-hover-text-color:${newTheme.navHoverTextColor};
|
11306 | --nav-accent-color:${newTheme.navAccentColor};
|
11307 | --nav-accent-text-color:${newTheme.navAccentTextColor};
|
11308 |
|
11309 | /* Nav API Method Colors*/
|
11310 | --nav-get-color:${newTheme.blue};
|
11311 | --nav-put-color:${newTheme.orange};
|
11312 | --nav-post-color:${newTheme.green};
|
11313 | --nav-delete-color:${newTheme.red};
|
11314 | --nav-head-color:${newTheme.yellow};
|
11315 |
|
11316 | /* Primary Colors */
|
11317 | --primary-color:${newTheme.primaryColor};
|
11318 | --primary-color-invert:${newTheme.primaryColorInvert};
|
11319 | --primary-color-trans:${newTheme.primaryColorTrans};
|
11320 |
|
11321 | /*Code Syntax Color*/
|
11322 | --code-bg:${newTheme.codeBg};
|
11323 | --code-fg:${newTheme.codeFg};
|
11324 | --inline-code-fg:${newTheme.inlineCodeFg};
|
11325 | --code-property-color:${newTheme.codePropertyColor};
|
11326 | --code-keyword-color:${newTheme.codeKeywordColor};
|
11327 | --code-operator-color:${newTheme.codeOperatorColor};
|
11328 | }
|
11329 | </style>`;
|
11330 | }
|
11331 | ;
|
11332 |
|
11333 |
|
11334 |
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 |
|
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 |
|
11346 | function mainBodyTemplate(isMini = false, pathsExpanded = false) {
|
11347 | if (!this.resolvedSpec) {
|
11348 | return '';
|
11349 | }
|
11350 | if (this.persistAuth === 'true') {
|
11351 | recoverPersistedApiKeys.call(this);
|
11352 | }
|
11353 | const newTheme = {
|
11354 | bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
|
11355 | fg1: isValidHexColor(this.textColor) ? this.textColor : '',
|
11356 | headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',
|
11357 | primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',
|
11358 | navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',
|
11359 | navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',
|
11360 | navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
11361 | navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
11362 | navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
11363 | navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : ''
|
11364 | };
|
11365 |
|
11366 | if (this.resolvedSpec.specLoadError) {
|
11367 | return ke`
|
11368 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
11369 | <div id="spec-not-found" style='display:flex; align-items:center; justify-content: center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)'>
|
11370 | ${this.resolvedSpec.info.description}
|
11371 | </div>
|
11372 | `;
|
11373 | }
|
11374 | if (this.resolvedSpec.isSpecLoading) {
|
11375 | return ke`
|
11376 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
11377 | <main class='main-content regular-font' part='section-main-content'>
|
11378 | <slot></slot>
|
11379 | <div class='main-content-inner--${this.renderStyle}-mode'>
|
11380 | <div class='loader'></div>
|
11381 | </div>
|
11382 | </main>
|
11383 | `;
|
11384 | }
|
11385 | return ke`
|
11386 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
11387 |
|
11388 | <!-- Header -->
|
11389 | ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
|
11390 |
|
11391 | <!-- Advanced Search -->
|
11392 | ${this.allowAdvancedSearch === 'false' ? '' : searchByPropertiesModalTemplate.call(this)}
|
11393 |
|
11394 | <div id='the-main-body' class='body ${this.cssClasses}' dir='${this.pageDirection}' >
|
11395 | <!-- Side Nav -->
|
11396 | ${(this.renderStyle === 'read' || this.renderStyle === 'focused') && this.showSideNav === 'true' && this.resolvedSpec ? navbarTemplate.call(this) : ''}
|
11397 |
|
11398 | <!-- Main Content -->
|
11399 | <main class='main-content regular-font' tabindex='-1' part='section-main-content'>
|
11400 | <slot></slot>
|
11401 | <div class='main-content-inner--${this.renderStyle}-mode'>
|
11402 | ${this.loading === true ? ke`<div class='loader'></div>` : ke`
|
11403 | ${this.loadFailed === true ? ke`<div style='text-align: center;margin: 16px;'> Unable to load the Spec</div>` : ke`
|
11404 | <div class='operations-root' @click='${e => {
|
11405 | this.handleHref(e);
|
11406 | }}'>
|
11407 | ${this.renderStyle === 'focused' ? ke`${focusedEndpointTemplate.call(this)}` : ke`
|
11408 | ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
11409 | ${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
|
11410 | ${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
|
11411 | <div id='operations-top' class='observe-me'>
|
11412 | <slot name='operations-top'></slot>
|
11413 | </div>
|
11414 | ${this.renderStyle === 'read' ? expandedEndpointTemplate.call(this) : endpointTemplate.call(this, isMini, pathsExpanded)}
|
11415 | `}
|
11416 | </div>
|
11417 | `}`}
|
11418 | </div>
|
11419 | <slot name='footer'></slot>
|
11420 | </main>
|
11421 | </div>
|
11422 | `;
|
11423 | }
|
11424 |
|
11425 | ;
|
11426 |
|
11427 |
|
11428 |
|
11429 |
|
11430 |
|
11431 |
|
11432 |
|
11433 |
|
11434 |
|
11435 |
|
11436 |
|
11437 |
|
11438 |
|
11439 |
|
11440 |
|
11441 |
|
11442 |
|
11443 |
|
11444 |
|
11445 |
|
11446 |
|
11447 |
|
11448 |
|
11449 |
|
11450 |
|
11451 |
|
11452 |
|
11453 |
|
11454 |
|
11455 |
|
11456 | class RapiDoc extends lit_element_h {
|
11457 | constructor() {
|
11458 | super();
|
11459 | const intersectionObserverOptions = {
|
11460 | root: this.getRootNode().host,
|
11461 | rootMargin: '-50px 0px -50px 0px',
|
11462 |
|
11463 | threshold: 0
|
11464 | };
|
11465 | this.showSummaryWhenCollapsed = true;
|
11466 |
|
11467 |
|
11468 | this.isIntersectionObserverActive = false;
|
11469 | this.intersectionObserver = new IntersectionObserver(entries => {
|
11470 | this.onIntersect(entries);
|
11471 | }, intersectionObserverOptions);
|
11472 | }
|
11473 | static get properties() {
|
11474 | return {
|
11475 |
|
11476 | headingText: {
|
11477 | type: String,
|
11478 | attribute: 'heading-text'
|
11479 | },
|
11480 | gotoPath: {
|
11481 | type: String,
|
11482 | attribute: 'goto-path'
|
11483 | },
|
11484 |
|
11485 | updateRoute: {
|
11486 | type: String,
|
11487 | attribute: 'update-route'
|
11488 | },
|
11489 | routePrefix: {
|
11490 | type: String,
|
11491 | attribute: 'route-prefix'
|
11492 | },
|
11493 | specUrl: {
|
11494 | type: String,
|
11495 | attribute: 'spec-url'
|
11496 | },
|
11497 | sortTags: {
|
11498 | type: String,
|
11499 | attribute: 'sort-tags'
|
11500 | },
|
11501 | sortSchemas: {
|
11502 | type: String,
|
11503 | attribute: 'sort-schemas'
|
11504 | },
|
11505 | generateMissingTags: {
|
11506 | type: String,
|
11507 | attribute: 'generate-missing-tags'
|
11508 | },
|
11509 | sortEndpointsBy: {
|
11510 | type: String,
|
11511 | attribute: 'sort-endpoints-by'
|
11512 | },
|
11513 | specFile: {
|
11514 | type: String,
|
11515 | attribute: false
|
11516 | },
|
11517 |
|
11518 | layout: {
|
11519 | type: String
|
11520 | },
|
11521 | renderStyle: {
|
11522 | type: String,
|
11523 | attribute: 'render-style'
|
11524 | },
|
11525 | defaultSchemaTab: {
|
11526 | type: String,
|
11527 | attribute: 'default-schema-tab'
|
11528 | },
|
11529 | responseAreaHeight: {
|
11530 | type: String,
|
11531 | attribute: 'response-area-height'
|
11532 | },
|
11533 | fillRequestFieldsWithExample: {
|
11534 | type: String,
|
11535 | attribute: 'fill-request-fields-with-example'
|
11536 | },
|
11537 | persistAuth: {
|
11538 | type: String,
|
11539 | attribute: 'persist-auth'
|
11540 | },
|
11541 | onNavTagClick: {
|
11542 | type: String,
|
11543 | attribute: 'on-nav-tag-click'
|
11544 | },
|
11545 |
|
11546 | schemaStyle: {
|
11547 | type: String,
|
11548 | attribute: 'schema-style'
|
11549 | },
|
11550 | schemaExpandLevel: {
|
11551 | type: Number,
|
11552 | attribute: 'schema-expand-level'
|
11553 | },
|
11554 | schemaDescriptionExpanded: {
|
11555 | type: String,
|
11556 | attribute: 'schema-description-expanded'
|
11557 | },
|
11558 | schemaHideReadOnly: {
|
11559 | type: String,
|
11560 | attribute: 'schema-hide-read-only'
|
11561 | },
|
11562 | schemaHideWriteOnly: {
|
11563 | type: String,
|
11564 | attribute: 'schema-hide-write-only'
|
11565 | },
|
11566 |
|
11567 | apiKeyName: {
|
11568 | type: String,
|
11569 | attribute: 'api-key-name'
|
11570 | },
|
11571 | apiKeyLocation: {
|
11572 | type: String,
|
11573 | attribute: 'api-key-location'
|
11574 | },
|
11575 | apiKeyValue: {
|
11576 | type: String,
|
11577 | attribute: 'api-key-value'
|
11578 | },
|
11579 | defaultApiServerUrl: {
|
11580 | type: String,
|
11581 | attribute: 'default-api-server'
|
11582 | },
|
11583 | serverUrl: {
|
11584 | type: String,
|
11585 | attribute: 'server-url'
|
11586 | },
|
11587 | oauthReceiver: {
|
11588 | type: String,
|
11589 | attribute: 'oauth-receiver'
|
11590 | },
|
11591 |
|
11592 | showHeader: {
|
11593 | type: String,
|
11594 | attribute: 'show-header'
|
11595 | },
|
11596 | showSideNav: {
|
11597 | type: String,
|
11598 | attribute: 'show-side-nav'
|
11599 | },
|
11600 | showInfo: {
|
11601 | type: String,
|
11602 | attribute: 'show-info'
|
11603 | },
|
11604 | allowAuthentication: {
|
11605 | type: String,
|
11606 | attribute: 'allow-authentication'
|
11607 | },
|
11608 | allowTry: {
|
11609 | type: String,
|
11610 | attribute: 'allow-try'
|
11611 | },
|
11612 | showCurlBeforeTry: {
|
11613 | type: String,
|
11614 | attribute: 'show-curl-before-try'
|
11615 | },
|
11616 | allowSpecUrlLoad: {
|
11617 | type: String,
|
11618 | attribute: 'allow-spec-url-load'
|
11619 | },
|
11620 | allowSpecFileLoad: {
|
11621 | type: String,
|
11622 | attribute: 'allow-spec-file-load'
|
11623 | },
|
11624 | allowSpecFileDownload: {
|
11625 | type: String,
|
11626 | attribute: 'allow-spec-file-download'
|
11627 | },
|
11628 | allowSearch: {
|
11629 | type: String,
|
11630 | attribute: 'allow-search'
|
11631 | },
|
11632 | allowAdvancedSearch: {
|
11633 | type: String,
|
11634 | attribute: 'allow-advanced-search'
|
11635 | },
|
11636 | allowServerSelection: {
|
11637 | type: String,
|
11638 | attribute: 'allow-server-selection'
|
11639 | },
|
11640 | allowSchemaDescriptionExpandToggle: {
|
11641 | type: String,
|
11642 | attribute: 'allow-schema-description-expand-toggle'
|
11643 | },
|
11644 | showComponents: {
|
11645 | type: String,
|
11646 | attribute: 'show-components'
|
11647 | },
|
11648 | pageDirection: {
|
11649 | type: String,
|
11650 | attribute: 'page-direction'
|
11651 | },
|
11652 | scrollBehavior: {
|
11653 | type: String,
|
11654 | attribute: 'scroll-behavior'
|
11655 | },
|
11656 |
|
11657 | theme: {
|
11658 | type: String
|
11659 | },
|
11660 | bgColor: {
|
11661 | type: String,
|
11662 | attribute: 'bg-color'
|
11663 | },
|
11664 | textColor: {
|
11665 | type: String,
|
11666 | attribute: 'text-color'
|
11667 | },
|
11668 | headerColor: {
|
11669 | type: String,
|
11670 | attribute: 'header-color'
|
11671 | },
|
11672 | primaryColor: {
|
11673 | type: String,
|
11674 | attribute: 'primary-color'
|
11675 | },
|
11676 | fontSize: {
|
11677 | type: String,
|
11678 | attribute: 'font-size'
|
11679 | },
|
11680 | regularFont: {
|
11681 | type: String,
|
11682 | attribute: 'regular-font'
|
11683 | },
|
11684 | monoFont: {
|
11685 | type: String,
|
11686 | attribute: 'mono-font'
|
11687 | },
|
11688 | loadFonts: {
|
11689 | type: String,
|
11690 | attribute: 'load-fonts'
|
11691 | },
|
11692 | cssFile: {
|
11693 | type: String,
|
11694 | attribute: 'css-file'
|
11695 | },
|
11696 | cssClasses: {
|
11697 | type: String,
|
11698 | attribute: 'css-classes'
|
11699 | },
|
11700 |
|
11701 | navBgColor: {
|
11702 | type: String,
|
11703 | attribute: 'nav-bg-color'
|
11704 | },
|
11705 | navTextColor: {
|
11706 | type: String,
|
11707 | attribute: 'nav-text-color'
|
11708 | },
|
11709 | navHoverBgColor: {
|
11710 | type: String,
|
11711 | attribute: 'nav-hover-bg-color'
|
11712 | },
|
11713 | navHoverTextColor: {
|
11714 | type: String,
|
11715 | attribute: 'nav-hover-text-color'
|
11716 | },
|
11717 | navAccentColor: {
|
11718 | type: String,
|
11719 | attribute: 'nav-accent-color'
|
11720 | },
|
11721 | navAccentTextColor: {
|
11722 | type: String,
|
11723 | attribute: 'nav-accent-text-color'
|
11724 | },
|
11725 | navActiveItemMarker: {
|
11726 | type: String,
|
11727 | attribute: 'nav-active-item-marker'
|
11728 | },
|
11729 | navItemSpacing: {
|
11730 | type: String,
|
11731 | attribute: 'nav-item-spacing'
|
11732 | },
|
11733 | showMethodInNavBar: {
|
11734 | type: String,
|
11735 | attribute: 'show-method-in-nav-bar'
|
11736 | },
|
11737 | usePathInNavBar: {
|
11738 | type: String,
|
11739 | attribute: 'use-path-in-nav-bar'
|
11740 | },
|
11741 | infoDescriptionHeadingsInNavBar: {
|
11742 | type: String,
|
11743 | attribute: 'info-description-headings-in-navbar'
|
11744 | },
|
11745 |
|
11746 | fetchCredentials: {
|
11747 | type: String,
|
11748 | attribute: 'fetch-credentials'
|
11749 | },
|
11750 |
|
11751 | matchPaths: {
|
11752 | type: String,
|
11753 | attribute: 'match-paths'
|
11754 | },
|
11755 | matchType: {
|
11756 | type: String,
|
11757 | attribute: 'match-type'
|
11758 | },
|
11759 | removeEndpointsWithBadgeLabelAs: {
|
11760 | type: String,
|
11761 | attribute: 'remove-endpoints-with-badge-label-as'
|
11762 | },
|
11763 |
|
11764 | loading: {
|
11765 | type: Boolean
|
11766 | },
|
11767 |
|
11768 | focusedElementId: {
|
11769 | type: String
|
11770 | },
|
11771 |
|
11772 | showAdvancedSearchDialog: {
|
11773 | type: Boolean
|
11774 | },
|
11775 | advancedSearchMatches: {
|
11776 | type: Object
|
11777 | },
|
11778 | searchVal: {
|
11779 | type: String
|
11780 | }
|
11781 | };
|
11782 | }
|
11783 | static get styles() {
|
11784 | return [font_styles, input_styles, flex_styles, table_styles, endpoint_styles, prism_styles, tab_styles, nav_styles, info_styles, i`
|
11785 | :host {
|
11786 | all: initial;
|
11787 | display:flex;
|
11788 | flex-direction: column;
|
11789 | min-width:360px;
|
11790 | width:100%;
|
11791 | height:100%;
|
11792 | margin:0;
|
11793 | padding:0;
|
11794 | overflow: hidden;
|
11795 | letter-spacing:normal;
|
11796 | color:var(--fg);
|
11797 | background-color:var(--bg);
|
11798 | font-family:var(--font-regular);
|
11799 | container-type: inline-size;
|
11800 | }
|
11801 | :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
11802 | :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
11803 | .body {
|
11804 | display:flex;
|
11805 | height:100%;
|
11806 | width:100%;
|
11807 | overflow:hidden;
|
11808 | }
|
11809 | .main-content {
|
11810 | margin:0;
|
11811 | padding: 0;
|
11812 | display:block;
|
11813 | flex:1;
|
11814 | height:100%;
|
11815 | overflow-y: auto;
|
11816 | overflow-x: hidden;
|
11817 | scrollbar-width: thin;
|
11818 | scrollbar-color: var(--border-color) transparent;
|
11819 | }
|
11820 |
|
11821 | .main-content-inner--view-mode {
|
11822 | padding: 0 8px;
|
11823 | }
|
11824 | .main-content::-webkit-scrollbar {
|
11825 | width: 8px;
|
11826 | height: 8px;
|
11827 | }
|
11828 | .main-content::-webkit-scrollbar-track {
|
11829 | background:transparent;
|
11830 | }
|
11831 | .main-content::-webkit-scrollbar-thumb {
|
11832 | background-color: var(--border-color);
|
11833 | }
|
11834 |
|
11835 | .section-gap.section-tag {
|
11836 | border-bottom:1px solid var(--border-color);
|
11837 | }
|
11838 | .section-gap,
|
11839 | .section-gap--focused-mode,
|
11840 | .section-gap--read-mode {
|
11841 | padding: 0px 4px;
|
11842 | }
|
11843 | .section-tag-header {
|
11844 | position:relative;
|
11845 | cursor: n-resize;
|
11846 | padding: 12px 0;
|
11847 | }
|
11848 | .collapsed .section-tag-header:hover {
|
11849 | cursor: s-resize;
|
11850 | }
|
11851 |
|
11852 | .section-tag-header:hover {
|
11853 | background-image: linear-gradient(to right, rgba(0,0,0,0), var(--border-color), rgba(0,0,0,0));
|
11854 | }
|
11855 |
|
11856 | .section-tag-header:hover::after {
|
11857 | position:absolute;
|
11858 | margin-left:-24px;
|
11859 | font-size:20px;
|
11860 | top: calc(50% - 14px);
|
11861 | color:var(--primary-color);
|
11862 | content: '⬆';
|
11863 | }
|
11864 |
|
11865 | .collapsed .section-tag-header::after {
|
11866 | position:absolute;
|
11867 | margin-left:-24px;
|
11868 | font-size:20px;
|
11869 | top: calc(50% - 14px);
|
11870 | color: var(--border-color);
|
11871 | content: '⬇';
|
11872 | }
|
11873 | .collapsed .section-tag-header:hover::after {
|
11874 | color:var(--primary-color);
|
11875 | }
|
11876 |
|
11877 | .collapsed .section-tag-body {
|
11878 | display:none;
|
11879 | }
|
11880 |
|
11881 | .logo {
|
11882 | height:36px;
|
11883 | width:36px;
|
11884 | margin-left:5px;
|
11885 | }
|
11886 | .only-large-screen-flex,
|
11887 | .only-large-screen {
|
11888 | display:none;
|
11889 | }
|
11890 | .tag.title {
|
11891 | text-transform: uppercase;
|
11892 | }
|
11893 | .main-header {
|
11894 | background-color:var(--header-bg);
|
11895 | color:var(--header-fg);
|
11896 | width:100%;
|
11897 | }
|
11898 | .header-title {
|
11899 | font-size:calc(var(--font-size-regular) + 8px);
|
11900 | padding:0 8px;
|
11901 | }
|
11902 | input.header-input{
|
11903 | background:var(--header-color-darker);
|
11904 | color:var(--header-fg);
|
11905 | border:1px solid var(--header-color-border);
|
11906 | flex:1;
|
11907 | padding-right:24px;
|
11908 | border-radius:3px;
|
11909 | }
|
11910 | input.header-input::placeholder {
|
11911 | opacity:0.4;
|
11912 | }
|
11913 | .loader {
|
11914 | margin: 16px auto 16px auto;
|
11915 | border: 4px solid var(--bg3);
|
11916 | border-radius: 50%;
|
11917 | border-top: 4px solid var(--primary-color);
|
11918 | width: 36px;
|
11919 | height: 36px;
|
11920 | animation: spin 2s linear infinite;
|
11921 | }
|
11922 | .expanded-endpoint-body {
|
11923 | position: relative;
|
11924 | padding: 6px 0px;
|
11925 | }
|
11926 | .expanded-endpoint-body .tag-description {
|
11927 | background: var(--code-bg);
|
11928 | border-radius: var(--border-radius);
|
11929 | transition: max-height .2s ease-out;
|
11930 | }
|
11931 | .expanded-endpoint-body .tag-icon {
|
11932 | transition: transform .2s ease-out;
|
11933 | }
|
11934 | .expanded-endpoint-body .tag-icon.expanded {
|
11935 | transform: rotate(180deg);
|
11936 | }
|
11937 | .divider {
|
11938 | border-top: 2px solid var(--border-color);
|
11939 | margin: 24px 0;
|
11940 | width:100%;
|
11941 | }
|
11942 |
|
11943 | .tooltip {
|
11944 | cursor:pointer;
|
11945 | border: 1px solid var(--border-color);
|
11946 | border-left-width: 4px;
|
11947 | margin-left:2px;
|
11948 | }
|
11949 | .tooltip a {
|
11950 | color: var(--fg2);
|
11951 | text-decoration: none;
|
11952 | }
|
11953 | .tooltip-text {
|
11954 | color: var(--fg2);
|
11955 | max-width: 400px;
|
11956 | position: absolute;
|
11957 | z-index:1;
|
11958 | background-color: var(--bg2);
|
11959 | visibility: hidden;
|
11960 |
|
11961 | overflow-wrap: break-word;
|
11962 | }
|
11963 | .tooltip:hover {
|
11964 | color: var(--primary-color);
|
11965 | border-color: var(--primary-color);
|
11966 | }
|
11967 | .tooltip:hover a:hover {
|
11968 | color: var(--primary-color);
|
11969 | }
|
11970 |
|
11971 | .tooltip:hover .tooltip-text {
|
11972 | visibility: visible;
|
11973 | }
|
11974 |
|
11975 | @keyframes spin {
|
11976 | 0% { transform: rotate(0deg); }
|
11977 | 100% { transform: rotate(360deg); }
|
11978 | }
|
11979 |
|
11980 | .nav-method { font-weight: bold; margin-right: 4px; font-size: calc(var(--font-size-small) - 2px); white-space: nowrap; }
|
11981 | .nav-method.false { display: none; }
|
11982 |
|
11983 | .nav-method.as-colored-text.get { color:var(--nav-get-color); }
|
11984 | .nav-method.as-colored-text.put { color:var(--nav-put-color); }
|
11985 | .nav-method.as-colored-text.post { color:var(--nav-post-color); }
|
11986 | .nav-method.as-colored-text.delete { color:var(--nav-delete-color); }
|
11987 | .nav-method.as-colored-text.head, .nav-method.as-colored-text.patch, .nav-method.as-colored-text.options { color:var(--nav-head-color); }
|
11988 |
|
11989 | .nav-method.as-colored-block {
|
11990 | padding: 1px 4px;
|
11991 | min-width: 30px;
|
11992 | border-radius: 4px 0 0 4px;
|
11993 | color: #000;
|
11994 | }
|
11995 | .colored-block .nav-method.as-colored-block {
|
11996 | outline: 1px solid;
|
11997 | }
|
11998 |
|
11999 | .nav-method.as-colored-block.get { background-color: var(--blue); }
|
12000 | .nav-method.as-colored-block.put { background-color: var(--orange); }
|
12001 | .nav-method.as-colored-block.post { background-color: var(--green); }
|
12002 | .nav-method.as-colored-block.delete { background-color: var(--red); }
|
12003 | .nav-method.as-colored-block.head, .nav-method.as-colored-block.patch , .nav-method.as-colored-block.options {
|
12004 | background-color: var(--yellow);
|
12005 | }
|
12006 |
|
12007 | @container (min-width: 768px) {
|
12008 | .nav-bar {
|
12009 | width: 260px;
|
12010 | display:flex;
|
12011 | }
|
12012 | .only-large-screen {
|
12013 | display:block;
|
12014 | }
|
12015 | .only-large-screen-flex {
|
12016 | display:flex;
|
12017 | }
|
12018 | .section-gap {
|
12019 | padding: 0 0 0 24px;
|
12020 | }
|
12021 | .section-gap--focused-mode {
|
12022 | padding: 24px 8px;
|
12023 | }
|
12024 | .section-gap--read-mode {
|
12025 | padding: 24px 8px;
|
12026 | }
|
12027 | .endpoint-body {
|
12028 | position: relative;
|
12029 | padding:36px 0 48px 0;
|
12030 | }
|
12031 | }
|
12032 |
|
12033 | @container (min-width: 1024px) {
|
12034 | .nav-bar {
|
12035 | width: ${r(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')};
|
12036 | display:flex;
|
12037 | }
|
12038 | .section-gap--focused-mode {
|
12039 | padding: 12px 80px 12px 80px;
|
12040 | }
|
12041 | .section-gap--read-mode {
|
12042 | padding: 24px 80px 12px 80px;
|
12043 | }
|
12044 | }`, custom_styles];
|
12045 | }
|
12046 |
|
12047 |
|
12048 | connectedCallback() {
|
12049 | super.connectedCallback();
|
12050 | const parent = this.parentElement;
|
12051 | if (parent) {
|
12052 | if (parent.offsetWidth === 0 && parent.style.width === '') {
|
12053 | parent.style.width = '100vw';
|
12054 | }
|
12055 | if (parent.offsetHeight === 0 && parent.style.height === '') {
|
12056 | parent.style.height = '100vh';
|
12057 | }
|
12058 | if (parent.tagName === 'BODY') {
|
12059 | if (!parent.style.marginTop) {
|
12060 | parent.style.marginTop = '0';
|
12061 | }
|
12062 | if (!parent.style.marginRight) {
|
12063 | parent.style.marginRight = '0';
|
12064 | }
|
12065 | if (!parent.style.marginBottom) {
|
12066 | parent.style.marginBottom = '0';
|
12067 | }
|
12068 | if (!parent.style.marginLeft) {
|
12069 | parent.style.marginLeft = '0';
|
12070 | }
|
12071 | }
|
12072 | }
|
12073 | if (this.loadFonts !== 'false') {
|
12074 | const fontDescriptor = {
|
12075 | family: 'Open Sans',
|
12076 | style: 'normal',
|
12077 | weight: '300',
|
12078 | unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD'
|
12079 | };
|
12080 | const fontWeight300 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
12081 | fontDescriptor.weight = '600';
|
12082 | const fontWeight600 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
12083 | fontWeight300.load().then(font => {
|
12084 | document.fonts.add(font);
|
12085 | });
|
12086 | fontWeight600.load().then(font => {
|
12087 | document.fonts.add(font);
|
12088 | });
|
12089 | }
|
12090 | if (!this.layout || !'row, column,'.includes(`${this.layout},`)) {
|
12091 | this.layout = 'row';
|
12092 | }
|
12093 | if (!this.renderStyle || !'read, view, focused,'.includes(`${this.renderStyle},`)) {
|
12094 | this.renderStyle = 'focused';
|
12095 | }
|
12096 | if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) {
|
12097 | this.schemaStyle = 'tree';
|
12098 | }
|
12099 | if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
12100 | this.theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
12101 | }
|
12102 | if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {
|
12103 | this.defaultSchemaTab = 'example';
|
12104 | } else if (this.defaultSchemaTab === 'model') {
|
12105 | this.defaultSchemaTab = 'schema';
|
12106 | }
|
12107 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
12108 | this.schemaExpandLevel = 99999;
|
12109 | }
|
12110 | if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) {
|
12111 | this.schemaDescriptionExpanded = 'false';
|
12112 | }
|
12113 | if (!this.schemaHideReadOnly || !'default, never,'.includes(`${this.schemaHideReadOnly},`)) {
|
12114 | this.schemaHideReadOnly = 'default';
|
12115 | }
|
12116 | if (!this.schemaHideWriteOnly || !'default, never,'.includes(`${this.schemaHideWriteOnly},`)) {
|
12117 | this.schemaHideWriteOnly = 'default';
|
12118 | }
|
12119 | if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) {
|
12120 | this.fillRequestFieldsWithExample = 'true';
|
12121 | }
|
12122 | if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) {
|
12123 | this.persistAuth = 'false';
|
12124 | }
|
12125 | if (!this.responseAreaHeight) {
|
12126 | this.responseAreaHeight = '400px';
|
12127 | }
|
12128 | if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) {
|
12129 | this.allowSearch = 'true';
|
12130 | }
|
12131 | if (!this.allowAdvancedSearch || !'true, false,'.includes(`${this.allowAdvancedSearch},`)) {
|
12132 | this.allowAdvancedSearch = 'true';
|
12133 | }
|
12134 | if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) {
|
12135 | this.allowTry = 'true';
|
12136 | }
|
12137 | if (!this.apiKeyValue) {
|
12138 | this.apiKeyValue = '-';
|
12139 | }
|
12140 | if (!this.apiKeyLocation) {
|
12141 | this.apiKeyLocation = 'header';
|
12142 | }
|
12143 | if (!this.apiKeyName) {
|
12144 | this.apiKeyName = '';
|
12145 | }
|
12146 | if (!this.oauthReceiver) {
|
12147 | this.oauthReceiver = 'oauth-receiver.html';
|
12148 | }
|
12149 | if (!this.updateRoute || !'true, false,'.includes(`${this.updateRoute},`)) {
|
12150 | this.updateRoute = 'true';
|
12151 | }
|
12152 | if (!this.routePrefix) {
|
12153 | this.routePrefix = '#';
|
12154 | }
|
12155 | if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) {
|
12156 | this.sortTags = 'false';
|
12157 | }
|
12158 | if (!this.sortSchemas || !'true, false,'.includes(`${this.sortSchemas},`)) {
|
12159 | this.sortSchemas = 'false';
|
12160 | }
|
12161 | if (!this.generateMissingTags || !'true, false,'.includes(`${this.generateMissingTags},`)) {
|
12162 | this.generateMissingTags = 'false';
|
12163 | }
|
12164 | if (!this.sortEndpointsBy || !'method, path, summary, none,'.includes(`${this.sortEndpointsBy},`)) {
|
12165 | this.sortEndpointsBy = 'path';
|
12166 | }
|
12167 | if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) {
|
12168 | this.onNavTagClick = 'expand-collapse';
|
12169 | }
|
12170 | if (!this.navItemSpacing || !'compact, relaxed, default,'.includes(`${this.navItemSpacing},`)) {
|
12171 | this.navItemSpacing = 'default';
|
12172 | }
|
12173 | if (!this.showMethodInNavBar || !'false, as-plain-text, as-colored-text, as-colored-block,'.includes(`${this.showMethodInNavBar},`)) {
|
12174 | this.showMethodInNavBar = 'false';
|
12175 | }
|
12176 | if (!this.usePathInNavBar || !'true, false,'.includes(`${this.usePathInNavBar},`)) {
|
12177 | this.usePathInNavBar = 'false';
|
12178 | }
|
12179 | if (!this.navActiveItemMarker || !'left-bar, colored-block'.includes(`${this.navActiveItemMarker},`)) {
|
12180 | this.navActiveItemMarker = 'left-bar';
|
12181 | }
|
12182 | if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) {
|
12183 | this.fontSize = 'default';
|
12184 | }
|
12185 | if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) {
|
12186 | this.showInfo = 'true';
|
12187 | }
|
12188 | if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) {
|
12189 | this.allowServerSelection = 'true';
|
12190 | }
|
12191 | if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) {
|
12192 | this.allowAuthentication = 'true';
|
12193 | }
|
12194 | if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) {
|
12195 | this.allowSchemaDescriptionExpandToggle = 'true';
|
12196 | }
|
12197 | if (!this.showSideNav || !'true false'.includes(this.showSideNav)) {
|
12198 | this.showSideNav = 'true';
|
12199 | }
|
12200 | if (!this.showComponents || !'true false'.includes(this.showComponents)) {
|
12201 | this.showComponents = 'false';
|
12202 | }
|
12203 | if (!this.infoDescriptionHeadingsInNavBar || !'true, false,'.includes(`${this.infoDescriptionHeadingsInNavBar},`)) {
|
12204 | this.infoDescriptionHeadingsInNavBar = 'false';
|
12205 | }
|
12206 | if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) {
|
12207 | this.fetchCredentials = '';
|
12208 | }
|
12209 | if (!this.scrollBehavior || !'smooth, auto,'.includes(`${this.scrollBehavior},`)) {
|
12210 | this.scrollBehavior = 'auto';
|
12211 | }
|
12212 | if (!this.matchType || !'includes regex'.includes(this.matchType)) {
|
12213 | this.matchType = 'includes';
|
12214 | }
|
12215 | if (!this.matchPaths) {
|
12216 | this.matchPaths = '';
|
12217 | }
|
12218 | if (!this.removeEndpointsWithBadgeLabelAs) {
|
12219 | this.removeEndpointsWithBadgeLabelAs = '';
|
12220 | }
|
12221 | if (!this.showAdvancedSearchDialog) {
|
12222 | this.showAdvancedSearchDialog = false;
|
12223 | }
|
12224 | if (!this.cssFile) {
|
12225 | this.cssFile = null;
|
12226 | }
|
12227 | if (!this.cssClasses) {
|
12228 | this.cssClasses = '';
|
12229 | }
|
12230 | marked.setOptions({
|
12231 | highlight: (code, lang) => {
|
12232 | if ((prism_default()).languages[lang]) {
|
12233 | return prism_default().highlight(code, (prism_default()).languages[lang], lang);
|
12234 | }
|
12235 | return code;
|
12236 | }
|
12237 | });
|
12238 | window.addEventListener('hashchange', () => {
|
12239 | this.scrollToPath(this.getElementIDFromURL());
|
12240 | }, true);
|
12241 | }
|
12242 |
|
12243 |
|
12244 | disconnectedCallback() {
|
12245 | if (this.intersectionObserver) {
|
12246 | this.intersectionObserver.disconnect();
|
12247 | }
|
12248 | super.disconnectedCallback();
|
12249 | }
|
12250 | infoDescriptionHeadingRenderer() {
|
12251 | const renderer = new marked.Renderer();
|
12252 | renderer.heading = (text, level, raw, slugger) => `<h${level} class="observe-me" id="${slugger.slug(raw)}">${text}</h${level}>`;
|
12253 | return renderer;
|
12254 | }
|
12255 | render() {
|
12256 |
|
12257 | const cssLinkEl = document.querySelector(`link[href*="${this.cssFile}"]`);
|
12258 |
|
12259 | if (cssLinkEl) {
|
12260 | this.shadowRoot.appendChild(cssLinkEl.cloneNode());
|
12261 | }
|
12262 | return mainBodyTemplate.call(this);
|
12263 | }
|
12264 | observeExpandedContent() {
|
12265 |
|
12266 | const observeOverviewEls = this.shadowRoot.querySelectorAll('.observe-me');
|
12267 | observeOverviewEls.forEach(targetEl => {
|
12268 | this.intersectionObserver.observe(targetEl);
|
12269 | });
|
12270 | }
|
12271 | attributeChangedCallback(name, oldVal, newVal) {
|
12272 | if (name === 'spec-url') {
|
12273 | if (oldVal !== newVal) {
|
12274 |
|
12275 | window.setTimeout(async () => {
|
12276 | await this.loadSpec(newVal);
|
12277 |
|
12278 | if (this.gotoPath && !window.location.hash) {
|
12279 | this.scrollToPath(this.gotoPath);
|
12280 | }
|
12281 | }, 0);
|
12282 | }
|
12283 | }
|
12284 | if (name === 'match-paths' || name === 'match-type' || name === 'remove-endpoints-with-badge-label-as') {
|
12285 | if (oldVal !== newVal) {
|
12286 | window.setTimeout(async () => {
|
12287 | await this.loadSpec(this.specUrl);
|
12288 | }, 0);
|
12289 | }
|
12290 | }
|
12291 | if (name === 'render-style') {
|
12292 | if (newVal === 'read') {
|
12293 | window.setTimeout(() => {
|
12294 | this.observeExpandedContent();
|
12295 | }, 100);
|
12296 | } else {
|
12297 | this.intersectionObserver.disconnect();
|
12298 | }
|
12299 | }
|
12300 | if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {
|
12301 | let updateSelectedApiKey = false;
|
12302 | let apiKeyName = '';
|
12303 | let apiKeyLocation = '';
|
12304 | let apiKeyValue = '';
|
12305 | if (name === 'api-key-name') {
|
12306 | if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {
|
12307 | apiKeyName = newVal;
|
12308 | apiKeyLocation = this.getAttribute('api-key-location');
|
12309 | apiKeyValue = this.getAttribute('api-key-value');
|
12310 | updateSelectedApiKey = true;
|
12311 | }
|
12312 | } else if (name === 'api-key-location') {
|
12313 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {
|
12314 | apiKeyLocation = newVal;
|
12315 | apiKeyName = this.getAttribute('api-key-name');
|
12316 | apiKeyValue = this.getAttribute('api-key-value');
|
12317 | updateSelectedApiKey = true;
|
12318 | }
|
12319 | } else if (name === 'api-key-value') {
|
12320 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {
|
12321 | apiKeyValue = newVal;
|
12322 | apiKeyLocation = this.getAttribute('api-key-location');
|
12323 | apiKeyName = this.getAttribute('api-key-name');
|
12324 | updateSelectedApiKey = true;
|
12325 | }
|
12326 | }
|
12327 | if (updateSelectedApiKey) {
|
12328 | if (this.resolvedSpec) {
|
12329 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey);
|
12330 | if (!rapiDocApiKey) {
|
12331 | this.resolvedSpec.securitySchemes.push({
|
12332 | securitySchemeId: rapidocApiKey,
|
12333 | description: 'api-key provided in rapidoc element attributes',
|
12334 | type: 'apiKey',
|
12335 | name: apiKeyName,
|
12336 | in: apiKeyLocation,
|
12337 | value: apiKeyValue,
|
12338 | finalKeyValue: apiKeyValue
|
12339 | });
|
12340 | } else {
|
12341 | rapiDocApiKey.name = apiKeyName;
|
12342 | rapiDocApiKey.in = apiKeyLocation;
|
12343 | rapiDocApiKey.value = apiKeyValue;
|
12344 | rapiDocApiKey.finalKeyValue = apiKeyValue;
|
12345 | }
|
12346 | this.requestUpdate();
|
12347 | }
|
12348 | }
|
12349 | }
|
12350 | super.attributeChangedCallback(name, oldVal, newVal);
|
12351 | }
|
12352 | onSpecUrlChange() {
|
12353 | this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
12354 | }
|
12355 | onSpecFileChange(e) {
|
12356 | this.setAttribute('spec-file', this.shadowRoot.getElementById('spec-file').value);
|
12357 | const specFile = e.target.files[0];
|
12358 | const reader = new FileReader();
|
12359 | reader.onload = () => {
|
12360 | try {
|
12361 | const specObj = JSON.parse(reader.result);
|
12362 | this.loadSpec(specObj);
|
12363 | this.shadowRoot.getElementById('spec-url').value = '';
|
12364 | } catch {
|
12365 | console.error('RapiDoc: Unable to read or parse json');
|
12366 | }
|
12367 | };
|
12368 |
|
12369 | reader.readAsText(specFile);
|
12370 | }
|
12371 | onFileLoadClick() {
|
12372 | this.shadowRoot.getElementById('spec-file').click();
|
12373 | }
|
12374 | onSearchChange(e) {
|
12375 |
|
12376 | this.searchVal = e.target.value;
|
12377 | this.resolvedSpec.tags.forEach(tag => tag.paths.filter(path => {
|
12378 | if (this.searchVal) {
|
12379 | if (getMatchedPaths(this.searchVal, path, tag.name)) {
|
12380 | tag.expanded = true;
|
12381 | }
|
12382 | }
|
12383 | }));
|
12384 | this.resolvedSpec.components.forEach(component => component.subComponents.filter(v => {
|
12385 | v.expanded = false;
|
12386 | if (getMatchedComponents(this.searchVal, v)) {
|
12387 | v.expanded = true;
|
12388 | }
|
12389 | }));
|
12390 | this.requestUpdate();
|
12391 | }
|
12392 | onClearSearch() {
|
12393 | const searchEl = this.shadowRoot.getElementById('nav-bar-search');
|
12394 | searchEl.value = '';
|
12395 | this.searchVal = '';
|
12396 | this.resolvedSpec.components.forEach(component => component.subComponents.filter(v => {
|
12397 | v.expanded = true;
|
12398 | }));
|
12399 | }
|
12400 | onShowSearchModalClicked() {
|
12401 | this.showAdvancedSearchDialog = true;
|
12402 | }
|
12403 |
|
12404 |
|
12405 | async onOpenSearchDialog(e) {
|
12406 |
|
12407 | const inputEl = e.detail.querySelector('input');
|
12408 | await sleep(0);
|
12409 | if (inputEl) {
|
12410 | inputEl.focus();
|
12411 | }
|
12412 | }
|
12413 |
|
12414 |
|
12415 | async loadSpec(specUrl) {
|
12416 | if (!specUrl) {
|
12417 | return;
|
12418 | }
|
12419 | this.searchVal = '';
|
12420 | try {
|
12421 | this.resolvedSpec = {
|
12422 | specLoadError: false,
|
12423 | isSpecLoading: true,
|
12424 | tags: []
|
12425 | };
|
12426 | this.loading = true;
|
12427 | this.loadFailed = false;
|
12428 | const spec = await ProcessSpec.call(this, specUrl, this.generateMissingTags === 'true', this.sortTags === 'true', this.sortSchemas === 'true', this.getAttribute('sort-endpoints-by'), this.getAttribute('api-key-name'), this.getAttribute('api-key-location'), this.getAttribute('api-key-value'), this.getAttribute('server-url'), this.matchPaths, this.matchType, this.removeEndpointsWithBadgeLabelAs);
|
12429 | this.loading = false;
|
12430 | this.afterSpecParsedAndValidated(spec);
|
12431 | } catch (err) {
|
12432 | this.loading = false;
|
12433 | this.loadFailed = true;
|
12434 | this.resolvedSpec = null;
|
12435 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`);
|
12436 | }
|
12437 | }
|
12438 | async afterSpecParsedAndValidated(spec) {
|
12439 | this.resolvedSpec = spec;
|
12440 | this.selectedServer = undefined;
|
12441 | if (this.defaultApiServerUrl) {
|
12442 | if (this.defaultApiServerUrl === this.serverUrl) {
|
12443 | this.selectedServer = {
|
12444 | url: this.serverUrl,
|
12445 | computedUrl: this.serverUrl
|
12446 | };
|
12447 | } else if (this.resolvedSpec.servers) {
|
12448 | this.selectedServer = this.resolvedSpec.servers.find(v => v.url === this.defaultApiServerUrl);
|
12449 | }
|
12450 | }
|
12451 | if (!this.selectedServer) {
|
12452 | if (this.resolvedSpec.servers) {
|
12453 | this.selectedServer = this.resolvedSpec.servers[0];
|
12454 | }
|
12455 | }
|
12456 | this.requestUpdate();
|
12457 |
|
12458 | while (!(await this.updateComplete));
|
12459 | const specLoadedEvent = new CustomEvent('spec-loaded', {
|
12460 | detail: spec
|
12461 | });
|
12462 | this.dispatchEvent(specLoadedEvent);
|
12463 |
|
12464 |
|
12465 | this.intersectionObserver.disconnect();
|
12466 | if (this.renderStyle === 'read') {
|
12467 | await sleep(100);
|
12468 | this.observeExpandedContent();
|
12469 | }
|
12470 | this.isIntersectionObserverActive = true;
|
12471 |
|
12472 |
|
12473 | const elementId = this.getElementIDFromURL();
|
12474 | if (elementId) {
|
12475 | if (this.renderStyle === 'view') {
|
12476 | this.expandAndGotoOperation(elementId, true, true);
|
12477 | } else {
|
12478 | this.scrollToPath(elementId);
|
12479 | }
|
12480 | } else if (this.renderStyle === 'focused') {
|
12481 |
|
12482 | if (!this.gotoPath) {
|
12483 | var _this$resolvedSpec$ta;
|
12484 | const defaultElementId = this.showInfo ? 'overview' : (_this$resolvedSpec$ta = this.resolvedSpec.tags[0]) === null || _this$resolvedSpec$ta === void 0 ? void 0 : _this$resolvedSpec$ta.paths[0];
|
12485 | this.scrollToPath(defaultElementId);
|
12486 | }
|
12487 | }
|
12488 | }
|
12489 |
|
12490 | |
12491 |
|
12492 |
|
12493 | getComponentBaseURL() {
|
12494 | const {
|
12495 | href
|
12496 | } = window.location;
|
12497 |
|
12498 |
|
12499 | const cleanRouterPrefix = this.routePrefix.replace(/(#|\/)$/, '');
|
12500 | if (!cleanRouterPrefix) {
|
12501 | return href.split('#')[0];
|
12502 | }
|
12503 | const indexOfRoutePrefix = href.lastIndexOf(cleanRouterPrefix);
|
12504 | if (indexOfRoutePrefix === -1) {
|
12505 | return href;
|
12506 | }
|
12507 | return href.slice(0, indexOfRoutePrefix);
|
12508 | }
|
12509 |
|
12510 | |
12511 |
|
12512 |
|
12513 | getElementIDFromURL() {
|
12514 | const baseURL = this.getComponentBaseURL();
|
12515 | const elementId = window.location.href.replace(baseURL + this.routePrefix, '');
|
12516 | return elementId;
|
12517 | }
|
12518 | replaceHistoryState(hashId) {
|
12519 | const baseURL = this.getComponentBaseURL();
|
12520 | window.history.replaceState(null, null, `${baseURL}${this.routePrefix || '#'}${hashId}`);
|
12521 | }
|
12522 | expandAndGotoOperation(elementId, scrollToElement = true) {
|
12523 | if (!this.resolvedSpec) {
|
12524 | return;
|
12525 | }
|
12526 |
|
12527 | let isExpandingNeeded = true;
|
12528 | const tmpElementId = elementId.indexOf('#') === -1 ? elementId : elementId.substring(1);
|
12529 | if (tmpElementId.startsWith('overview') || tmpElementId === 'servers' || tmpElementId === 'auth') {
|
12530 | isExpandingNeeded = false;
|
12531 | } else {
|
12532 | for (let i = 0; i < ((_this$resolvedSpec$ta2 = this.resolvedSpec.tags) === null || _this$resolvedSpec$ta2 === void 0 ? void 0 : _this$resolvedSpec$ta2.length); i++) {
|
12533 | var _this$resolvedSpec$ta2, _tag$paths;
|
12534 | const tag = this.resolvedSpec.tags[i];
|
12535 | const path = (_tag$paths = tag.paths) === null || _tag$paths === void 0 ? void 0 : _tag$paths.find(p => p.elementId === elementId);
|
12536 | if (path) {
|
12537 | if (path.expanded && tag.expanded) {
|
12538 | isExpandingNeeded = false;
|
12539 | } else {
|
12540 | path.expanded = true;
|
12541 | tag.expanded = true;
|
12542 | }
|
12543 | }
|
12544 | }
|
12545 | }
|
12546 | if (scrollToElement) {
|
12547 |
|
12548 | if (isExpandingNeeded) {
|
12549 | this.requestUpdate();
|
12550 | }
|
12551 | window.setTimeout(() => {
|
12552 | const gotoEl = this.shadowRoot.getElementById(tmpElementId);
|
12553 | if (gotoEl) {
|
12554 | gotoEl.scrollIntoView({
|
12555 | behavior: this.scrollBehavior,
|
12556 | block: 'start'
|
12557 | });
|
12558 | if (this.updateRoute === 'true') {
|
12559 | this.replaceHistoryState(tmpElementId);
|
12560 | }
|
12561 | }
|
12562 | }, isExpandingNeeded ? 150 : 0);
|
12563 | }
|
12564 | }
|
12565 | isValidTopId(id) {
|
12566 | return id.startsWith('overview') || id === 'servers' || id === 'auth';
|
12567 | }
|
12568 | isValidPathId(id) {
|
12569 | var _this$resolvedSpec2;
|
12570 | if (id === 'overview' && this.showInfo) {
|
12571 | return true;
|
12572 | }
|
12573 | if (id === 'servers' && this.allowServerSelection) {
|
12574 | return true;
|
12575 | }
|
12576 | if (id === 'auth' && this.allowAuthentication) {
|
12577 | return true;
|
12578 | }
|
12579 | if (id.startsWith('tag--')) {
|
12580 | var _this$resolvedSpec;
|
12581 | return (_this$resolvedSpec = this.resolvedSpec) === null || _this$resolvedSpec === void 0 || (_this$resolvedSpec = _this$resolvedSpec.tags) === null || _this$resolvedSpec === void 0 ? void 0 : _this$resolvedSpec.find(tag => tag.elementId === id);
|
12582 | }
|
12583 | return (_this$resolvedSpec2 = this.resolvedSpec) === null || _this$resolvedSpec2 === void 0 || (_this$resolvedSpec2 = _this$resolvedSpec2.tags) === null || _this$resolvedSpec2 === void 0 ? void 0 : _this$resolvedSpec2.find(tag => tag.paths.find(path => path.elementId === id));
|
12584 | }
|
12585 | onIntersect(entries) {
|
12586 | if (this.isIntersectionObserverActive === false) {
|
12587 | return;
|
12588 | }
|
12589 | entries.forEach(entry => {
|
12590 | if (entry.isIntersecting && entry.intersectionRatio > 0) {
|
12591 | const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');
|
12592 | const newNavEl = this.shadowRoot.getElementById(`link-${entry.target.id}`);
|
12593 |
|
12594 |
|
12595 | if (newNavEl) {
|
12596 | if (this.updateRoute === 'true') {
|
12597 | this.replaceHistoryState(entry.target.id);
|
12598 | }
|
12599 | newNavEl.scrollIntoView({
|
12600 | behavior: this.scrollBehavior,
|
12601 | block: 'center'
|
12602 | });
|
12603 | newNavEl.classList.add('active');
|
12604 | newNavEl.part.add('section-navbar-active-item');
|
12605 | }
|
12606 |
|
12607 |
|
12608 |
|
12609 | if (oldNavEl && oldNavEl !== newNavEl) {
|
12610 | oldNavEl.classList.remove('active');
|
12611 | oldNavEl.part.remove('section-navbar-active-item');
|
12612 | }
|
12613 | }
|
12614 | });
|
12615 | }
|
12616 |
|
12617 |
|
12618 | handleHref(e) {
|
12619 | if (e.target.tagName.toLowerCase() === 'a') {
|
12620 | if (e.target.getAttribute('href').startsWith('#')) {
|
12621 | const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
12622 | if (gotoEl) {
|
12623 | gotoEl.scrollIntoView({
|
12624 | behavior: this.scrollBehavior,
|
12625 | block: 'start'
|
12626 | });
|
12627 | }
|
12628 | }
|
12629 | }
|
12630 | }
|
12631 |
|
12632 | |
12633 |
|
12634 |
|
12635 |
|
12636 |
|
12637 |
|
12638 |
|
12639 |
|
12640 |
|
12641 |
|
12642 |
|
12643 | async scrollToEventTarget(event, scrollNavItemToView = true) {
|
12644 | if (!(event.type === 'click' || event.type === 'keyup' && event.keyCode === 13)) {
|
12645 | return;
|
12646 | }
|
12647 | const navEl = event.target;
|
12648 | if (!navEl.dataset.contentId) {
|
12649 | return;
|
12650 | }
|
12651 | this.isIntersectionObserverActive = false;
|
12652 | if (this.renderStyle === 'focused') {
|
12653 | const requestEl = this.shadowRoot.querySelector('api-request');
|
12654 | if (requestEl) {
|
12655 | requestEl.beforeNavigationFocusedMode();
|
12656 | }
|
12657 | }
|
12658 | this.scrollToPath(navEl.dataset.contentId, true, scrollNavItemToView);
|
12659 | setTimeout(() => {
|
12660 | this.isIntersectionObserverActive = true;
|
12661 | }, 300);
|
12662 | }
|
12663 |
|
12664 |
|
12665 | async scrollToPath(elementId, expandPath = true, scrollNavItemToView = true) {
|
12666 | if (this.renderStyle === 'focused') {
|
12667 |
|
12668 |
|
12669 | this.focusedElementId = elementId;
|
12670 | await sleep(0);
|
12671 | }
|
12672 | if (this.renderStyle === 'view') {
|
12673 | this.expandAndGotoOperation(elementId, expandPath, true);
|
12674 | } else {
|
12675 | let isValidElementId = false;
|
12676 | const contentEl = this.shadowRoot.getElementById(elementId);
|
12677 | if (contentEl) {
|
12678 | isValidElementId = true;
|
12679 | contentEl.scrollIntoView({
|
12680 | behavior: this.scrollBehavior,
|
12681 | block: 'start'
|
12682 | });
|
12683 | } else {
|
12684 | isValidElementId = false;
|
12685 | }
|
12686 | if (isValidElementId) {
|
12687 |
|
12688 | if (this.renderStyle === 'focused') {
|
12689 | const requestEl = this.shadowRoot.querySelector('api-request');
|
12690 | if (requestEl) {
|
12691 | requestEl.afterNavigationFocusedMode();
|
12692 | }
|
12693 | const responseEl = this.shadowRoot.querySelector('api-response');
|
12694 | if (responseEl) {
|
12695 | responseEl.resetSelection();
|
12696 | }
|
12697 | }
|
12698 |
|
12699 |
|
12700 | if (this.updateRoute === 'true') {
|
12701 | this.replaceHistoryState(elementId);
|
12702 | }
|
12703 |
|
12704 |
|
12705 | const newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
12706 | if (newNavEl) {
|
12707 | if (scrollNavItemToView) {
|
12708 | newNavEl.scrollIntoView({
|
12709 | behavior: this.scrollBehavior,
|
12710 | block: 'center'
|
12711 | });
|
12712 | }
|
12713 | await sleep(0);
|
12714 | const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');
|
12715 | if (oldNavEl) {
|
12716 | oldNavEl.classList.remove('active');
|
12717 | oldNavEl.part.remove('active');
|
12718 | oldNavEl.part.remove('section-navbar-active-item');
|
12719 | }
|
12720 | newNavEl.classList.add('active');
|
12721 | newNavEl.part.add('section-navbar-active-item');
|
12722 |
|
12723 | }
|
12724 | }
|
12725 | }
|
12726 | }
|
12727 |
|
12728 |
|
12729 | setHttpUserNameAndPassword(securitySchemeId, username, password) {
|
12730 | return applyApiKey.call(this, securitySchemeId, username, password);
|
12731 | }
|
12732 |
|
12733 |
|
12734 | setApiKey(securitySchemeId, apiKeyValue) {
|
12735 | return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
|
12736 | }
|
12737 |
|
12738 |
|
12739 | removeAllSecurityKeys() {
|
12740 | return onClearAllApiKeys.call(this);
|
12741 | }
|
12742 |
|
12743 |
|
12744 | setApiServer(apiServerUrl) {
|
12745 |
|
12746 | return setApiServer.call(this, apiServerUrl);
|
12747 | }
|
12748 |
|
12749 |
|
12750 | onAdvancedSearch(ev, delay) {
|
12751 | const eventTargetEl = ev.target;
|
12752 | clearTimeout(this.timeoutId);
|
12753 | this.timeoutId = setTimeout(() => {
|
12754 | let searchInputEl;
|
12755 | if (eventTargetEl.type === 'text') {
|
12756 | searchInputEl = eventTargetEl;
|
12757 | } else {
|
12758 | searchInputEl = eventTargetEl.closest('.advanced-search-options').querySelector('input[type=text]');
|
12759 | }
|
12760 | const searchOptions = [...eventTargetEl.closest('.advanced-search-options').querySelectorAll('input:checked')].map(v => v.id);
|
12761 | this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags, searchOptions);
|
12762 | }, delay);
|
12763 | }
|
12764 | }
|
12765 | customElements.define('rapi-doc', RapiDoc);
|
12766 | ;
|
12767 |
|
12768 |
|
12769 |
|
12770 |
|
12771 |
|
12772 |
|
12773 |
|
12774 |
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 |
|
12785 |
|
12786 |
|
12787 |
|
12788 |
|
12789 |
|
12790 |
|
12791 |
|
12792 |
|
12793 |
|
12794 |
|
12795 | class RapiDocMini extends lit_element_h {
|
12796 | constructor() {
|
12797 | super();
|
12798 | this.isMini = true;
|
12799 | this.updateRoute = 'false';
|
12800 | this.renderStyle = 'view';
|
12801 | this.showHeader = 'false';
|
12802 | this.allowAdvancedSearch = 'false';
|
12803 | }
|
12804 | static get properties() {
|
12805 | return {
|
12806 |
|
12807 | specUrl: {
|
12808 | type: String,
|
12809 | attribute: 'spec-url'
|
12810 | },
|
12811 | sortEndpointsBy: {
|
12812 | type: String,
|
12813 | attribute: 'sort-endpoints-by'
|
12814 | },
|
12815 |
|
12816 | layout: {
|
12817 | type: String
|
12818 | },
|
12819 | pathsExpanded: {
|
12820 | type: String,
|
12821 | attribute: 'paths-expanded'
|
12822 | },
|
12823 | defaultSchemaTab: {
|
12824 | type: String,
|
12825 | attribute: 'default-schema-tab'
|
12826 | },
|
12827 | responseAreaHeight: {
|
12828 | type: String,
|
12829 | attribute: 'response-area-height'
|
12830 | },
|
12831 | showSummaryWhenCollapsed: {
|
12832 | type: String,
|
12833 | attribute: 'show-summary-when-collapsed'
|
12834 | },
|
12835 | fillRequestFieldsWithExample: {
|
12836 | type: String,
|
12837 | attribute: 'fill-request-fields-with-example'
|
12838 | },
|
12839 | persistAuth: {
|
12840 | type: String,
|
12841 | attribute: 'persist-auth'
|
12842 | },
|
12843 |
|
12844 | schemaStyle: {
|
12845 | type: String,
|
12846 | attribute: 'schema-style'
|
12847 | },
|
12848 | schemaExpandLevel: {
|
12849 | type: Number,
|
12850 | attribute: 'schema-expand-level'
|
12851 | },
|
12852 | schemaDescriptionExpanded: {
|
12853 | type: String,
|
12854 | attribute: 'schema-description-expanded'
|
12855 | },
|
12856 |
|
12857 | apiKeyName: {
|
12858 | type: String,
|
12859 | attribute: 'api-key-name'
|
12860 | },
|
12861 | apiKeyLocation: {
|
12862 | type: String,
|
12863 | attribute: 'api-key-location'
|
12864 | },
|
12865 | apiKeyValue: {
|
12866 | type: String,
|
12867 | attribute: 'api-key-value'
|
12868 | },
|
12869 | defaultApiServerUrl: {
|
12870 | type: String,
|
12871 | attribute: 'default-api-server'
|
12872 | },
|
12873 | serverUrl: {
|
12874 | type: String,
|
12875 | attribute: 'server-url'
|
12876 | },
|
12877 | oauthReceiver: {
|
12878 | type: String,
|
12879 | attribute: 'oauth-receiver'
|
12880 | },
|
12881 | allowTry: {
|
12882 | type: String,
|
12883 | attribute: 'allow-try'
|
12884 | },
|
12885 | showCurlBeforeTry: {
|
12886 | type: String,
|
12887 | attribute: 'show-curl-before-try'
|
12888 | },
|
12889 |
|
12890 | theme: {
|
12891 | type: String
|
12892 | },
|
12893 | bgColor: {
|
12894 | type: String,
|
12895 | attribute: 'bg-color'
|
12896 | },
|
12897 | textColor: {
|
12898 | type: String,
|
12899 | attribute: 'text-color'
|
12900 | },
|
12901 | primaryColor: {
|
12902 | type: String,
|
12903 | attribute: 'primary-color'
|
12904 | },
|
12905 | fontSize: {
|
12906 | type: String,
|
12907 | attribute: 'font-size'
|
12908 | },
|
12909 | regularFont: {
|
12910 | type: String,
|
12911 | attribute: 'regular-font'
|
12912 | },
|
12913 | monoFont: {
|
12914 | type: String,
|
12915 | attribute: 'mono-font'
|
12916 | },
|
12917 | loadFonts: {
|
12918 | type: String,
|
12919 | attribute: 'load-fonts'
|
12920 | },
|
12921 |
|
12922 | fetchCredentials: {
|
12923 | type: String,
|
12924 | attribute: 'fetch-credentials'
|
12925 | },
|
12926 |
|
12927 | matchPaths: {
|
12928 | type: String,
|
12929 | attribute: 'match-paths'
|
12930 | },
|
12931 | matchType: {
|
12932 | type: String,
|
12933 | attribute: 'match-type'
|
12934 | },
|
12935 | removeEndpointsWithBadgeLabelAs: {
|
12936 | type: String,
|
12937 | attribute: 'remove-endpoints-with-badge-label-as'
|
12938 | },
|
12939 |
|
12940 | loading: {
|
12941 | type: Boolean
|
12942 | }
|
12943 | };
|
12944 | }
|
12945 | static get styles() {
|
12946 | return [font_styles, input_styles, flex_styles, table_styles, endpoint_styles, prism_styles, tab_styles, nav_styles, info_styles, i`
|
12947 | :host {
|
12948 | all: initial;
|
12949 | display:flex;
|
12950 | flex-direction: column;
|
12951 | min-width:360px;
|
12952 | width:100%;
|
12953 | height:100%;
|
12954 | margin:0;
|
12955 | padding:0;
|
12956 | overflow: hidden;
|
12957 | letter-spacing:normal;
|
12958 | color:var(--fg);
|
12959 | background-color:var(--bg);
|
12960 | font-family:var(--font-regular);
|
12961 | container-type: inline-size;
|
12962 | }
|
12963 |
|
12964 | @container (min-width: 768px) {
|
12965 | .only-large-screen {
|
12966 | display:block;
|
12967 | }
|
12968 | .only-large-screen-flex {
|
12969 | display:flex;
|
12970 | }
|
12971 | }`];
|
12972 | }
|
12973 |
|
12974 |
|
12975 | connectedCallback() {
|
12976 | super.connectedCallback();
|
12977 | if (this.loadFonts !== 'false') {
|
12978 | const fontDescriptor = {
|
12979 | family: 'Open Sans',
|
12980 | style: 'normal',
|
12981 | weight: '300',
|
12982 | unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD'
|
12983 | };
|
12984 | const fontWeight300 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
12985 | fontDescriptor.weight = '600';
|
12986 | const fontWeight600 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
12987 | fontWeight300.load().then(font => {
|
12988 | document.fonts.add(font);
|
12989 | });
|
12990 | fontWeight600.load().then(font => {
|
12991 | document.fonts.add(font);
|
12992 | });
|
12993 | }
|
12994 | if (!this.showSummaryWhenCollapsed || !'true, false,'.includes(`${this.showSummaryWhenCollapsed},`)) {
|
12995 | this.showSummaryWhenCollapsed = 'true';
|
12996 | }
|
12997 | if (!this.layout || !'row, column,'.includes(`${this.layout},`)) {
|
12998 | this.layout = 'row';
|
12999 | }
|
13000 | if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) {
|
13001 | this.schemaStyle = 'tree';
|
13002 | }
|
13003 | if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
13004 | this.theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
13005 | }
|
13006 | if (!this.defaultSchemaTab || !'example, schema, model,'.includes(`${this.defaultSchemaTab},`)) {
|
13007 | this.defaultSchemaTab = 'example';
|
13008 | } else if (this.defaultSchemaTab === 'model') {
|
13009 | this.defaultSchemaTab = 'schema';
|
13010 | }
|
13011 | this.pathsExpanded = this.pathsExpanded === 'true';
|
13012 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
13013 | this.schemaExpandLevel = 99999;
|
13014 | }
|
13015 | if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) {
|
13016 | this.schemaDescriptionExpanded = 'false';
|
13017 | }
|
13018 | if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) {
|
13019 | this.fillRequestFieldsWithExample = 'true';
|
13020 | }
|
13021 | if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) {
|
13022 | this.persistAuth = 'false';
|
13023 | }
|
13024 | if (!this.responseAreaHeight) {
|
13025 | this.responseAreaHeight = '300px';
|
13026 | }
|
13027 | if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) {
|
13028 | this.allowTry = 'true';
|
13029 | }
|
13030 | if (!this.apiKeyValue) {
|
13031 | this.apiKeyValue = '-';
|
13032 | }
|
13033 | if (!this.apiKeyLocation) {
|
13034 | this.apiKeyLocation = 'header';
|
13035 | }
|
13036 | if (!this.apiKeyName) {
|
13037 | this.apiKeyName = '';
|
13038 | }
|
13039 | if (!this.oauthReceiver) {
|
13040 | this.oauthReceiver = 'oauth-receiver.html';
|
13041 | }
|
13042 | if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) {
|
13043 | this.sortTags = 'false';
|
13044 | }
|
13045 | if (!this.sortEndpointsBy || !'method, path, summary,'.includes(`${this.sortEndpointsBy},`)) {
|
13046 | this.sortEndpointsBy = 'path';
|
13047 | }
|
13048 | if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) {
|
13049 | this.fontSize = 'default';
|
13050 | }
|
13051 | if (!this.matchType || !'includes regex'.includes(this.matchType)) {
|
13052 | this.matchType = 'includes';
|
13053 | }
|
13054 | if (!this.matchPaths) {
|
13055 | this.matchPaths = '';
|
13056 | }
|
13057 | if (!this.removeEndpointsWithBadgeLabelAs) {
|
13058 | this.removeEndpointsWithBadgeLabelAs = '';
|
13059 | }
|
13060 | if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) {
|
13061 | this.allowSchemaDescriptionExpandToggle = 'true';
|
13062 | }
|
13063 | if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) {
|
13064 | this.fetchCredentials = '';
|
13065 | }
|
13066 | marked.setOptions({
|
13067 | highlight: (code, lang) => {
|
13068 | if ((prism_default()).languages[lang]) {
|
13069 | return prism_default().highlight(code, (prism_default()).languages[lang], lang);
|
13070 | }
|
13071 | return code;
|
13072 | }
|
13073 | });
|
13074 | }
|
13075 | render() {
|
13076 | return mainBodyTemplate.call(this, true, this.pathsExpanded);
|
13077 | }
|
13078 | attributeChangedCallback(name, oldVal, newVal) {
|
13079 | if (name === 'spec-url') {
|
13080 | if (oldVal !== newVal) {
|
13081 |
|
13082 | window.setTimeout(async () => {
|
13083 | await this.loadSpec(newVal);
|
13084 | }, 0);
|
13085 | }
|
13086 | }
|
13087 | if (name === 'match-paths' || name === 'match-type' || name === 'remove-endpoints-with-badge-label-as') {
|
13088 | if (oldVal !== newVal) {
|
13089 | window.setTimeout(async () => {
|
13090 | await this.loadSpec(this.specUrl);
|
13091 | }, 0);
|
13092 | }
|
13093 | }
|
13094 | if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {
|
13095 | let updateSelectedApiKey = false;
|
13096 | let apiKeyName = '';
|
13097 | let apiKeyLocation = '';
|
13098 | let apiKeyValue = '';
|
13099 | if (name === 'api-key-name') {
|
13100 | if (this.getAttribute('api-key-location') && this.getAttribute('api-key-value')) {
|
13101 | apiKeyName = newVal;
|
13102 | apiKeyLocation = this.getAttribute('api-key-location');
|
13103 | apiKeyValue = this.getAttribute('api-key-value');
|
13104 | updateSelectedApiKey = true;
|
13105 | }
|
13106 | } else if (name === 'api-key-location') {
|
13107 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-value')) {
|
13108 | apiKeyLocation = newVal;
|
13109 | apiKeyName = this.getAttribute('api-key-name');
|
13110 | apiKeyValue = this.getAttribute('api-key-value');
|
13111 | updateSelectedApiKey = true;
|
13112 | }
|
13113 | } else if (name === 'api-key-value') {
|
13114 | if (this.getAttribute('api-key-name') && this.getAttribute('api-key-location')) {
|
13115 | apiKeyValue = newVal;
|
13116 | apiKeyLocation = this.getAttribute('api-key-location');
|
13117 | apiKeyName = this.getAttribute('api-key-name');
|
13118 | updateSelectedApiKey = true;
|
13119 | }
|
13120 | }
|
13121 | if (updateSelectedApiKey) {
|
13122 | if (this.resolvedSpec) {
|
13123 | const rapiDocApiKey = this.resolvedSpec.securitySchemes.find(v => v.securitySchemeId === rapidocApiKey);
|
13124 | if (!rapiDocApiKey) {
|
13125 | this.resolvedSpec.securitySchemes.push({
|
13126 | apiKeyId: rapidocApiKey,
|
13127 | description: 'api-key provided in rapidoc element attributes',
|
13128 | type: 'apiKey',
|
13129 | name: apiKeyName,
|
13130 | in: apiKeyLocation,
|
13131 | value: apiKeyValue,
|
13132 | finalKeyValue: apiKeyValue
|
13133 | });
|
13134 | } else {
|
13135 | rapiDocApiKey.name = apiKeyName;
|
13136 | rapiDocApiKey.in = apiKeyLocation;
|
13137 | rapiDocApiKey.value = apiKeyValue;
|
13138 | rapiDocApiKey.finalKeyValue = apiKeyValue;
|
13139 | }
|
13140 | this.requestUpdate();
|
13141 | }
|
13142 | }
|
13143 | }
|
13144 | super.attributeChangedCallback(name, oldVal, newVal);
|
13145 | }
|
13146 | onSpecUrlChange() {
|
13147 | this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
13148 | }
|
13149 |
|
13150 |
|
13151 | async loadSpec(specUrl) {
|
13152 | if (!specUrl) {
|
13153 | return;
|
13154 | }
|
13155 | try {
|
13156 | this.resolvedSpec = {
|
13157 | specLoadError: false,
|
13158 | isSpecLoading: true,
|
13159 | tags: []
|
13160 | };
|
13161 | this.loading = true;
|
13162 | this.loadFailed = false;
|
13163 | this.requestUpdate();
|
13164 | const spec = await ProcessSpec.call(this, specUrl, this.generateMissingTags === 'true', this.sortTags === 'true', this.sortSchemas === 'true', this.getAttribute('sort-endpoints-by'), this.getAttribute('api-key-name'), this.getAttribute('api-key-location'), this.getAttribute('api-key-value'), this.getAttribute('server-url'), this.matchPaths, this.matchType, this.removeEndpointsWithBadgeLabelAs);
|
13165 | this.loading = false;
|
13166 | this.afterSpecParsedAndValidated(spec);
|
13167 | } catch (err) {
|
13168 | this.loading = false;
|
13169 | this.loadFailed = true;
|
13170 | this.resolvedSpec = null;
|
13171 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`);
|
13172 | }
|
13173 | }
|
13174 |
|
13175 |
|
13176 | setHttpUserNameAndPassword(securitySchemeId, username, password) {
|
13177 | return applyApiKey.call(this, securitySchemeId, username, password);
|
13178 | }
|
13179 |
|
13180 |
|
13181 | setApiKey(securitySchemeId, apiKeyValue) {
|
13182 | return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
|
13183 | }
|
13184 |
|
13185 |
|
13186 | removeAllSecurityKeys() {
|
13187 | return onClearAllApiKeys.call(this);
|
13188 | }
|
13189 |
|
13190 |
|
13191 | setApiServer(apiServerUrl) {
|
13192 |
|
13193 | return setApiServer.call(this, apiServerUrl);
|
13194 | }
|
13195 | async afterSpecParsedAndValidated(spec) {
|
13196 | this.resolvedSpec = spec;
|
13197 | this.selectedServer = undefined;
|
13198 | if (this.defaultApiServerUrl) {
|
13199 | if (this.defaultApiServerUrl === this.serverUrl) {
|
13200 | this.selectedServer = {
|
13201 | url: this.serverUrl,
|
13202 | computedUrl: this.serverUrl
|
13203 | };
|
13204 | } else if (this.resolvedSpec.servers) {
|
13205 | this.selectedServer = this.resolvedSpec.servers.find(v => v.url === this.defaultApiServerUrl);
|
13206 | }
|
13207 | }
|
13208 | if (!this.selectedServer) {
|
13209 | if (this.resolvedSpec.servers) {
|
13210 | this.selectedServer = this.resolvedSpec.servers[0];
|
13211 | }
|
13212 | }
|
13213 | this.requestUpdate();
|
13214 |
|
13215 | while (!(await this.updateComplete));
|
13216 | const specLoadedEvent = new CustomEvent('spec-loaded', {
|
13217 | detail: spec
|
13218 | });
|
13219 | this.dispatchEvent(specLoadedEvent);
|
13220 | }
|
13221 |
|
13222 |
|
13223 | handleHref(e) {
|
13224 | if (e.target.tagName.toLowerCase() === 'a') {
|
13225 | if (e.target.getAttribute('href').startsWith('#')) {
|
13226 | const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
13227 | if (gotoEl) {
|
13228 | gotoEl.scrollIntoView({
|
13229 | behavior: 'auto',
|
13230 | block: 'start'
|
13231 | });
|
13232 | }
|
13233 | }
|
13234 | }
|
13235 | }
|
13236 | }
|
13237 | customElements.define('rapi-doc-mini', RapiDocMini);
|
13238 | ;
|
13239 | class OauthReceiver extends HTMLElement {
|
13240 | connectedCallback() {
|
13241 | this.receiveAuthParms();
|
13242 | window.addEventListener('storage', e => this.receiveStorage(e), true);
|
13243 | }
|
13244 |
|
13245 | |
13246 |
|
13247 |
|
13248 |
|
13249 | receiveAuthParms() {
|
13250 | let authData = {};
|
13251 | if (document.location.search) {
|
13252 |
|
13253 | const params = new URLSearchParams(document.location.search);
|
13254 | const code = params.get('code');
|
13255 | const error = params.get('error');
|
13256 | const state = params.get('state');
|
13257 | authData = {
|
13258 | code,
|
13259 | error,
|
13260 | state,
|
13261 | responseType: 'code'
|
13262 | };
|
13263 | } else if (window.location.hash) {
|
13264 |
|
13265 | const token_type = this.parseQueryString(window.location.hash.substring(1), 'token_type');
|
13266 | const access_token = this.parseQueryString(window.location.hash.substring(1), 'access_token');
|
13267 | authData = {
|
13268 | token_type,
|
13269 | access_token,
|
13270 | responseType: 'token'
|
13271 | };
|
13272 | }
|
13273 | if (window.opener) {
|
13274 | window.opener.postMessage(authData, this.target);
|
13275 | return;
|
13276 | }
|
13277 | sessionStorage.setItem('rapidoc-oauth-data', JSON.stringify(authData));
|
13278 | }
|
13279 | relayAuthParams(e) {
|
13280 | if (window.parent) {
|
13281 | if (e.key === 'rapidoc-oauth-data') {
|
13282 | const authData = JSON.parse(e.newValue);
|
13283 | window.parent.postMessage(authData, this.target);
|
13284 | }
|
13285 | }
|
13286 | }
|
13287 | parseQueryString(queryString, key) {
|
13288 | const vars = queryString.split('&');
|
13289 | for (let i = 0; i < vars.length; i++) {
|
13290 | const pair = vars[i].split('=');
|
13291 | if (decodeURIComponent(pair[0]) === key) {
|
13292 | return decodeURIComponent(pair[1]);
|
13293 | }
|
13294 | }
|
13295 | }
|
13296 | }
|
13297 | customElements.define('oauth-receiver', OauthReceiver);
|
13298 | ;
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 |
|
13306 |
|
13307 |
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 | function jsonSchemaNavTemplate() {
|
13315 | return ke`
|
13316 | <nav class='nav-bar' part="section-navbar">
|
13317 | <slot name="nav-logo" class="logo"></slot>
|
13318 | <div style="display:flex;line-height:22px; padding:8px">
|
13319 | <input id="nav-bar-search"
|
13320 | part = "textbox textbox-nav-filter"
|
13321 | style = "width:100%; height: 26px; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)"
|
13322 | type = "text"
|
13323 | placeholder = "Filter"
|
13324 | @change = "${this.onSearchChange}"
|
13325 | spellcheck = "false"
|
13326 | >
|
13327 | <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
13328 | </div>
|
13329 | <nav style="flex:1" class='nav-scroll' part="section-navbar-scroll">
|
13330 | ${this.resolvedSpec.schemaAndExamples.map(v => ke`
|
13331 | <div class='nav-bar-path' data-content-id='${v.elementId}' id='link-${v.elementId}'
|
13332 | @click = '${e => {
|
13333 | this.scrollToEventTarget(e, false);
|
13334 | }}'
|
13335 | >
|
13336 | ${v.name}
|
13337 | </div>`)}
|
13338 | </nav>
|
13339 | </nav>
|
13340 | `;
|
13341 | }
|
13342 |
|
13343 |
|
13344 | function jsonSchemaBodyTemplate() {
|
13345 | return ke`
|
13346 | ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
13347 | <div style="font-size:var(--font-size-regular);">
|
13348 | ${this.resolvedSpec.schemaAndExamples.map(jSchemaBody => {
|
13349 | var _examplesObj$;
|
13350 | const examplesObj = generateExample(jSchemaBody.schema, 'json', standardizeExample(jSchemaBody.examples), standardizeExample(jSchemaBody.example), true, false, 'json', true);
|
13351 | jSchemaBody.selectedExample = (_examplesObj$ = examplesObj[0]) === null || _examplesObj$ === void 0 ? void 0 : _examplesObj$.exampleId;
|
13352 | return ke`
|
13353 | <section id='${jSchemaBody.elementId}' class='json-schema-and-example regular-font' style="display:flex; flex-direction: column; border:1px solid var(--border-color); margin-bottom:32px; border-top: 5px solid var(--border-color)">
|
13354 | <div style="padding:16px; border-bottom: 1px solid var(--border-color)">
|
13355 | <div style="font-size:var(--font-size-small); font-weight:bold">${jSchemaBody.name}</div>
|
13356 | <span class="json-schema-description m-markdown ">${unsafe_html_ae(marked(jSchemaBody.description || ''))}</span>
|
13357 | </div>
|
13358 | <div style="display:flex; flex-direction: row; gap:16px;">
|
13359 | <div class="json-schema-def" style="flex:1; padding:16px 0 16px 16px; ">
|
13360 | <schema-tree
|
13361 | .data = "${schemaInObjectNotation(jSchemaBody.schema, {})}"
|
13362 | schema-expand-level = "${this.schemaExpandLevel}"
|
13363 | schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
13364 | allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
13365 | schema-hide-read-only = "false"
|
13366 | schema-hide-write-only = "false"
|
13367 | > </schema-tree>
|
13368 | </div>
|
13369 | <div class="json-schema-example-panel" style="width:400px; background-color: var(--input-bg); padding:16px 0 16px 16px; border-left: 1px dashed var(--border-color);">
|
13370 | ${examplesObj.length > 1 ? ke`<select style="min-width:100px; max-width:100%" @change='${e => this.onSelectExample(e, jSchemaBody)}'>
|
13371 | ${examplesObj.map(v => ke`
|
13372 | <option value="${v.exampleId}" ?selected=${v.exampleId === jSchemaBody.selectedExample}>
|
13373 | ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary}
|
13374 | </option>`)}
|
13375 | </select>` : ke`<div style="font-size: var(--font-size-small);font-weight:700; margin:5px 0"> ${examplesObj[0].exampleSummary}</div>`}
|
13376 | ${examplesObj.map(v => ke`
|
13377 | <json-tree
|
13378 | .data = "${v.exampleValue}"
|
13379 | data-example = "${v.exampleId}"
|
13380 | class = "example"
|
13381 | style = "margin-top:16px; display: ${v.exampleId === jSchemaBody.selectedExample ? 'flex' : 'none'}"
|
13382 | ></json-tree>`)}
|
13383 | </div>
|
13384 | </div>
|
13385 | </section>`;
|
13386 | })}
|
13387 | </div>
|
13388 | `;
|
13389 | }
|
13390 |
|
13391 |
|
13392 |
|
13393 | function jsonSchemaViewerTemplate(isMini = false) {
|
13394 |
|
13395 | if (!this.resolvedSpec) {
|
13396 | return '';
|
13397 | }
|
13398 | const newTheme = {
|
13399 | bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
|
13400 | fg1: isValidHexColor(this.textColor) ? this.textColor : '',
|
13401 | headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',
|
13402 | primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',
|
13403 | navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',
|
13404 | navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',
|
13405 | navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
13406 | navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
13407 | navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
13408 | navAccenttextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : ''
|
13409 | };
|
13410 |
|
13411 | if (this.resolvedSpec.specLoadError) {
|
13412 | if (isMini) {
|
13413 | return ke`
|
13414 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
13415 | <div style="display:flex; align-items:center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
|
13416 | `;
|
13417 | }
|
13418 | return ke`
|
13419 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
13420 | <!-- Header -->
|
13421 | ${headerTemplate.call(this)}
|
13422 | <h1> Header </h1>
|
13423 | <main class="main-content regular-font" part="section-main-content">
|
13424 | <slot></slot>
|
13425 | <div style="margin:24px; text-align: center;">
|
13426 | <h1 style="color: var(--red)"> ${this.resolvedSpec.info.title} </h1>
|
13427 | <div style="font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
|
13428 | </div>
|
13429 | </main>
|
13430 | `;
|
13431 | }
|
13432 | if (this.resolvedSpec.isSpecLoading) {
|
13433 | return ke`
|
13434 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
13435 | <main class="main-content regular-font" part="section-main-content">
|
13436 | <slot></slot>
|
13437 | <div class="main-content-inner--${this.renderStyle}-mode">
|
13438 | <div class="loader"></div>
|
13439 | </div>
|
13440 | </main>
|
13441 | `;
|
13442 | }
|
13443 | return ke`
|
13444 | ${this.theme === 'dark' ? setTheme.call(this, 'dark', newTheme) : setTheme.call(this, 'light', newTheme)}
|
13445 |
|
13446 | <!-- Header -->
|
13447 | ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
|
13448 |
|
13449 | <div id='the-main-body' class="body ${this.cssClasses}" dir= ${this.pageDirection}>
|
13450 |
|
13451 | <!-- Side Nav -->
|
13452 | ${jsonSchemaNavTemplate.call(this)}
|
13453 |
|
13454 | <!-- Main Content -->
|
13455 | <main class="main-content regular-font" part="section-main-content">
|
13456 | <slot></slot>
|
13457 | <div class="main-content-inner--${this.renderStyle}-mode">
|
13458 | ${this.loading === true ? ke`<div class="loader"></div>` : ke`
|
13459 | ${this.loadFailed === true ? ke`<div style="text-align: center;margin: 16px;"> Unable to load the Spec</div>` : ke`
|
13460 | <div class="operations-root" @click="${e => {
|
13461 | this.handleHref(e);
|
13462 | }}">
|
13463 | ${jsonSchemaBodyTemplate.call(this)}
|
13464 | </div>
|
13465 | `}`}
|
13466 | </div>
|
13467 | <slot name="footer"></slot>
|
13468 | </main>
|
13469 | </div>
|
13470 | `;
|
13471 | }
|
13472 |
|
13473 | ;
|
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 |
|
13484 |
|
13485 |
|
13486 |
|
13487 |
|
13488 |
|
13489 |
|
13490 |
|
13491 |
|
13492 |
|
13493 |
|
13494 |
|
13495 |
|
13496 |
|
13497 |
|
13498 |
|
13499 | class JsonSchemaViewer extends lit_element_h {
|
13500 | constructor() {
|
13501 | super();
|
13502 | this.isMini = false;
|
13503 | this.updateRoute = 'false';
|
13504 | this.renderStyle = 'focused';
|
13505 | this.showHeader = 'true';
|
13506 | this.allowAdvancedSearch = 'false';
|
13507 | this.selectedExampleForEachSchema = {};
|
13508 | }
|
13509 | static get properties() {
|
13510 | return {
|
13511 |
|
13512 | specUrl: {
|
13513 | type: String,
|
13514 | attribute: 'spec-url'
|
13515 | },
|
13516 |
|
13517 | schemaStyle: {
|
13518 | type: String,
|
13519 | attribute: 'schema-style'
|
13520 | },
|
13521 | schemaExpandLevel: {
|
13522 | type: Number,
|
13523 | attribute: 'schema-expand-level'
|
13524 | },
|
13525 | schemaDescriptionExpanded: {
|
13526 | type: String,
|
13527 | attribute: 'schema-description-expanded'
|
13528 | },
|
13529 | allowSchemaDescriptionExpandToggle: {
|
13530 | type: String,
|
13531 | attribute: 'allow-schema-description-expand-toggle'
|
13532 | },
|
13533 |
|
13534 | showHeader: {
|
13535 | type: String,
|
13536 | attribute: 'show-header'
|
13537 | },
|
13538 | showSideNav: {
|
13539 | type: String,
|
13540 | attribute: 'show-side-nav'
|
13541 | },
|
13542 | showInfo: {
|
13543 | type: String,
|
13544 | attribute: 'show-info'
|
13545 | },
|
13546 |
|
13547 | allowSpecUrlLoad: {
|
13548 | type: String,
|
13549 | attribute: 'allow-spec-url-load'
|
13550 | },
|
13551 | allowSpecFileLoad: {
|
13552 | type: String,
|
13553 | attribute: 'allow-spec-file-load'
|
13554 | },
|
13555 | allowSpecFileDownload: {
|
13556 | type: String,
|
13557 | attribute: 'allow-spec-file-download'
|
13558 | },
|
13559 | allowSearch: {
|
13560 | type: String,
|
13561 | attribute: 'allow-search'
|
13562 | },
|
13563 |
|
13564 | theme: {
|
13565 | type: String
|
13566 | },
|
13567 | bgColor: {
|
13568 | type: String,
|
13569 | attribute: 'bg-color'
|
13570 | },
|
13571 | textColor: {
|
13572 | type: String,
|
13573 | attribute: 'text-color'
|
13574 | },
|
13575 | primaryColor: {
|
13576 | type: String,
|
13577 | attribute: 'primary-color'
|
13578 | },
|
13579 | fontSize: {
|
13580 | type: String,
|
13581 | attribute: 'font-size'
|
13582 | },
|
13583 | regularFont: {
|
13584 | type: String,
|
13585 | attribute: 'regular-font'
|
13586 | },
|
13587 | monoFont: {
|
13588 | type: String,
|
13589 | attribute: 'mono-font'
|
13590 | },
|
13591 | loadFonts: {
|
13592 | type: String,
|
13593 | attribute: 'load-fonts'
|
13594 | },
|
13595 |
|
13596 | loading: {
|
13597 | type: Boolean
|
13598 | }
|
13599 | };
|
13600 | }
|
13601 | static get styles() {
|
13602 | return [font_styles, input_styles, flex_styles, table_styles, endpoint_styles, prism_styles, tab_styles, nav_styles, info_styles, i`
|
13603 | :host {
|
13604 | all: initial;
|
13605 | display:flex;
|
13606 | flex-direction: column;
|
13607 | min-width:360px;
|
13608 | width:100%;
|
13609 | height:100%;
|
13610 | margin:0;
|
13611 | padding:0;
|
13612 | overflow: hidden;
|
13613 | letter-spacing:normal;
|
13614 | color:var(--fg);
|
13615 | background-color:var(--bg);
|
13616 | font-family:var(--font-regular);
|
13617 | container-type: inline-size;
|
13618 | }
|
13619 | .body {
|
13620 | display:flex;
|
13621 | height:100%;
|
13622 | width:100%;
|
13623 | overflow:hidden;
|
13624 | }
|
13625 | .nav-bar {
|
13626 | width: 230px;
|
13627 | display:flex;
|
13628 | }
|
13629 |
|
13630 | .main-content {
|
13631 | margin:0;
|
13632 | padding: 16px;
|
13633 | display:block;
|
13634 | flex:1;
|
13635 | height:100%;
|
13636 | overflow-y: auto;
|
13637 | overflow-x: hidden;
|
13638 | scrollbar-width: thin;
|
13639 | scrollbar-color: var(--border-color) transparent;
|
13640 | }
|
13641 | .main-content-inner--view-mode {
|
13642 | padding: 0 8px;
|
13643 | }
|
13644 | .main-content::-webkit-scrollbar {
|
13645 | width: 8px;
|
13646 | height: 8px;
|
13647 | }
|
13648 | .main-content::-webkit-scrollbar-track {
|
13649 | background:transparent;
|
13650 | }
|
13651 | .main-content::-webkit-scrollbar-thumb {
|
13652 | background-color: var(--border-color);
|
13653 | }
|
13654 | .main-header {
|
13655 | background-color:var(--header-bg);
|
13656 | color:var(--header-fg);
|
13657 | width:100%;
|
13658 | }
|
13659 | .header-title {
|
13660 | font-size:calc(var(--font-size-regular) + 8px);
|
13661 | padding:0 8px;
|
13662 | }
|
13663 | input.header-input{
|
13664 | background:var(--header-color-darker);
|
13665 | color:var(--header-fg);
|
13666 | border:1px solid var(--header-color-border);
|
13667 | flex:1;
|
13668 | padding-right:24px;
|
13669 | border-radius:3px;
|
13670 | }
|
13671 | input.header-input::placeholder {
|
13672 | opacity:0.4;
|
13673 | }
|
13674 | .loader {
|
13675 | margin: 16px auto 16px auto;
|
13676 | border: 4px solid var(--bg3);
|
13677 | border-radius: 50%;
|
13678 | border-top: 4px solid var(--primary-color);
|
13679 | width: 36px;
|
13680 | height: 36px;
|
13681 | animation: spin 2s linear infinite;
|
13682 | }
|
13683 | @container (min-width: 768px) {
|
13684 | .only-large-screen{
|
13685 | display:block;
|
13686 | }
|
13687 | .only-large-screen-flex {
|
13688 | display:flex;
|
13689 | }
|
13690 | }`];
|
13691 | }
|
13692 |
|
13693 |
|
13694 | connectedCallback() {
|
13695 | super.connectedCallback();
|
13696 | const parent = this.parentElement;
|
13697 | if (parent) {
|
13698 | if (parent.offsetWidth === 0 && parent.style.width === '') {
|
13699 | parent.style.width = '100vw';
|
13700 | }
|
13701 | if (parent.offsetHeight === 0 && parent.style.height === '') {
|
13702 | parent.style.height = '100vh';
|
13703 | }
|
13704 | if (parent.tagName === 'BODY') {
|
13705 | if (!parent.style.marginTop) {
|
13706 | parent.style.marginTop = '0';
|
13707 | }
|
13708 | if (!parent.style.marginRight) {
|
13709 | parent.style.marginRight = '0';
|
13710 | }
|
13711 | if (!parent.style.marginBottom) {
|
13712 | parent.style.marginBottom = '0';
|
13713 | }
|
13714 | if (!parent.style.marginLeft) {
|
13715 | parent.style.marginLeft = '0';
|
13716 | }
|
13717 | }
|
13718 | }
|
13719 | if (this.loadFonts !== 'false') {
|
13720 | const fontDescriptor = {
|
13721 | family: 'Open Sans',
|
13722 | style: 'normal',
|
13723 | weight: '300',
|
13724 | unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD'
|
13725 | };
|
13726 | const fontWeight300 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UN_r8OUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
13727 | fontDescriptor.weight = '600';
|
13728 | const fontWeight600 = new FontFace('Open Sans', "url(https://fonts.gstatic.com/s/opensans/v18/mem5YaGs126MiZpBA-UNirkOUuhpKKSTjw.woff2) format('woff2')", fontDescriptor);
|
13729 | fontWeight300.load().then(font => {
|
13730 | document.fonts.add(font);
|
13731 | });
|
13732 | fontWeight600.load().then(font => {
|
13733 | document.fonts.add(font);
|
13734 | });
|
13735 | }
|
13736 | this.renderStyle = 'focused';
|
13737 | this.pathsExpanded = this.pathsExpanded === 'true';
|
13738 | if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) {
|
13739 | this.showInfo = 'true';
|
13740 | }
|
13741 | if (!this.showSideNav || !'true false'.includes(this.showSideNav)) {
|
13742 | this.showSideNav = 'true';
|
13743 | }
|
13744 | if (!this.showHeader || !'true, false,'.includes(`${this.showHeader},`)) {
|
13745 | this.showHeader = 'true';
|
13746 | }
|
13747 | if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) {
|
13748 | this.schemaStyle = 'tree';
|
13749 | }
|
13750 | if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
13751 | this.theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
13752 | }
|
13753 | if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) {
|
13754 | this.allowSearch = 'true';
|
13755 | }
|
13756 | if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) {
|
13757 | this.schemaExpandLevel = 99999;
|
13758 | }
|
13759 | if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) {
|
13760 | this.schemaDescriptionExpanded = 'false';
|
13761 | }
|
13762 | if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) {
|
13763 | this.fontSize = 'default';
|
13764 | }
|
13765 | if (!this.matchType || !'includes regex'.includes(this.matchType)) {
|
13766 | this.matchType = 'includes';
|
13767 | }
|
13768 | if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) {
|
13769 | this.allowSchemaDescriptionExpandToggle = 'true';
|
13770 | }
|
13771 | marked.setOptions({
|
13772 | highlight: (code, lang) => {
|
13773 | if ((prism_default()).languages[lang]) {
|
13774 | return prism_default().highlight(code, (prism_default()).languages[lang], lang);
|
13775 | }
|
13776 | return code;
|
13777 | }
|
13778 | });
|
13779 | }
|
13780 | render() {
|
13781 | return jsonSchemaViewerTemplate.call(this, true, false, false, this.pathsExpanded);
|
13782 | }
|
13783 | attributeChangedCallback(name, oldVal, newVal) {
|
13784 | if (name === 'spec-url') {
|
13785 | if (oldVal !== newVal) {
|
13786 |
|
13787 | window.setTimeout(async () => {
|
13788 | await this.loadSpec(newVal);
|
13789 | }, 0);
|
13790 | }
|
13791 | }
|
13792 | super.attributeChangedCallback(name, oldVal, newVal);
|
13793 | }
|
13794 | onSpecUrlChange() {
|
13795 | this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
13796 | }
|
13797 | onSearchChange(e) {
|
13798 |
|
13799 | this.matchPaths = e.target.value;
|
13800 | }
|
13801 |
|
13802 |
|
13803 | async loadSpec(specUrl) {
|
13804 | if (!specUrl) {
|
13805 | return;
|
13806 | }
|
13807 | try {
|
13808 | this.resolvedSpec = {
|
13809 | specLoadError: false,
|
13810 | isSpecLoading: true,
|
13811 | tags: []
|
13812 | };
|
13813 | this.loading = true;
|
13814 | this.loadFailed = false;
|
13815 | this.requestUpdate();
|
13816 | const spec = await ProcessSpec.call(this, specUrl, this.generateMissingTags === 'true', this.sortTags === 'true', this.sortSchemas === 'true', this.getAttribute('sort-endpoints-by'), this.getAttribute('match-paths'), this.getAttribute('match-type'), this.getAttribute('remove-endpoints-with-badge-label-as'));
|
13817 | this.loading = false;
|
13818 | this.afterSpecParsedAndValidated(spec);
|
13819 | } catch (err) {
|
13820 | this.loading = false;
|
13821 | this.loadFailed = true;
|
13822 | this.resolvedSpec = null;
|
13823 | console.error(`RapiDoc: Unable to resolve the API spec.. ${err.message}`);
|
13824 | }
|
13825 | }
|
13826 | async afterSpecParsedAndValidated(spec) {
|
13827 | this.resolvedSpec = spec;
|
13828 | const specLoadedEvent = new CustomEvent('spec-loaded', {
|
13829 | detail: spec
|
13830 | });
|
13831 | this.dispatchEvent(specLoadedEvent);
|
13832 | }
|
13833 |
|
13834 |
|
13835 | handleHref(e) {
|
13836 | if (e.target.tagName.toLowerCase() === 'a') {
|
13837 | if (e.target.getAttribute('href').startsWith('#')) {
|
13838 | const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
13839 | if (gotoEl) {
|
13840 | gotoEl.scrollIntoView({
|
13841 | behavior: 'auto',
|
13842 | block: 'start'
|
13843 | });
|
13844 | }
|
13845 | }
|
13846 | }
|
13847 | }
|
13848 |
|
13849 |
|
13850 | onSelectExample(e) {
|
13851 | const exampleContainerEl = e.target.closest('.json-schema-example-panel');
|
13852 | const exampleEls = [...exampleContainerEl.querySelectorAll('.example')];
|
13853 | exampleEls.forEach(v => {
|
13854 | v.style.display = v.dataset.example === e.target.value ? 'flex' : 'none';
|
13855 | });
|
13856 | }
|
13857 | async scrollToEventTarget(event) {
|
13858 | const navEl = event.currentTarget;
|
13859 | if (!navEl.dataset.contentId) {
|
13860 | return;
|
13861 | }
|
13862 | const contentEl = this.shadowRoot.getElementById(navEl.dataset.contentId);
|
13863 | if (contentEl) {
|
13864 | contentEl.scrollIntoView({
|
13865 | behavior: 'auto',
|
13866 | block: 'start'
|
13867 | });
|
13868 | }
|
13869 | }
|
13870 | }
|
13871 | customElements.define('json-schema-viewer', JsonSchemaViewer);
|
13872 | ;
|
13873 |
|
13874 |
|
13875 |
|
13876 |
|
13877 | const src = ({
|
13878 | RapiDoc: RapiDoc
|
13879 | });
|
13880 |
|
13881 |
|
13882 | }),
|
13883 |
|
13884 | 526:
|
13885 | ((__unused_webpack_module, exports) => {
|
13886 |
|
13887 | "use strict";
|
13888 |
|
13889 |
|
13890 | exports.byteLength = byteLength
|
13891 | exports.toByteArray = toByteArray
|
13892 | exports.fromByteArray = fromByteArray
|
13893 |
|
13894 | var lookup = []
|
13895 | var revLookup = []
|
13896 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
13897 |
|
13898 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
13899 | for (var i = 0, len = code.length; i < len; ++i) {
|
13900 | lookup[i] = code[i]
|
13901 | revLookup[code.charCodeAt(i)] = i
|
13902 | }
|
13903 |
|
13904 |
|
13905 |
|
13906 | revLookup['-'.charCodeAt(0)] = 62
|
13907 | revLookup['_'.charCodeAt(0)] = 63
|
13908 |
|
13909 | function getLens (b64) {
|
13910 | var len = b64.length
|
13911 |
|
13912 | if (len % 4 > 0) {
|
13913 | throw new Error('Invalid string. Length must be a multiple of 4')
|
13914 | }
|
13915 |
|
13916 |
|
13917 |
|
13918 | var validLen = b64.indexOf('=')
|
13919 | if (validLen === -1) validLen = len
|
13920 |
|
13921 | var placeHoldersLen = validLen === len
|
13922 | ? 0
|
13923 | : 4 - (validLen % 4)
|
13924 |
|
13925 | return [validLen, placeHoldersLen]
|
13926 | }
|
13927 |
|
13928 |
|
13929 | function byteLength (b64) {
|
13930 | var lens = getLens(b64)
|
13931 | var validLen = lens[0]
|
13932 | var placeHoldersLen = lens[1]
|
13933 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
13934 | }
|
13935 |
|
13936 | function _byteLength (b64, validLen, placeHoldersLen) {
|
13937 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
13938 | }
|
13939 |
|
13940 | function toByteArray (b64) {
|
13941 | var tmp
|
13942 | var lens = getLens(b64)
|
13943 | var validLen = lens[0]
|
13944 | var placeHoldersLen = lens[1]
|
13945 |
|
13946 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
13947 |
|
13948 | var curByte = 0
|
13949 |
|
13950 |
|
13951 | var len = placeHoldersLen > 0
|
13952 | ? validLen - 4
|
13953 | : validLen
|
13954 |
|
13955 | var i
|
13956 | for (i = 0; i < len; i += 4) {
|
13957 | tmp =
|
13958 | (revLookup[b64.charCodeAt(i)] << 18) |
|
13959 | (revLookup[b64.charCodeAt(i + 1)] << 12) |
|
13960 | (revLookup[b64.charCodeAt(i + 2)] << 6) |
|
13961 | revLookup[b64.charCodeAt(i + 3)]
|
13962 | arr[curByte++] = (tmp >> 16) & 0xFF
|
13963 | arr[curByte++] = (tmp >> 8) & 0xFF
|
13964 | arr[curByte++] = tmp & 0xFF
|
13965 | }
|
13966 |
|
13967 | if (placeHoldersLen === 2) {
|
13968 | tmp =
|
13969 | (revLookup[b64.charCodeAt(i)] << 2) |
|
13970 | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
13971 | arr[curByte++] = tmp & 0xFF
|
13972 | }
|
13973 |
|
13974 | if (placeHoldersLen === 1) {
|
13975 | tmp =
|
13976 | (revLookup[b64.charCodeAt(i)] << 10) |
|
13977 | (revLookup[b64.charCodeAt(i + 1)] << 4) |
|
13978 | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
13979 | arr[curByte++] = (tmp >> 8) & 0xFF
|
13980 | arr[curByte++] = tmp & 0xFF
|
13981 | }
|
13982 |
|
13983 | return arr
|
13984 | }
|
13985 |
|
13986 | function tripletToBase64 (num) {
|
13987 | return lookup[num >> 18 & 0x3F] +
|
13988 | lookup[num >> 12 & 0x3F] +
|
13989 | lookup[num >> 6 & 0x3F] +
|
13990 | lookup[num & 0x3F]
|
13991 | }
|
13992 |
|
13993 | function encodeChunk (uint8, start, end) {
|
13994 | var tmp
|
13995 | var output = []
|
13996 | for (var i = start; i < end; i += 3) {
|
13997 | tmp =
|
13998 | ((uint8[i] << 16) & 0xFF0000) +
|
13999 | ((uint8[i + 1] << 8) & 0xFF00) +
|
14000 | (uint8[i + 2] & 0xFF)
|
14001 | output.push(tripletToBase64(tmp))
|
14002 | }
|
14003 | return output.join('')
|
14004 | }
|
14005 |
|
14006 | function fromByteArray (uint8) {
|
14007 | var tmp
|
14008 | var len = uint8.length
|
14009 | var extraBytes = len % 3
|
14010 | var parts = []
|
14011 | var maxChunkLength = 16383
|
14012 |
|
14013 |
|
14014 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
14015 | parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
14016 | }
|
14017 |
|
14018 |
|
14019 | if (extraBytes === 1) {
|
14020 | tmp = uint8[len - 1]
|
14021 | parts.push(
|
14022 | lookup[tmp >> 2] +
|
14023 | lookup[(tmp << 4) & 0x3F] +
|
14024 | '=='
|
14025 | )
|
14026 | } else if (extraBytes === 2) {
|
14027 | tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
14028 | parts.push(
|
14029 | lookup[tmp >> 10] +
|
14030 | lookup[(tmp >> 4) & 0x3F] +
|
14031 | lookup[(tmp << 2) & 0x3F] +
|
14032 | '='
|
14033 | )
|
14034 | }
|
14035 |
|
14036 | return parts.join('')
|
14037 | }
|
14038 |
|
14039 |
|
14040 | }),
|
14041 |
|
14042 | 287:
|
14043 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
14044 |
|
14045 | "use strict";
|
14046 | var __webpack_unused_export__;
|
14047 |
|
14048 |
|
14049 |
|
14050 |
|
14051 |
|
14052 |
|
14053 |
|
14054 |
|
14055 |
|
14056 |
|
14057 | const base64 = __webpack_require__(526)
|
14058 | const ieee754 = __webpack_require__(251)
|
14059 | const customInspectSymbol =
|
14060 | (typeof Symbol === 'function' && typeof Symbol['for'] === 'function')
|
14061 | ? Symbol['for']('nodejs.util.inspect.custom')
|
14062 | : null
|
14063 |
|
14064 | exports.hp = Buffer
|
14065 | __webpack_unused_export__ = SlowBuffer
|
14066 | exports.IS = 50
|
14067 |
|
14068 | const K_MAX_LENGTH = 0x7fffffff
|
14069 | __webpack_unused_export__ = K_MAX_LENGTH
|
14070 |
|
14071 |
|
14072 |
|
14073 |
|
14074 |
|
14075 |
|
14076 |
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 | Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
|
14086 |
|
14087 | if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
|
14088 | typeof console.error === 'function') {
|
14089 | console.error(
|
14090 | 'This browser lacks typed array (Uint8Array) support which is required by ' +
|
14091 | '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
|
14092 | )
|
14093 | }
|
14094 |
|
14095 | function typedArraySupport () {
|
14096 |
|
14097 | try {
|
14098 | const arr = new Uint8Array(1)
|
14099 | const proto = { foo: function () { return 42 } }
|
14100 | Object.setPrototypeOf(proto, Uint8Array.prototype)
|
14101 | Object.setPrototypeOf(arr, proto)
|
14102 | return arr.foo() === 42
|
14103 | } catch (e) {
|
14104 | return false
|
14105 | }
|
14106 | }
|
14107 |
|
14108 | Object.defineProperty(Buffer.prototype, 'parent', {
|
14109 | enumerable: true,
|
14110 | get: function () {
|
14111 | if (!Buffer.isBuffer(this)) return undefined
|
14112 | return this.buffer
|
14113 | }
|
14114 | })
|
14115 |
|
14116 | Object.defineProperty(Buffer.prototype, 'offset', {
|
14117 | enumerable: true,
|
14118 | get: function () {
|
14119 | if (!Buffer.isBuffer(this)) return undefined
|
14120 | return this.byteOffset
|
14121 | }
|
14122 | })
|
14123 |
|
14124 | function createBuffer (length) {
|
14125 | if (length > K_MAX_LENGTH) {
|
14126 | throw new RangeError('The value "' + length + '" is invalid for option "size"')
|
14127 | }
|
14128 |
|
14129 | const buf = new Uint8Array(length)
|
14130 | Object.setPrototypeOf(buf, Buffer.prototype)
|
14131 | return buf
|
14132 | }
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 |
|
14138 |
|
14139 |
|
14140 |
|
14141 |
|
14142 |
|
14143 |
|
14144 | function Buffer (arg, encodingOrOffset, length) {
|
14145 |
|
14146 | if (typeof arg === 'number') {
|
14147 | if (typeof encodingOrOffset === 'string') {
|
14148 | throw new TypeError(
|
14149 | 'The "string" argument must be of type string. Received type number'
|
14150 | )
|
14151 | }
|
14152 | return allocUnsafe(arg)
|
14153 | }
|
14154 | return from(arg, encodingOrOffset, length)
|
14155 | }
|
14156 |
|
14157 | Buffer.poolSize = 8192
|
14158 |
|
14159 | function from (value, encodingOrOffset, length) {
|
14160 | if (typeof value === 'string') {
|
14161 | return fromString(value, encodingOrOffset)
|
14162 | }
|
14163 |
|
14164 | if (ArrayBuffer.isView(value)) {
|
14165 | return fromArrayView(value)
|
14166 | }
|
14167 |
|
14168 | if (value == null) {
|
14169 | throw new TypeError(
|
14170 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
14171 | 'or Array-like Object. Received type ' + (typeof value)
|
14172 | )
|
14173 | }
|
14174 |
|
14175 | if (isInstance(value, ArrayBuffer) ||
|
14176 | (value && isInstance(value.buffer, ArrayBuffer))) {
|
14177 | return fromArrayBuffer(value, encodingOrOffset, length)
|
14178 | }
|
14179 |
|
14180 | if (typeof SharedArrayBuffer !== 'undefined' &&
|
14181 | (isInstance(value, SharedArrayBuffer) ||
|
14182 | (value && isInstance(value.buffer, SharedArrayBuffer)))) {
|
14183 | return fromArrayBuffer(value, encodingOrOffset, length)
|
14184 | }
|
14185 |
|
14186 | if (typeof value === 'number') {
|
14187 | throw new TypeError(
|
14188 | 'The "value" argument must not be of type number. Received type number'
|
14189 | )
|
14190 | }
|
14191 |
|
14192 | const valueOf = value.valueOf && value.valueOf()
|
14193 | if (valueOf != null && valueOf !== value) {
|
14194 | return Buffer.from(valueOf, encodingOrOffset, length)
|
14195 | }
|
14196 |
|
14197 | const b = fromObject(value)
|
14198 | if (b) return b
|
14199 |
|
14200 | if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
|
14201 | typeof value[Symbol.toPrimitive] === 'function') {
|
14202 | return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
|
14203 | }
|
14204 |
|
14205 | throw new TypeError(
|
14206 | 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
|
14207 | 'or Array-like Object. Received type ' + (typeof value)
|
14208 | )
|
14209 | }
|
14210 |
|
14211 |
|
14212 |
|
14213 |
|
14214 |
|
14215 |
|
14216 |
|
14217 |
|
14218 |
|
14219 | Buffer.from = function (value, encodingOrOffset, length) {
|
14220 | return from(value, encodingOrOffset, length)
|
14221 | }
|
14222 |
|
14223 |
|
14224 |
|
14225 | Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
|
14226 | Object.setPrototypeOf(Buffer, Uint8Array)
|
14227 |
|
14228 | function assertSize (size) {
|
14229 | if (typeof size !== 'number') {
|
14230 | throw new TypeError('"size" argument must be of type number')
|
14231 | } else if (size < 0) {
|
14232 | throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
14233 | }
|
14234 | }
|
14235 |
|
14236 | function alloc (size, fill, encoding) {
|
14237 | assertSize(size)
|
14238 | if (size <= 0) {
|
14239 | return createBuffer(size)
|
14240 | }
|
14241 | if (fill !== undefined) {
|
14242 |
|
14243 |
|
14244 |
|
14245 | return typeof encoding === 'string'
|
14246 | ? createBuffer(size).fill(fill, encoding)
|
14247 | : createBuffer(size).fill(fill)
|
14248 | }
|
14249 | return createBuffer(size)
|
14250 | }
|
14251 |
|
14252 |
|
14253 |
|
14254 |
|
14255 |
|
14256 | Buffer.alloc = function (size, fill, encoding) {
|
14257 | return alloc(size, fill, encoding)
|
14258 | }
|
14259 |
|
14260 | function allocUnsafe (size) {
|
14261 | assertSize(size)
|
14262 | return createBuffer(size < 0 ? 0 : checked(size) | 0)
|
14263 | }
|
14264 |
|
14265 |
|
14266 |
|
14267 |
|
14268 | Buffer.allocUnsafe = function (size) {
|
14269 | return allocUnsafe(size)
|
14270 | }
|
14271 |
|
14272 |
|
14273 |
|
14274 | Buffer.allocUnsafeSlow = function (size) {
|
14275 | return allocUnsafe(size)
|
14276 | }
|
14277 |
|
14278 | function fromString (string, encoding) {
|
14279 | if (typeof encoding !== 'string' || encoding === '') {
|
14280 | encoding = 'utf8'
|
14281 | }
|
14282 |
|
14283 | if (!Buffer.isEncoding(encoding)) {
|
14284 | throw new TypeError('Unknown encoding: ' + encoding)
|
14285 | }
|
14286 |
|
14287 | const length = byteLength(string, encoding) | 0
|
14288 | let buf = createBuffer(length)
|
14289 |
|
14290 | const actual = buf.write(string, encoding)
|
14291 |
|
14292 | if (actual !== length) {
|
14293 |
|
14294 |
|
14295 |
|
14296 | buf = buf.slice(0, actual)
|
14297 | }
|
14298 |
|
14299 | return buf
|
14300 | }
|
14301 |
|
14302 | function fromArrayLike (array) {
|
14303 | const length = array.length < 0 ? 0 : checked(array.length) | 0
|
14304 | const buf = createBuffer(length)
|
14305 | for (let i = 0; i < length; i += 1) {
|
14306 | buf[i] = array[i] & 255
|
14307 | }
|
14308 | return buf
|
14309 | }
|
14310 |
|
14311 | function fromArrayView (arrayView) {
|
14312 | if (isInstance(arrayView, Uint8Array)) {
|
14313 | const copy = new Uint8Array(arrayView)
|
14314 | return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
|
14315 | }
|
14316 | return fromArrayLike(arrayView)
|
14317 | }
|
14318 |
|
14319 | function fromArrayBuffer (array, byteOffset, length) {
|
14320 | if (byteOffset < 0 || array.byteLength < byteOffset) {
|
14321 | throw new RangeError('"offset" is outside of buffer bounds')
|
14322 | }
|
14323 |
|
14324 | if (array.byteLength < byteOffset + (length || 0)) {
|
14325 | throw new RangeError('"length" is outside of buffer bounds')
|
14326 | }
|
14327 |
|
14328 | let buf
|
14329 | if (byteOffset === undefined && length === undefined) {
|
14330 | buf = new Uint8Array(array)
|
14331 | } else if (length === undefined) {
|
14332 | buf = new Uint8Array(array, byteOffset)
|
14333 | } else {
|
14334 | buf = new Uint8Array(array, byteOffset, length)
|
14335 | }
|
14336 |
|
14337 |
|
14338 | Object.setPrototypeOf(buf, Buffer.prototype)
|
14339 |
|
14340 | return buf
|
14341 | }
|
14342 |
|
14343 | function fromObject (obj) {
|
14344 | if (Buffer.isBuffer(obj)) {
|
14345 | const len = checked(obj.length) | 0
|
14346 | const buf = createBuffer(len)
|
14347 |
|
14348 | if (buf.length === 0) {
|
14349 | return buf
|
14350 | }
|
14351 |
|
14352 | obj.copy(buf, 0, 0, len)
|
14353 | return buf
|
14354 | }
|
14355 |
|
14356 | if (obj.length !== undefined) {
|
14357 | if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
|
14358 | return createBuffer(0)
|
14359 | }
|
14360 | return fromArrayLike(obj)
|
14361 | }
|
14362 |
|
14363 | if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
|
14364 | return fromArrayLike(obj.data)
|
14365 | }
|
14366 | }
|
14367 |
|
14368 | function checked (length) {
|
14369 |
|
14370 |
|
14371 | if (length >= K_MAX_LENGTH) {
|
14372 | throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
14373 | 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
|
14374 | }
|
14375 | return length | 0
|
14376 | }
|
14377 |
|
14378 | function SlowBuffer (length) {
|
14379 | if (+length != length) {
|
14380 | length = 0
|
14381 | }
|
14382 | return Buffer.alloc(+length)
|
14383 | }
|
14384 |
|
14385 | Buffer.isBuffer = function isBuffer (b) {
|
14386 | return b != null && b._isBuffer === true &&
|
14387 | b !== Buffer.prototype
|
14388 | }
|
14389 |
|
14390 | Buffer.compare = function compare (a, b) {
|
14391 | if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
|
14392 | if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
|
14393 | if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
14394 | throw new TypeError(
|
14395 | 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
14396 | )
|
14397 | }
|
14398 |
|
14399 | if (a === b) return 0
|
14400 |
|
14401 | let x = a.length
|
14402 | let y = b.length
|
14403 |
|
14404 | for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
14405 | if (a[i] !== b[i]) {
|
14406 | x = a[i]
|
14407 | y = b[i]
|
14408 | break
|
14409 | }
|
14410 | }
|
14411 |
|
14412 | if (x < y) return -1
|
14413 | if (y < x) return 1
|
14414 | return 0
|
14415 | }
|
14416 |
|
14417 | Buffer.isEncoding = function isEncoding (encoding) {
|
14418 | switch (String(encoding).toLowerCase()) {
|
14419 | case 'hex':
|
14420 | case 'utf8':
|
14421 | case 'utf-8':
|
14422 | case 'ascii':
|
14423 | case 'latin1':
|
14424 | case 'binary':
|
14425 | case 'base64':
|
14426 | case 'ucs2':
|
14427 | case 'ucs-2':
|
14428 | case 'utf16le':
|
14429 | case 'utf-16le':
|
14430 | return true
|
14431 | default:
|
14432 | return false
|
14433 | }
|
14434 | }
|
14435 |
|
14436 | Buffer.concat = function concat (list, length) {
|
14437 | if (!Array.isArray(list)) {
|
14438 | throw new TypeError('"list" argument must be an Array of Buffers')
|
14439 | }
|
14440 |
|
14441 | if (list.length === 0) {
|
14442 | return Buffer.alloc(0)
|
14443 | }
|
14444 |
|
14445 | let i
|
14446 | if (length === undefined) {
|
14447 | length = 0
|
14448 | for (i = 0; i < list.length; ++i) {
|
14449 | length += list[i].length
|
14450 | }
|
14451 | }
|
14452 |
|
14453 | const buffer = Buffer.allocUnsafe(length)
|
14454 | let pos = 0
|
14455 | for (i = 0; i < list.length; ++i) {
|
14456 | let buf = list[i]
|
14457 | if (isInstance(buf, Uint8Array)) {
|
14458 | if (pos + buf.length > buffer.length) {
|
14459 | if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
|
14460 | buf.copy(buffer, pos)
|
14461 | } else {
|
14462 | Uint8Array.prototype.set.call(
|
14463 | buffer,
|
14464 | buf,
|
14465 | pos
|
14466 | )
|
14467 | }
|
14468 | } else if (!Buffer.isBuffer(buf)) {
|
14469 | throw new TypeError('"list" argument must be an Array of Buffers')
|
14470 | } else {
|
14471 | buf.copy(buffer, pos)
|
14472 | }
|
14473 | pos += buf.length
|
14474 | }
|
14475 | return buffer
|
14476 | }
|
14477 |
|
14478 | function byteLength (string, encoding) {
|
14479 | if (Buffer.isBuffer(string)) {
|
14480 | return string.length
|
14481 | }
|
14482 | if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
|
14483 | return string.byteLength
|
14484 | }
|
14485 | if (typeof string !== 'string') {
|
14486 | throw new TypeError(
|
14487 | 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
|
14488 | 'Received type ' + typeof string
|
14489 | )
|
14490 | }
|
14491 |
|
14492 | const len = string.length
|
14493 | const mustMatch = (arguments.length > 2 && arguments[2] === true)
|
14494 | if (!mustMatch && len === 0) return 0
|
14495 |
|
14496 |
|
14497 | let loweredCase = false
|
14498 | for (;;) {
|
14499 | switch (encoding) {
|
14500 | case 'ascii':
|
14501 | case 'latin1':
|
14502 | case 'binary':
|
14503 | return len
|
14504 | case 'utf8':
|
14505 | case 'utf-8':
|
14506 | return utf8ToBytes(string).length
|
14507 | case 'ucs2':
|
14508 | case 'ucs-2':
|
14509 | case 'utf16le':
|
14510 | case 'utf-16le':
|
14511 | return len * 2
|
14512 | case 'hex':
|
14513 | return len >>> 1
|
14514 | case 'base64':
|
14515 | return base64ToBytes(string).length
|
14516 | default:
|
14517 | if (loweredCase) {
|
14518 | return mustMatch ? -1 : utf8ToBytes(string).length
|
14519 | }
|
14520 | encoding = ('' + encoding).toLowerCase()
|
14521 | loweredCase = true
|
14522 | }
|
14523 | }
|
14524 | }
|
14525 | Buffer.byteLength = byteLength
|
14526 |
|
14527 | function slowToString (encoding, start, end) {
|
14528 | let loweredCase = false
|
14529 |
|
14530 |
|
14531 |
|
14532 |
|
14533 |
|
14534 |
|
14535 |
|
14536 |
|
14537 | if (start === undefined || start < 0) {
|
14538 | start = 0
|
14539 | }
|
14540 |
|
14541 |
|
14542 | if (start > this.length) {
|
14543 | return ''
|
14544 | }
|
14545 |
|
14546 | if (end === undefined || end > this.length) {
|
14547 | end = this.length
|
14548 | }
|
14549 |
|
14550 | if (end <= 0) {
|
14551 | return ''
|
14552 | }
|
14553 |
|
14554 |
|
14555 | end >>>= 0
|
14556 | start >>>= 0
|
14557 |
|
14558 | if (end <= start) {
|
14559 | return ''
|
14560 | }
|
14561 |
|
14562 | if (!encoding) encoding = 'utf8'
|
14563 |
|
14564 | while (true) {
|
14565 | switch (encoding) {
|
14566 | case 'hex':
|
14567 | return hexSlice(this, start, end)
|
14568 |
|
14569 | case 'utf8':
|
14570 | case 'utf-8':
|
14571 | return utf8Slice(this, start, end)
|
14572 |
|
14573 | case 'ascii':
|
14574 | return asciiSlice(this, start, end)
|
14575 |
|
14576 | case 'latin1':
|
14577 | case 'binary':
|
14578 | return latin1Slice(this, start, end)
|
14579 |
|
14580 | case 'base64':
|
14581 | return base64Slice(this, start, end)
|
14582 |
|
14583 | case 'ucs2':
|
14584 | case 'ucs-2':
|
14585 | case 'utf16le':
|
14586 | case 'utf-16le':
|
14587 | return utf16leSlice(this, start, end)
|
14588 |
|
14589 | default:
|
14590 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
14591 | encoding = (encoding + '').toLowerCase()
|
14592 | loweredCase = true
|
14593 | }
|
14594 | }
|
14595 | }
|
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 |
|
14602 |
|
14603 | Buffer.prototype._isBuffer = true
|
14604 |
|
14605 | function swap (b, n, m) {
|
14606 | const i = b[n]
|
14607 | b[n] = b[m]
|
14608 | b[m] = i
|
14609 | }
|
14610 |
|
14611 | Buffer.prototype.swap16 = function swap16 () {
|
14612 | const len = this.length
|
14613 | if (len % 2 !== 0) {
|
14614 | throw new RangeError('Buffer size must be a multiple of 16-bits')
|
14615 | }
|
14616 | for (let i = 0; i < len; i += 2) {
|
14617 | swap(this, i, i + 1)
|
14618 | }
|
14619 | return this
|
14620 | }
|
14621 |
|
14622 | Buffer.prototype.swap32 = function swap32 () {
|
14623 | const len = this.length
|
14624 | if (len % 4 !== 0) {
|
14625 | throw new RangeError('Buffer size must be a multiple of 32-bits')
|
14626 | }
|
14627 | for (let i = 0; i < len; i += 4) {
|
14628 | swap(this, i, i + 3)
|
14629 | swap(this, i + 1, i + 2)
|
14630 | }
|
14631 | return this
|
14632 | }
|
14633 |
|
14634 | Buffer.prototype.swap64 = function swap64 () {
|
14635 | const len = this.length
|
14636 | if (len % 8 !== 0) {
|
14637 | throw new RangeError('Buffer size must be a multiple of 64-bits')
|
14638 | }
|
14639 | for (let i = 0; i < len; i += 8) {
|
14640 | swap(this, i, i + 7)
|
14641 | swap(this, i + 1, i + 6)
|
14642 | swap(this, i + 2, i + 5)
|
14643 | swap(this, i + 3, i + 4)
|
14644 | }
|
14645 | return this
|
14646 | }
|
14647 |
|
14648 | Buffer.prototype.toString = function toString () {
|
14649 | const length = this.length
|
14650 | if (length === 0) return ''
|
14651 | if (arguments.length === 0) return utf8Slice(this, 0, length)
|
14652 | return slowToString.apply(this, arguments)
|
14653 | }
|
14654 |
|
14655 | Buffer.prototype.toLocaleString = Buffer.prototype.toString
|
14656 |
|
14657 | Buffer.prototype.equals = function equals (b) {
|
14658 | if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
14659 | if (this === b) return true
|
14660 | return Buffer.compare(this, b) === 0
|
14661 | }
|
14662 |
|
14663 | Buffer.prototype.inspect = function inspect () {
|
14664 | let str = ''
|
14665 | const max = exports.IS
|
14666 | str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
|
14667 | if (this.length > max) str += ' ... '
|
14668 | return '<Buffer ' + str + '>'
|
14669 | }
|
14670 | if (customInspectSymbol) {
|
14671 | Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
|
14672 | }
|
14673 |
|
14674 | Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
14675 | if (isInstance(target, Uint8Array)) {
|
14676 | target = Buffer.from(target, target.offset, target.byteLength)
|
14677 | }
|
14678 | if (!Buffer.isBuffer(target)) {
|
14679 | throw new TypeError(
|
14680 | 'The "target" argument must be one of type Buffer or Uint8Array. ' +
|
14681 | 'Received type ' + (typeof target)
|
14682 | )
|
14683 | }
|
14684 |
|
14685 | if (start === undefined) {
|
14686 | start = 0
|
14687 | }
|
14688 | if (end === undefined) {
|
14689 | end = target ? target.length : 0
|
14690 | }
|
14691 | if (thisStart === undefined) {
|
14692 | thisStart = 0
|
14693 | }
|
14694 | if (thisEnd === undefined) {
|
14695 | thisEnd = this.length
|
14696 | }
|
14697 |
|
14698 | if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
14699 | throw new RangeError('out of range index')
|
14700 | }
|
14701 |
|
14702 | if (thisStart >= thisEnd && start >= end) {
|
14703 | return 0
|
14704 | }
|
14705 | if (thisStart >= thisEnd) {
|
14706 | return -1
|
14707 | }
|
14708 | if (start >= end) {
|
14709 | return 1
|
14710 | }
|
14711 |
|
14712 | start >>>= 0
|
14713 | end >>>= 0
|
14714 | thisStart >>>= 0
|
14715 | thisEnd >>>= 0
|
14716 |
|
14717 | if (this === target) return 0
|
14718 |
|
14719 | let x = thisEnd - thisStart
|
14720 | let y = end - start
|
14721 | const len = Math.min(x, y)
|
14722 |
|
14723 | const thisCopy = this.slice(thisStart, thisEnd)
|
14724 | const targetCopy = target.slice(start, end)
|
14725 |
|
14726 | for (let i = 0; i < len; ++i) {
|
14727 | if (thisCopy[i] !== targetCopy[i]) {
|
14728 | x = thisCopy[i]
|
14729 | y = targetCopy[i]
|
14730 | break
|
14731 | }
|
14732 | }
|
14733 |
|
14734 | if (x < y) return -1
|
14735 | if (y < x) return 1
|
14736 | return 0
|
14737 | }
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 | function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
14749 |
|
14750 | if (buffer.length === 0) return -1
|
14751 |
|
14752 |
|
14753 | if (typeof byteOffset === 'string') {
|
14754 | encoding = byteOffset
|
14755 | byteOffset = 0
|
14756 | } else if (byteOffset > 0x7fffffff) {
|
14757 | byteOffset = 0x7fffffff
|
14758 | } else if (byteOffset < -0x80000000) {
|
14759 | byteOffset = -0x80000000
|
14760 | }
|
14761 | byteOffset = +byteOffset
|
14762 | if (numberIsNaN(byteOffset)) {
|
14763 |
|
14764 | byteOffset = dir ? 0 : (buffer.length - 1)
|
14765 | }
|
14766 |
|
14767 |
|
14768 | if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
14769 | if (byteOffset >= buffer.length) {
|
14770 | if (dir) return -1
|
14771 | else byteOffset = buffer.length - 1
|
14772 | } else if (byteOffset < 0) {
|
14773 | if (dir) byteOffset = 0
|
14774 | else return -1
|
14775 | }
|
14776 |
|
14777 |
|
14778 | if (typeof val === 'string') {
|
14779 | val = Buffer.from(val, encoding)
|
14780 | }
|
14781 |
|
14782 |
|
14783 | if (Buffer.isBuffer(val)) {
|
14784 |
|
14785 | if (val.length === 0) {
|
14786 | return -1
|
14787 | }
|
14788 | return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
14789 | } else if (typeof val === 'number') {
|
14790 | val = val & 0xFF
|
14791 | if (typeof Uint8Array.prototype.indexOf === 'function') {
|
14792 | if (dir) {
|
14793 | return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
14794 | } else {
|
14795 | return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
14796 | }
|
14797 | }
|
14798 | return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
|
14799 | }
|
14800 |
|
14801 | throw new TypeError('val must be string, number or Buffer')
|
14802 | }
|
14803 |
|
14804 | function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
14805 | let indexSize = 1
|
14806 | let arrLength = arr.length
|
14807 | let valLength = val.length
|
14808 |
|
14809 | if (encoding !== undefined) {
|
14810 | encoding = String(encoding).toLowerCase()
|
14811 | if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
14812 | encoding === 'utf16le' || encoding === 'utf-16le') {
|
14813 | if (arr.length < 2 || val.length < 2) {
|
14814 | return -1
|
14815 | }
|
14816 | indexSize = 2
|
14817 | arrLength /= 2
|
14818 | valLength /= 2
|
14819 | byteOffset /= 2
|
14820 | }
|
14821 | }
|
14822 |
|
14823 | function read (buf, i) {
|
14824 | if (indexSize === 1) {
|
14825 | return buf[i]
|
14826 | } else {
|
14827 | return buf.readUInt16BE(i * indexSize)
|
14828 | }
|
14829 | }
|
14830 |
|
14831 | let i
|
14832 | if (dir) {
|
14833 | let foundIndex = -1
|
14834 | for (i = byteOffset; i < arrLength; i++) {
|
14835 | if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
14836 | if (foundIndex === -1) foundIndex = i
|
14837 | if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
14838 | } else {
|
14839 | if (foundIndex !== -1) i -= i - foundIndex
|
14840 | foundIndex = -1
|
14841 | }
|
14842 | }
|
14843 | } else {
|
14844 | if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
14845 | for (i = byteOffset; i >= 0; i--) {
|
14846 | let found = true
|
14847 | for (let j = 0; j < valLength; j++) {
|
14848 | if (read(arr, i + j) !== read(val, j)) {
|
14849 | found = false
|
14850 | break
|
14851 | }
|
14852 | }
|
14853 | if (found) return i
|
14854 | }
|
14855 | }
|
14856 |
|
14857 | return -1
|
14858 | }
|
14859 |
|
14860 | Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
14861 | return this.indexOf(val, byteOffset, encoding) !== -1
|
14862 | }
|
14863 |
|
14864 | Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
14865 | return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
14866 | }
|
14867 |
|
14868 | Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
14869 | return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
14870 | }
|
14871 |
|
14872 | function hexWrite (buf, string, offset, length) {
|
14873 | offset = Number(offset) || 0
|
14874 | const remaining = buf.length - offset
|
14875 | if (!length) {
|
14876 | length = remaining
|
14877 | } else {
|
14878 | length = Number(length)
|
14879 | if (length > remaining) {
|
14880 | length = remaining
|
14881 | }
|
14882 | }
|
14883 |
|
14884 | const strLen = string.length
|
14885 |
|
14886 | if (length > strLen / 2) {
|
14887 | length = strLen / 2
|
14888 | }
|
14889 | let i
|
14890 | for (i = 0; i < length; ++i) {
|
14891 | const parsed = parseInt(string.substr(i * 2, 2), 16)
|
14892 | if (numberIsNaN(parsed)) return i
|
14893 | buf[offset + i] = parsed
|
14894 | }
|
14895 | return i
|
14896 | }
|
14897 |
|
14898 | function utf8Write (buf, string, offset, length) {
|
14899 | return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
14900 | }
|
14901 |
|
14902 | function asciiWrite (buf, string, offset, length) {
|
14903 | return blitBuffer(asciiToBytes(string), buf, offset, length)
|
14904 | }
|
14905 |
|
14906 | function base64Write (buf, string, offset, length) {
|
14907 | return blitBuffer(base64ToBytes(string), buf, offset, length)
|
14908 | }
|
14909 |
|
14910 | function ucs2Write (buf, string, offset, length) {
|
14911 | return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
14912 | }
|
14913 |
|
14914 | Buffer.prototype.write = function write (string, offset, length, encoding) {
|
14915 |
|
14916 | if (offset === undefined) {
|
14917 | encoding = 'utf8'
|
14918 | length = this.length
|
14919 | offset = 0
|
14920 |
|
14921 | } else if (length === undefined && typeof offset === 'string') {
|
14922 | encoding = offset
|
14923 | length = this.length
|
14924 | offset = 0
|
14925 |
|
14926 | } else if (isFinite(offset)) {
|
14927 | offset = offset >>> 0
|
14928 | if (isFinite(length)) {
|
14929 | length = length >>> 0
|
14930 | if (encoding === undefined) encoding = 'utf8'
|
14931 | } else {
|
14932 | encoding = length
|
14933 | length = undefined
|
14934 | }
|
14935 | } else {
|
14936 | throw new Error(
|
14937 | 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
14938 | )
|
14939 | }
|
14940 |
|
14941 | const remaining = this.length - offset
|
14942 | if (length === undefined || length > remaining) length = remaining
|
14943 |
|
14944 | if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
14945 | throw new RangeError('Attempt to write outside buffer bounds')
|
14946 | }
|
14947 |
|
14948 | if (!encoding) encoding = 'utf8'
|
14949 |
|
14950 | let loweredCase = false
|
14951 | for (;;) {
|
14952 | switch (encoding) {
|
14953 | case 'hex':
|
14954 | return hexWrite(this, string, offset, length)
|
14955 |
|
14956 | case 'utf8':
|
14957 | case 'utf-8':
|
14958 | return utf8Write(this, string, offset, length)
|
14959 |
|
14960 | case 'ascii':
|
14961 | case 'latin1':
|
14962 | case 'binary':
|
14963 | return asciiWrite(this, string, offset, length)
|
14964 |
|
14965 | case 'base64':
|
14966 |
|
14967 | return base64Write(this, string, offset, length)
|
14968 |
|
14969 | case 'ucs2':
|
14970 | case 'ucs-2':
|
14971 | case 'utf16le':
|
14972 | case 'utf-16le':
|
14973 | return ucs2Write(this, string, offset, length)
|
14974 |
|
14975 | default:
|
14976 | if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
14977 | encoding = ('' + encoding).toLowerCase()
|
14978 | loweredCase = true
|
14979 | }
|
14980 | }
|
14981 | }
|
14982 |
|
14983 | Buffer.prototype.toJSON = function toJSON () {
|
14984 | return {
|
14985 | type: 'Buffer',
|
14986 | data: Array.prototype.slice.call(this._arr || this, 0)
|
14987 | }
|
14988 | }
|
14989 |
|
14990 | function base64Slice (buf, start, end) {
|
14991 | if (start === 0 && end === buf.length) {
|
14992 | return base64.fromByteArray(buf)
|
14993 | } else {
|
14994 | return base64.fromByteArray(buf.slice(start, end))
|
14995 | }
|
14996 | }
|
14997 |
|
14998 | function utf8Slice (buf, start, end) {
|
14999 | end = Math.min(buf.length, end)
|
15000 | const res = []
|
15001 |
|
15002 | let i = start
|
15003 | while (i < end) {
|
15004 | const firstByte = buf[i]
|
15005 | let codePoint = null
|
15006 | let bytesPerSequence = (firstByte > 0xEF)
|
15007 | ? 4
|
15008 | : (firstByte > 0xDF)
|
15009 | ? 3
|
15010 | : (firstByte > 0xBF)
|
15011 | ? 2
|
15012 | : 1
|
15013 |
|
15014 | if (i + bytesPerSequence <= end) {
|
15015 | let secondByte, thirdByte, fourthByte, tempCodePoint
|
15016 |
|
15017 | switch (bytesPerSequence) {
|
15018 | case 1:
|
15019 | if (firstByte < 0x80) {
|
15020 | codePoint = firstByte
|
15021 | }
|
15022 | break
|
15023 | case 2:
|
15024 | secondByte = buf[i + 1]
|
15025 | if ((secondByte & 0xC0) === 0x80) {
|
15026 | tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
15027 | if (tempCodePoint > 0x7F) {
|
15028 | codePoint = tempCodePoint
|
15029 | }
|
15030 | }
|
15031 | break
|
15032 | case 3:
|
15033 | secondByte = buf[i + 1]
|
15034 | thirdByte = buf[i + 2]
|
15035 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
15036 | tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
15037 | if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
15038 | codePoint = tempCodePoint
|
15039 | }
|
15040 | }
|
15041 | break
|
15042 | case 4:
|
15043 | secondByte = buf[i + 1]
|
15044 | thirdByte = buf[i + 2]
|
15045 | fourthByte = buf[i + 3]
|
15046 | if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
15047 | tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
15048 | if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
15049 | codePoint = tempCodePoint
|
15050 | }
|
15051 | }
|
15052 | }
|
15053 | }
|
15054 |
|
15055 | if (codePoint === null) {
|
15056 |
|
15057 |
|
15058 | codePoint = 0xFFFD
|
15059 | bytesPerSequence = 1
|
15060 | } else if (codePoint > 0xFFFF) {
|
15061 |
|
15062 | codePoint -= 0x10000
|
15063 | res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
15064 | codePoint = 0xDC00 | codePoint & 0x3FF
|
15065 | }
|
15066 |
|
15067 | res.push(codePoint)
|
15068 | i += bytesPerSequence
|
15069 | }
|
15070 |
|
15071 | return decodeCodePointsArray(res)
|
15072 | }
|
15073 |
|
15074 |
|
15075 |
|
15076 |
|
15077 | const MAX_ARGUMENTS_LENGTH = 0x1000
|
15078 |
|
15079 | function decodeCodePointsArray (codePoints) {
|
15080 | const len = codePoints.length
|
15081 | if (len <= MAX_ARGUMENTS_LENGTH) {
|
15082 | return String.fromCharCode.apply(String, codePoints)
|
15083 | }
|
15084 |
|
15085 |
|
15086 | let res = ''
|
15087 | let i = 0
|
15088 | while (i < len) {
|
15089 | res += String.fromCharCode.apply(
|
15090 | String,
|
15091 | codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
15092 | )
|
15093 | }
|
15094 | return res
|
15095 | }
|
15096 |
|
15097 | function asciiSlice (buf, start, end) {
|
15098 | let ret = ''
|
15099 | end = Math.min(buf.length, end)
|
15100 |
|
15101 | for (let i = start; i < end; ++i) {
|
15102 | ret += String.fromCharCode(buf[i] & 0x7F)
|
15103 | }
|
15104 | return ret
|
15105 | }
|
15106 |
|
15107 | function latin1Slice (buf, start, end) {
|
15108 | let ret = ''
|
15109 | end = Math.min(buf.length, end)
|
15110 |
|
15111 | for (let i = start; i < end; ++i) {
|
15112 | ret += String.fromCharCode(buf[i])
|
15113 | }
|
15114 | return ret
|
15115 | }
|
15116 |
|
15117 | function hexSlice (buf, start, end) {
|
15118 | const len = buf.length
|
15119 |
|
15120 | if (!start || start < 0) start = 0
|
15121 | if (!end || end < 0 || end > len) end = len
|
15122 |
|
15123 | let out = ''
|
15124 | for (let i = start; i < end; ++i) {
|
15125 | out += hexSliceLookupTable[buf[i]]
|
15126 | }
|
15127 | return out
|
15128 | }
|
15129 |
|
15130 | function utf16leSlice (buf, start, end) {
|
15131 | const bytes = buf.slice(start, end)
|
15132 | let res = ''
|
15133 |
|
15134 | for (let i = 0; i < bytes.length - 1; i += 2) {
|
15135 | res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
|
15136 | }
|
15137 | return res
|
15138 | }
|
15139 |
|
15140 | Buffer.prototype.slice = function slice (start, end) {
|
15141 | const len = this.length
|
15142 | start = ~~start
|
15143 | end = end === undefined ? len : ~~end
|
15144 |
|
15145 | if (start < 0) {
|
15146 | start += len
|
15147 | if (start < 0) start = 0
|
15148 | } else if (start > len) {
|
15149 | start = len
|
15150 | }
|
15151 |
|
15152 | if (end < 0) {
|
15153 | end += len
|
15154 | if (end < 0) end = 0
|
15155 | } else if (end > len) {
|
15156 | end = len
|
15157 | }
|
15158 |
|
15159 | if (end < start) end = start
|
15160 |
|
15161 | const newBuf = this.subarray(start, end)
|
15162 |
|
15163 | Object.setPrototypeOf(newBuf, Buffer.prototype)
|
15164 |
|
15165 | return newBuf
|
15166 | }
|
15167 |
|
15168 |
|
15169 |
|
15170 |
|
15171 | function checkOffset (offset, ext, length) {
|
15172 | if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
15173 | if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
15174 | }
|
15175 |
|
15176 | Buffer.prototype.readUintLE =
|
15177 | Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
15178 | offset = offset >>> 0
|
15179 | byteLength = byteLength >>> 0
|
15180 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
15181 |
|
15182 | let val = this[offset]
|
15183 | let mul = 1
|
15184 | let i = 0
|
15185 | while (++i < byteLength && (mul *= 0x100)) {
|
15186 | val += this[offset + i] * mul
|
15187 | }
|
15188 |
|
15189 | return val
|
15190 | }
|
15191 |
|
15192 | Buffer.prototype.readUintBE =
|
15193 | Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
15194 | offset = offset >>> 0
|
15195 | byteLength = byteLength >>> 0
|
15196 | if (!noAssert) {
|
15197 | checkOffset(offset, byteLength, this.length)
|
15198 | }
|
15199 |
|
15200 | let val = this[offset + --byteLength]
|
15201 | let mul = 1
|
15202 | while (byteLength > 0 && (mul *= 0x100)) {
|
15203 | val += this[offset + --byteLength] * mul
|
15204 | }
|
15205 |
|
15206 | return val
|
15207 | }
|
15208 |
|
15209 | Buffer.prototype.readUint8 =
|
15210 | Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
15211 | offset = offset >>> 0
|
15212 | if (!noAssert) checkOffset(offset, 1, this.length)
|
15213 | return this[offset]
|
15214 | }
|
15215 |
|
15216 | Buffer.prototype.readUint16LE =
|
15217 | Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
15218 | offset = offset >>> 0
|
15219 | if (!noAssert) checkOffset(offset, 2, this.length)
|
15220 | return this[offset] | (this[offset + 1] << 8)
|
15221 | }
|
15222 |
|
15223 | Buffer.prototype.readUint16BE =
|
15224 | Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
15225 | offset = offset >>> 0
|
15226 | if (!noAssert) checkOffset(offset, 2, this.length)
|
15227 | return (this[offset] << 8) | this[offset + 1]
|
15228 | }
|
15229 |
|
15230 | Buffer.prototype.readUint32LE =
|
15231 | Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
15232 | offset = offset >>> 0
|
15233 | if (!noAssert) checkOffset(offset, 4, this.length)
|
15234 |
|
15235 | return ((this[offset]) |
|
15236 | (this[offset + 1] << 8) |
|
15237 | (this[offset + 2] << 16)) +
|
15238 | (this[offset + 3] * 0x1000000)
|
15239 | }
|
15240 |
|
15241 | Buffer.prototype.readUint32BE =
|
15242 | Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
15243 | offset = offset >>> 0
|
15244 | if (!noAssert) checkOffset(offset, 4, this.length)
|
15245 |
|
15246 | return (this[offset] * 0x1000000) +
|
15247 | ((this[offset + 1] << 16) |
|
15248 | (this[offset + 2] << 8) |
|
15249 | this[offset + 3])
|
15250 | }
|
15251 |
|
15252 | Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
|
15253 | offset = offset >>> 0
|
15254 | validateNumber(offset, 'offset')
|
15255 | const first = this[offset]
|
15256 | const last = this[offset + 7]
|
15257 | if (first === undefined || last === undefined) {
|
15258 | boundsError(offset, this.length - 8)
|
15259 | }
|
15260 |
|
15261 | const lo = first +
|
15262 | this[++offset] * 2 ** 8 +
|
15263 | this[++offset] * 2 ** 16 +
|
15264 | this[++offset] * 2 ** 24
|
15265 |
|
15266 | const hi = this[++offset] +
|
15267 | this[++offset] * 2 ** 8 +
|
15268 | this[++offset] * 2 ** 16 +
|
15269 | last * 2 ** 24
|
15270 |
|
15271 | return BigInt(lo) + (BigInt(hi) << BigInt(32))
|
15272 | })
|
15273 |
|
15274 | Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
|
15275 | offset = offset >>> 0
|
15276 | validateNumber(offset, 'offset')
|
15277 | const first = this[offset]
|
15278 | const last = this[offset + 7]
|
15279 | if (first === undefined || last === undefined) {
|
15280 | boundsError(offset, this.length - 8)
|
15281 | }
|
15282 |
|
15283 | const hi = first * 2 ** 24 +
|
15284 | this[++offset] * 2 ** 16 +
|
15285 | this[++offset] * 2 ** 8 +
|
15286 | this[++offset]
|
15287 |
|
15288 | const lo = this[++offset] * 2 ** 24 +
|
15289 | this[++offset] * 2 ** 16 +
|
15290 | this[++offset] * 2 ** 8 +
|
15291 | last
|
15292 |
|
15293 | return (BigInt(hi) << BigInt(32)) + BigInt(lo)
|
15294 | })
|
15295 |
|
15296 | Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
15297 | offset = offset >>> 0
|
15298 | byteLength = byteLength >>> 0
|
15299 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
15300 |
|
15301 | let val = this[offset]
|
15302 | let mul = 1
|
15303 | let i = 0
|
15304 | while (++i < byteLength && (mul *= 0x100)) {
|
15305 | val += this[offset + i] * mul
|
15306 | }
|
15307 | mul *= 0x80
|
15308 |
|
15309 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
15310 |
|
15311 | return val
|
15312 | }
|
15313 |
|
15314 | Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
15315 | offset = offset >>> 0
|
15316 | byteLength = byteLength >>> 0
|
15317 | if (!noAssert) checkOffset(offset, byteLength, this.length)
|
15318 |
|
15319 | let i = byteLength
|
15320 | let mul = 1
|
15321 | let val = this[offset + --i]
|
15322 | while (i > 0 && (mul *= 0x100)) {
|
15323 | val += this[offset + --i] * mul
|
15324 | }
|
15325 | mul *= 0x80
|
15326 |
|
15327 | if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
15328 |
|
15329 | return val
|
15330 | }
|
15331 |
|
15332 | Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
15333 | offset = offset >>> 0
|
15334 | if (!noAssert) checkOffset(offset, 1, this.length)
|
15335 | if (!(this[offset] & 0x80)) return (this[offset])
|
15336 | return ((0xff - this[offset] + 1) * -1)
|
15337 | }
|
15338 |
|
15339 | Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
15340 | offset = offset >>> 0
|
15341 | if (!noAssert) checkOffset(offset, 2, this.length)
|
15342 | const val = this[offset] | (this[offset + 1] << 8)
|
15343 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
15344 | }
|
15345 |
|
15346 | Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
15347 | offset = offset >>> 0
|
15348 | if (!noAssert) checkOffset(offset, 2, this.length)
|
15349 | const val = this[offset + 1] | (this[offset] << 8)
|
15350 | return (val & 0x8000) ? val | 0xFFFF0000 : val
|
15351 | }
|
15352 |
|
15353 | Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
15354 | offset = offset >>> 0
|
15355 | if (!noAssert) checkOffset(offset, 4, this.length)
|
15356 |
|
15357 | return (this[offset]) |
|
15358 | (this[offset + 1] << 8) |
|
15359 | (this[offset + 2] << 16) |
|
15360 | (this[offset + 3] << 24)
|
15361 | }
|
15362 |
|
15363 | Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
15364 | offset = offset >>> 0
|
15365 | if (!noAssert) checkOffset(offset, 4, this.length)
|
15366 |
|
15367 | return (this[offset] << 24) |
|
15368 | (this[offset + 1] << 16) |
|
15369 | (this[offset + 2] << 8) |
|
15370 | (this[offset + 3])
|
15371 | }
|
15372 |
|
15373 | Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
|
15374 | offset = offset >>> 0
|
15375 | validateNumber(offset, 'offset')
|
15376 | const first = this[offset]
|
15377 | const last = this[offset + 7]
|
15378 | if (first === undefined || last === undefined) {
|
15379 | boundsError(offset, this.length - 8)
|
15380 | }
|
15381 |
|
15382 | const val = this[offset + 4] +
|
15383 | this[offset + 5] * 2 ** 8 +
|
15384 | this[offset + 6] * 2 ** 16 +
|
15385 | (last << 24)
|
15386 |
|
15387 | return (BigInt(val) << BigInt(32)) +
|
15388 | BigInt(first +
|
15389 | this[++offset] * 2 ** 8 +
|
15390 | this[++offset] * 2 ** 16 +
|
15391 | this[++offset] * 2 ** 24)
|
15392 | })
|
15393 |
|
15394 | Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
|
15395 | offset = offset >>> 0
|
15396 | validateNumber(offset, 'offset')
|
15397 | const first = this[offset]
|
15398 | const last = this[offset + 7]
|
15399 | if (first === undefined || last === undefined) {
|
15400 | boundsError(offset, this.length - 8)
|
15401 | }
|
15402 |
|
15403 | const val = (first << 24) +
|
15404 | this[++offset] * 2 ** 16 +
|
15405 | this[++offset] * 2 ** 8 +
|
15406 | this[++offset]
|
15407 |
|
15408 | return (BigInt(val) << BigInt(32)) +
|
15409 | BigInt(this[++offset] * 2 ** 24 +
|
15410 | this[++offset] * 2 ** 16 +
|
15411 | this[++offset] * 2 ** 8 +
|
15412 | last)
|
15413 | })
|
15414 |
|
15415 | Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
15416 | offset = offset >>> 0
|
15417 | if (!noAssert) checkOffset(offset, 4, this.length)
|
15418 | return ieee754.read(this, offset, true, 23, 4)
|
15419 | }
|
15420 |
|
15421 | Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
15422 | offset = offset >>> 0
|
15423 | if (!noAssert) checkOffset(offset, 4, this.length)
|
15424 | return ieee754.read(this, offset, false, 23, 4)
|
15425 | }
|
15426 |
|
15427 | Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
15428 | offset = offset >>> 0
|
15429 | if (!noAssert) checkOffset(offset, 8, this.length)
|
15430 | return ieee754.read(this, offset, true, 52, 8)
|
15431 | }
|
15432 |
|
15433 | Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
15434 | offset = offset >>> 0
|
15435 | if (!noAssert) checkOffset(offset, 8, this.length)
|
15436 | return ieee754.read(this, offset, false, 52, 8)
|
15437 | }
|
15438 |
|
15439 | function checkInt (buf, value, offset, ext, max, min) {
|
15440 | if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
15441 | if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
15442 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
15443 | }
|
15444 |
|
15445 | Buffer.prototype.writeUintLE =
|
15446 | Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
15447 | value = +value
|
15448 | offset = offset >>> 0
|
15449 | byteLength = byteLength >>> 0
|
15450 | if (!noAssert) {
|
15451 | const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
15452 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
15453 | }
|
15454 |
|
15455 | let mul = 1
|
15456 | let i = 0
|
15457 | this[offset] = value & 0xFF
|
15458 | while (++i < byteLength && (mul *= 0x100)) {
|
15459 | this[offset + i] = (value / mul) & 0xFF
|
15460 | }
|
15461 |
|
15462 | return offset + byteLength
|
15463 | }
|
15464 |
|
15465 | Buffer.prototype.writeUintBE =
|
15466 | Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
15467 | value = +value
|
15468 | offset = offset >>> 0
|
15469 | byteLength = byteLength >>> 0
|
15470 | if (!noAssert) {
|
15471 | const maxBytes = Math.pow(2, 8 * byteLength) - 1
|
15472 | checkInt(this, value, offset, byteLength, maxBytes, 0)
|
15473 | }
|
15474 |
|
15475 | let i = byteLength - 1
|
15476 | let mul = 1
|
15477 | this[offset + i] = value & 0xFF
|
15478 | while (--i >= 0 && (mul *= 0x100)) {
|
15479 | this[offset + i] = (value / mul) & 0xFF
|
15480 | }
|
15481 |
|
15482 | return offset + byteLength
|
15483 | }
|
15484 |
|
15485 | Buffer.prototype.writeUint8 =
|
15486 | Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
15487 | value = +value
|
15488 | offset = offset >>> 0
|
15489 | if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
15490 | this[offset] = (value & 0xff)
|
15491 | return offset + 1
|
15492 | }
|
15493 |
|
15494 | Buffer.prototype.writeUint16LE =
|
15495 | Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
15496 | value = +value
|
15497 | offset = offset >>> 0
|
15498 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
15499 | this[offset] = (value & 0xff)
|
15500 | this[offset + 1] = (value >>> 8)
|
15501 | return offset + 2
|
15502 | }
|
15503 |
|
15504 | Buffer.prototype.writeUint16BE =
|
15505 | Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
15506 | value = +value
|
15507 | offset = offset >>> 0
|
15508 | if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
15509 | this[offset] = (value >>> 8)
|
15510 | this[offset + 1] = (value & 0xff)
|
15511 | return offset + 2
|
15512 | }
|
15513 |
|
15514 | Buffer.prototype.writeUint32LE =
|
15515 | Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
15516 | value = +value
|
15517 | offset = offset >>> 0
|
15518 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
15519 | this[offset + 3] = (value >>> 24)
|
15520 | this[offset + 2] = (value >>> 16)
|
15521 | this[offset + 1] = (value >>> 8)
|
15522 | this[offset] = (value & 0xff)
|
15523 | return offset + 4
|
15524 | }
|
15525 |
|
15526 | Buffer.prototype.writeUint32BE =
|
15527 | Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
15528 | value = +value
|
15529 | offset = offset >>> 0
|
15530 | if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
15531 | this[offset] = (value >>> 24)
|
15532 | this[offset + 1] = (value >>> 16)
|
15533 | this[offset + 2] = (value >>> 8)
|
15534 | this[offset + 3] = (value & 0xff)
|
15535 | return offset + 4
|
15536 | }
|
15537 |
|
15538 | function wrtBigUInt64LE (buf, value, offset, min, max) {
|
15539 | checkIntBI(value, min, max, buf, offset, 7)
|
15540 |
|
15541 | let lo = Number(value & BigInt(0xffffffff))
|
15542 | buf[offset++] = lo
|
15543 | lo = lo >> 8
|
15544 | buf[offset++] = lo
|
15545 | lo = lo >> 8
|
15546 | buf[offset++] = lo
|
15547 | lo = lo >> 8
|
15548 | buf[offset++] = lo
|
15549 | let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
15550 | buf[offset++] = hi
|
15551 | hi = hi >> 8
|
15552 | buf[offset++] = hi
|
15553 | hi = hi >> 8
|
15554 | buf[offset++] = hi
|
15555 | hi = hi >> 8
|
15556 | buf[offset++] = hi
|
15557 | return offset
|
15558 | }
|
15559 |
|
15560 | function wrtBigUInt64BE (buf, value, offset, min, max) {
|
15561 | checkIntBI(value, min, max, buf, offset, 7)
|
15562 |
|
15563 | let lo = Number(value & BigInt(0xffffffff))
|
15564 | buf[offset + 7] = lo
|
15565 | lo = lo >> 8
|
15566 | buf[offset + 6] = lo
|
15567 | lo = lo >> 8
|
15568 | buf[offset + 5] = lo
|
15569 | lo = lo >> 8
|
15570 | buf[offset + 4] = lo
|
15571 | let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
|
15572 | buf[offset + 3] = hi
|
15573 | hi = hi >> 8
|
15574 | buf[offset + 2] = hi
|
15575 | hi = hi >> 8
|
15576 | buf[offset + 1] = hi
|
15577 | hi = hi >> 8
|
15578 | buf[offset] = hi
|
15579 | return offset + 8
|
15580 | }
|
15581 |
|
15582 | Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
|
15583 | return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
15584 | })
|
15585 |
|
15586 | Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
|
15587 | return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
|
15588 | })
|
15589 |
|
15590 | Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
15591 | value = +value
|
15592 | offset = offset >>> 0
|
15593 | if (!noAssert) {
|
15594 | const limit = Math.pow(2, (8 * byteLength) - 1)
|
15595 |
|
15596 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
15597 | }
|
15598 |
|
15599 | let i = 0
|
15600 | let mul = 1
|
15601 | let sub = 0
|
15602 | this[offset] = value & 0xFF
|
15603 | while (++i < byteLength && (mul *= 0x100)) {
|
15604 | if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
15605 | sub = 1
|
15606 | }
|
15607 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
15608 | }
|
15609 |
|
15610 | return offset + byteLength
|
15611 | }
|
15612 |
|
15613 | Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
15614 | value = +value
|
15615 | offset = offset >>> 0
|
15616 | if (!noAssert) {
|
15617 | const limit = Math.pow(2, (8 * byteLength) - 1)
|
15618 |
|
15619 | checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
15620 | }
|
15621 |
|
15622 | let i = byteLength - 1
|
15623 | let mul = 1
|
15624 | let sub = 0
|
15625 | this[offset + i] = value & 0xFF
|
15626 | while (--i >= 0 && (mul *= 0x100)) {
|
15627 | if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
15628 | sub = 1
|
15629 | }
|
15630 | this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
15631 | }
|
15632 |
|
15633 | return offset + byteLength
|
15634 | }
|
15635 |
|
15636 | Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
15637 | value = +value
|
15638 | offset = offset >>> 0
|
15639 | if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
15640 | if (value < 0) value = 0xff + value + 1
|
15641 | this[offset] = (value & 0xff)
|
15642 | return offset + 1
|
15643 | }
|
15644 |
|
15645 | Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
15646 | value = +value
|
15647 | offset = offset >>> 0
|
15648 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
15649 | this[offset] = (value & 0xff)
|
15650 | this[offset + 1] = (value >>> 8)
|
15651 | return offset + 2
|
15652 | }
|
15653 |
|
15654 | Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
15655 | value = +value
|
15656 | offset = offset >>> 0
|
15657 | if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
15658 | this[offset] = (value >>> 8)
|
15659 | this[offset + 1] = (value & 0xff)
|
15660 | return offset + 2
|
15661 | }
|
15662 |
|
15663 | Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
15664 | value = +value
|
15665 | offset = offset >>> 0
|
15666 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
15667 | this[offset] = (value & 0xff)
|
15668 | this[offset + 1] = (value >>> 8)
|
15669 | this[offset + 2] = (value >>> 16)
|
15670 | this[offset + 3] = (value >>> 24)
|
15671 | return offset + 4
|
15672 | }
|
15673 |
|
15674 | Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
15675 | value = +value
|
15676 | offset = offset >>> 0
|
15677 | if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
15678 | if (value < 0) value = 0xffffffff + value + 1
|
15679 | this[offset] = (value >>> 24)
|
15680 | this[offset + 1] = (value >>> 16)
|
15681 | this[offset + 2] = (value >>> 8)
|
15682 | this[offset + 3] = (value & 0xff)
|
15683 | return offset + 4
|
15684 | }
|
15685 |
|
15686 | Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
|
15687 | return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
15688 | })
|
15689 |
|
15690 | Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
|
15691 | return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
|
15692 | })
|
15693 |
|
15694 | function checkIEEE754 (buf, value, offset, ext, max, min) {
|
15695 | if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
15696 | if (offset < 0) throw new RangeError('Index out of range')
|
15697 | }
|
15698 |
|
15699 | function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
15700 | value = +value
|
15701 | offset = offset >>> 0
|
15702 | if (!noAssert) {
|
15703 | checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
15704 | }
|
15705 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
15706 | return offset + 4
|
15707 | }
|
15708 |
|
15709 | Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
15710 | return writeFloat(this, value, offset, true, noAssert)
|
15711 | }
|
15712 |
|
15713 | Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
15714 | return writeFloat(this, value, offset, false, noAssert)
|
15715 | }
|
15716 |
|
15717 | function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
15718 | value = +value
|
15719 | offset = offset >>> 0
|
15720 | if (!noAssert) {
|
15721 | checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
15722 | }
|
15723 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
15724 | return offset + 8
|
15725 | }
|
15726 |
|
15727 | Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
15728 | return writeDouble(this, value, offset, true, noAssert)
|
15729 | }
|
15730 |
|
15731 | Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
15732 | return writeDouble(this, value, offset, false, noAssert)
|
15733 | }
|
15734 |
|
15735 |
|
15736 | Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
15737 | if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
|
15738 | if (!start) start = 0
|
15739 | if (!end && end !== 0) end = this.length
|
15740 | if (targetStart >= target.length) targetStart = target.length
|
15741 | if (!targetStart) targetStart = 0
|
15742 | if (end > 0 && end < start) end = start
|
15743 |
|
15744 |
|
15745 | if (end === start) return 0
|
15746 | if (target.length === 0 || this.length === 0) return 0
|
15747 |
|
15748 |
|
15749 | if (targetStart < 0) {
|
15750 | throw new RangeError('targetStart out of bounds')
|
15751 | }
|
15752 | if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
|
15753 | if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
15754 |
|
15755 |
|
15756 | if (end > this.length) end = this.length
|
15757 | if (target.length - targetStart < end - start) {
|
15758 | end = target.length - targetStart + start
|
15759 | }
|
15760 |
|
15761 | const len = end - start
|
15762 |
|
15763 | if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
|
15764 |
|
15765 | this.copyWithin(targetStart, start, end)
|
15766 | } else {
|
15767 | Uint8Array.prototype.set.call(
|
15768 | target,
|
15769 | this.subarray(start, end),
|
15770 | targetStart
|
15771 | )
|
15772 | }
|
15773 |
|
15774 | return len
|
15775 | }
|
15776 |
|
15777 |
|
15778 |
|
15779 |
|
15780 |
|
15781 | Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
15782 |
|
15783 | if (typeof val === 'string') {
|
15784 | if (typeof start === 'string') {
|
15785 | encoding = start
|
15786 | start = 0
|
15787 | end = this.length
|
15788 | } else if (typeof end === 'string') {
|
15789 | encoding = end
|
15790 | end = this.length
|
15791 | }
|
15792 | if (encoding !== undefined && typeof encoding !== 'string') {
|
15793 | throw new TypeError('encoding must be a string')
|
15794 | }
|
15795 | if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
15796 | throw new TypeError('Unknown encoding: ' + encoding)
|
15797 | }
|
15798 | if (val.length === 1) {
|
15799 | const code = val.charCodeAt(0)
|
15800 | if ((encoding === 'utf8' && code < 128) ||
|
15801 | encoding === 'latin1') {
|
15802 |
|
15803 | val = code
|
15804 | }
|
15805 | }
|
15806 | } else if (typeof val === 'number') {
|
15807 | val = val & 255
|
15808 | } else if (typeof val === 'boolean') {
|
15809 | val = Number(val)
|
15810 | }
|
15811 |
|
15812 |
|
15813 | if (start < 0 || this.length < start || this.length < end) {
|
15814 | throw new RangeError('Out of range index')
|
15815 | }
|
15816 |
|
15817 | if (end <= start) {
|
15818 | return this
|
15819 | }
|
15820 |
|
15821 | start = start >>> 0
|
15822 | end = end === undefined ? this.length : end >>> 0
|
15823 |
|
15824 | if (!val) val = 0
|
15825 |
|
15826 | let i
|
15827 | if (typeof val === 'number') {
|
15828 | for (i = start; i < end; ++i) {
|
15829 | this[i] = val
|
15830 | }
|
15831 | } else {
|
15832 | const bytes = Buffer.isBuffer(val)
|
15833 | ? val
|
15834 | : Buffer.from(val, encoding)
|
15835 | const len = bytes.length
|
15836 | if (len === 0) {
|
15837 | throw new TypeError('The value "' + val +
|
15838 | '" is invalid for argument "value"')
|
15839 | }
|
15840 | for (i = 0; i < end - start; ++i) {
|
15841 | this[i + start] = bytes[i % len]
|
15842 | }
|
15843 | }
|
15844 |
|
15845 | return this
|
15846 | }
|
15847 |
|
15848 |
|
15849 |
|
15850 |
|
15851 |
|
15852 | const errors = {}
|
15853 | function E (sym, getMessage, Base) {
|
15854 | errors[sym] = class NodeError extends Base {
|
15855 | constructor () {
|
15856 | super()
|
15857 |
|
15858 | Object.defineProperty(this, 'message', {
|
15859 | value: getMessage.apply(this, arguments),
|
15860 | writable: true,
|
15861 | configurable: true
|
15862 | })
|
15863 |
|
15864 |
|
15865 | this.name = `${this.name} [${sym}]`
|
15866 |
|
15867 |
|
15868 | this.stack
|
15869 |
|
15870 | delete this.name
|
15871 | }
|
15872 |
|
15873 | get code () {
|
15874 | return sym
|
15875 | }
|
15876 |
|
15877 | set code (value) {
|
15878 | Object.defineProperty(this, 'code', {
|
15879 | configurable: true,
|
15880 | enumerable: true,
|
15881 | value,
|
15882 | writable: true
|
15883 | })
|
15884 | }
|
15885 |
|
15886 | toString () {
|
15887 | return `${this.name} [${sym}]: ${this.message}`
|
15888 | }
|
15889 | }
|
15890 | }
|
15891 |
|
15892 | E('ERR_BUFFER_OUT_OF_BOUNDS',
|
15893 | function (name) {
|
15894 | if (name) {
|
15895 | return `${name} is outside of buffer bounds`
|
15896 | }
|
15897 |
|
15898 | return 'Attempt to access memory outside buffer bounds'
|
15899 | }, RangeError)
|
15900 | E('ERR_INVALID_ARG_TYPE',
|
15901 | function (name, actual) {
|
15902 | return `The "${name}" argument must be of type number. Received type ${typeof actual}`
|
15903 | }, TypeError)
|
15904 | E('ERR_OUT_OF_RANGE',
|
15905 | function (str, range, input) {
|
15906 | let msg = `The value of "${str}" is out of range.`
|
15907 | let received = input
|
15908 | if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
15909 | received = addNumericalSeparator(String(input))
|
15910 | } else if (typeof input === 'bigint') {
|
15911 | received = String(input)
|
15912 | if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
|
15913 | received = addNumericalSeparator(received)
|
15914 | }
|
15915 | received += 'n'
|
15916 | }
|
15917 | msg += ` It must be ${range}. Received ${received}`
|
15918 | return msg
|
15919 | }, RangeError)
|
15920 |
|
15921 | function addNumericalSeparator (val) {
|
15922 | let res = ''
|
15923 | let i = val.length
|
15924 | const start = val[0] === '-' ? 1 : 0
|
15925 | for (; i >= start + 4; i -= 3) {
|
15926 | res = `_${val.slice(i - 3, i)}${res}`
|
15927 | }
|
15928 | return `${val.slice(0, i)}${res}`
|
15929 | }
|
15930 |
|
15931 |
|
15932 |
|
15933 |
|
15934 | function checkBounds (buf, offset, byteLength) {
|
15935 | validateNumber(offset, 'offset')
|
15936 | if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
|
15937 | boundsError(offset, buf.length - (byteLength + 1))
|
15938 | }
|
15939 | }
|
15940 |
|
15941 | function checkIntBI (value, min, max, buf, offset, byteLength) {
|
15942 | if (value > max || value < min) {
|
15943 | const n = typeof min === 'bigint' ? 'n' : ''
|
15944 | let range
|
15945 | if (byteLength > 3) {
|
15946 | if (min === 0 || min === BigInt(0)) {
|
15947 | range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
|
15948 | } else {
|
15949 | range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
|
15950 | `${(byteLength + 1) * 8 - 1}${n}`
|
15951 | }
|
15952 | } else {
|
15953 | range = `>= ${min}${n} and <= ${max}${n}`
|
15954 | }
|
15955 | throw new errors.ERR_OUT_OF_RANGE('value', range, value)
|
15956 | }
|
15957 | checkBounds(buf, offset, byteLength)
|
15958 | }
|
15959 |
|
15960 | function validateNumber (value, name) {
|
15961 | if (typeof value !== 'number') {
|
15962 | throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
|
15963 | }
|
15964 | }
|
15965 |
|
15966 | function boundsError (value, length, type) {
|
15967 | if (Math.floor(value) !== value) {
|
15968 | validateNumber(value, type)
|
15969 | throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
|
15970 | }
|
15971 |
|
15972 | if (length < 0) {
|
15973 | throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
|
15974 | }
|
15975 |
|
15976 | throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
|
15977 | `>= ${type ? 1 : 0} and <= ${length}`,
|
15978 | value)
|
15979 | }
|
15980 |
|
15981 |
|
15982 |
|
15983 |
|
15984 | const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
|
15985 |
|
15986 | function base64clean (str) {
|
15987 |
|
15988 | str = str.split('=')[0]
|
15989 |
|
15990 | str = str.trim().replace(INVALID_BASE64_RE, '')
|
15991 |
|
15992 | if (str.length < 2) return ''
|
15993 |
|
15994 | while (str.length % 4 !== 0) {
|
15995 | str = str + '='
|
15996 | }
|
15997 | return str
|
15998 | }
|
15999 |
|
16000 | function utf8ToBytes (string, units) {
|
16001 | units = units || Infinity
|
16002 | let codePoint
|
16003 | const length = string.length
|
16004 | let leadSurrogate = null
|
16005 | const bytes = []
|
16006 |
|
16007 | for (let i = 0; i < length; ++i) {
|
16008 | codePoint = string.charCodeAt(i)
|
16009 |
|
16010 |
|
16011 | if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
16012 |
|
16013 | if (!leadSurrogate) {
|
16014 |
|
16015 | if (codePoint > 0xDBFF) {
|
16016 |
|
16017 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
16018 | continue
|
16019 | } else if (i + 1 === length) {
|
16020 |
|
16021 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
16022 | continue
|
16023 | }
|
16024 |
|
16025 |
|
16026 | leadSurrogate = codePoint
|
16027 |
|
16028 | continue
|
16029 | }
|
16030 |
|
16031 |
|
16032 | if (codePoint < 0xDC00) {
|
16033 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
16034 | leadSurrogate = codePoint
|
16035 | continue
|
16036 | }
|
16037 |
|
16038 |
|
16039 | codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
16040 | } else if (leadSurrogate) {
|
16041 |
|
16042 | if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
16043 | }
|
16044 |
|
16045 | leadSurrogate = null
|
16046 |
|
16047 |
|
16048 | if (codePoint < 0x80) {
|
16049 | if ((units -= 1) < 0) break
|
16050 | bytes.push(codePoint)
|
16051 | } else if (codePoint < 0x800) {
|
16052 | if ((units -= 2) < 0) break
|
16053 | bytes.push(
|
16054 | codePoint >> 0x6 | 0xC0,
|
16055 | codePoint & 0x3F | 0x80
|
16056 | )
|
16057 | } else if (codePoint < 0x10000) {
|
16058 | if ((units -= 3) < 0) break
|
16059 | bytes.push(
|
16060 | codePoint >> 0xC | 0xE0,
|
16061 | codePoint >> 0x6 & 0x3F | 0x80,
|
16062 | codePoint & 0x3F | 0x80
|
16063 | )
|
16064 | } else if (codePoint < 0x110000) {
|
16065 | if ((units -= 4) < 0) break
|
16066 | bytes.push(
|
16067 | codePoint >> 0x12 | 0xF0,
|
16068 | codePoint >> 0xC & 0x3F | 0x80,
|
16069 | codePoint >> 0x6 & 0x3F | 0x80,
|
16070 | codePoint & 0x3F | 0x80
|
16071 | )
|
16072 | } else {
|
16073 | throw new Error('Invalid code point')
|
16074 | }
|
16075 | }
|
16076 |
|
16077 | return bytes
|
16078 | }
|
16079 |
|
16080 | function asciiToBytes (str) {
|
16081 | const byteArray = []
|
16082 | for (let i = 0; i < str.length; ++i) {
|
16083 |
|
16084 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
16085 | }
|
16086 | return byteArray
|
16087 | }
|
16088 |
|
16089 | function utf16leToBytes (str, units) {
|
16090 | let c, hi, lo
|
16091 | const byteArray = []
|
16092 | for (let i = 0; i < str.length; ++i) {
|
16093 | if ((units -= 2) < 0) break
|
16094 |
|
16095 | c = str.charCodeAt(i)
|
16096 | hi = c >> 8
|
16097 | lo = c % 256
|
16098 | byteArray.push(lo)
|
16099 | byteArray.push(hi)
|
16100 | }
|
16101 |
|
16102 | return byteArray
|
16103 | }
|
16104 |
|
16105 | function base64ToBytes (str) {
|
16106 | return base64.toByteArray(base64clean(str))
|
16107 | }
|
16108 |
|
16109 | function blitBuffer (src, dst, offset, length) {
|
16110 | let i
|
16111 | for (i = 0; i < length; ++i) {
|
16112 | if ((i + offset >= dst.length) || (i >= src.length)) break
|
16113 | dst[i + offset] = src[i]
|
16114 | }
|
16115 | return i
|
16116 | }
|
16117 |
|
16118 |
|
16119 |
|
16120 |
|
16121 | function isInstance (obj, type) {
|
16122 | return obj instanceof type ||
|
16123 | (obj != null && obj.constructor != null && obj.constructor.name != null &&
|
16124 | obj.constructor.name === type.name)
|
16125 | }
|
16126 | function numberIsNaN (obj) {
|
16127 |
|
16128 | return obj !== obj
|
16129 | }
|
16130 |
|
16131 |
|
16132 |
|
16133 | const hexSliceLookupTable = (function () {
|
16134 | const alphabet = '0123456789abcdef'
|
16135 | const table = new Array(256)
|
16136 | for (let i = 0; i < 16; ++i) {
|
16137 | const i16 = i * 16
|
16138 | for (let j = 0; j < 16; ++j) {
|
16139 | table[i16 + j] = alphabet[i] + alphabet[j]
|
16140 | }
|
16141 | }
|
16142 | return table
|
16143 | })()
|
16144 |
|
16145 |
|
16146 | function defineBigIntMethod (fn) {
|
16147 | return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
|
16148 | }
|
16149 |
|
16150 | function BufferBigIntNotDefined () {
|
16151 | throw new Error('BigInt not supported')
|
16152 | }
|
16153 |
|
16154 |
|
16155 | }),
|
16156 |
|
16157 | 4:
|
16158 | ((module) => {
|
16159 |
|
16160 | "use strict";
|
16161 |
|
16162 |
|
16163 |
|
16164 |
|
16165 |
|
16166 | class SubRange {
|
16167 | constructor(low, high) {
|
16168 | this.low = low;
|
16169 | this.high = high;
|
16170 | this.length = 1 + high - low;
|
16171 | }
|
16172 |
|
16173 | overlaps(range) {
|
16174 | return !(this.high < range.low || this.low > range.high);
|
16175 | }
|
16176 |
|
16177 | touches(range) {
|
16178 | return !(this.high + 1 < range.low || this.low - 1 > range.high);
|
16179 | }
|
16180 |
|
16181 |
|
16182 | add(range) {
|
16183 | return new SubRange(
|
16184 | Math.min(this.low, range.low),
|
16185 | Math.max(this.high, range.high)
|
16186 | );
|
16187 | }
|
16188 |
|
16189 |
|
16190 |
|
16191 | subtract(range) {
|
16192 | if (range.low <= this.low && range.high >= this.high) {
|
16193 | return [];
|
16194 | } else if (range.low > this.low && range.high < this.high) {
|
16195 | return [
|
16196 | new SubRange(this.low, range.low - 1),
|
16197 | new SubRange(range.high + 1, this.high)
|
16198 | ];
|
16199 | } else if (range.low <= this.low) {
|
16200 | return [new SubRange(range.high + 1, this.high)];
|
16201 | } else {
|
16202 | return [new SubRange(this.low, range.low - 1)];
|
16203 | }
|
16204 | }
|
16205 |
|
16206 | toString() {
|
16207 | return this.low == this.high ?
|
16208 | this.low.toString() : this.low + '-' + this.high;
|
16209 | }
|
16210 | }
|
16211 |
|
16212 |
|
16213 | class DRange {
|
16214 | constructor(a, b) {
|
16215 | this.ranges = [];
|
16216 | this.length = 0;
|
16217 | if (a != null) this.add(a, b);
|
16218 | }
|
16219 |
|
16220 | _update_length() {
|
16221 | this.length = this.ranges.reduce((previous, range) => {
|
16222 | return previous + range.length;
|
16223 | }, 0);
|
16224 | }
|
16225 |
|
16226 | add(a, b) {
|
16227 | var _add = (subrange) => {
|
16228 | var i = 0;
|
16229 | while (i < this.ranges.length && !subrange.touches(this.ranges[i])) {
|
16230 | i++;
|
16231 | }
|
16232 | var newRanges = this.ranges.slice(0, i);
|
16233 | while (i < this.ranges.length && subrange.touches(this.ranges[i])) {
|
16234 | subrange = subrange.add(this.ranges[i]);
|
16235 | i++;
|
16236 | }
|
16237 | newRanges.push(subrange);
|
16238 | this.ranges = newRanges.concat(this.ranges.slice(i));
|
16239 | this._update_length();
|
16240 | }
|
16241 |
|
16242 | if (a instanceof DRange) {
|
16243 | a.ranges.forEach(_add);
|
16244 | } else {
|
16245 | if (b == null) b = a;
|
16246 | _add(new SubRange(a, b));
|
16247 | }
|
16248 | return this;
|
16249 | }
|
16250 |
|
16251 | subtract(a, b) {
|
16252 | var _subtract = (subrange) => {
|
16253 | var i = 0;
|
16254 | while (i < this.ranges.length && !subrange.overlaps(this.ranges[i])) {
|
16255 | i++;
|
16256 | }
|
16257 | var newRanges = this.ranges.slice(0, i);
|
16258 | while (i < this.ranges.length && subrange.overlaps(this.ranges[i])) {
|
16259 | newRanges = newRanges.concat(this.ranges[i].subtract(subrange));
|
16260 | i++;
|
16261 | }
|
16262 | this.ranges = newRanges.concat(this.ranges.slice(i));
|
16263 | this._update_length();
|
16264 | };
|
16265 |
|
16266 | if (a instanceof DRange) {
|
16267 | a.ranges.forEach(_subtract);
|
16268 | } else {
|
16269 | if (b == null) b = a;
|
16270 | _subtract(new SubRange(a, b));
|
16271 | }
|
16272 | return this;
|
16273 | }
|
16274 |
|
16275 | intersect(a, b) {
|
16276 | var newRanges = [];
|
16277 | var _intersect = (subrange) => {
|
16278 | var i = 0;
|
16279 | while (i < this.ranges.length && !subrange.overlaps(this.ranges[i])) {
|
16280 | i++;
|
16281 | }
|
16282 | while (i < this.ranges.length && subrange.overlaps(this.ranges[i])) {
|
16283 | var low = Math.max(this.ranges[i].low, subrange.low);
|
16284 | var high = Math.min(this.ranges[i].high, subrange.high);
|
16285 | newRanges.push(new SubRange(low, high));
|
16286 | i++;
|
16287 | }
|
16288 | };
|
16289 |
|
16290 | if (a instanceof DRange) {
|
16291 | a.ranges.forEach(_intersect);
|
16292 | } else {
|
16293 | if (b == null) b = a;
|
16294 | _intersect(new SubRange(a, b));
|
16295 | }
|
16296 | this.ranges = newRanges;
|
16297 | this._update_length();
|
16298 | return this;
|
16299 | }
|
16300 |
|
16301 | index(index) {
|
16302 | var i = 0;
|
16303 | while (i < this.ranges.length && this.ranges[i].length <= index) {
|
16304 | index -= this.ranges[i].length;
|
16305 | i++;
|
16306 | }
|
16307 | return this.ranges[i].low + index;
|
16308 | }
|
16309 |
|
16310 | toString() {
|
16311 | return '[ ' + this.ranges.join(', ') + ' ]';
|
16312 | }
|
16313 |
|
16314 | clone() {
|
16315 | return new DRange(this);
|
16316 | }
|
16317 |
|
16318 | numbers() {
|
16319 | return this.ranges.reduce((result, subrange) => {
|
16320 | var i = subrange.low;
|
16321 | while (i <= subrange.high) {
|
16322 | result.push(i);
|
16323 | i++;
|
16324 | }
|
16325 | return result;
|
16326 | }, []);
|
16327 | }
|
16328 |
|
16329 | subranges() {
|
16330 | return this.ranges.map((subrange) => ({
|
16331 | low: subrange.low,
|
16332 | high: subrange.high,
|
16333 | length: 1 + subrange.high - subrange.low
|
16334 | }));
|
16335 | }
|
16336 | }
|
16337 |
|
16338 | module.exports = DRange;
|
16339 |
|
16340 |
|
16341 | }),
|
16342 |
|
16343 | 251:
|
16344 | ((__unused_webpack_module, exports) => {
|
16345 |
|
16346 |
|
16347 | exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
16348 | var e, m
|
16349 | var eLen = (nBytes * 8) - mLen - 1
|
16350 | var eMax = (1 << eLen) - 1
|
16351 | var eBias = eMax >> 1
|
16352 | var nBits = -7
|
16353 | var i = isLE ? (nBytes - 1) : 0
|
16354 | var d = isLE ? -1 : 1
|
16355 | var s = buffer[offset + i]
|
16356 |
|
16357 | i += d
|
16358 |
|
16359 | e = s & ((1 << (-nBits)) - 1)
|
16360 | s >>= (-nBits)
|
16361 | nBits += eLen
|
16362 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
16363 |
|
16364 | m = e & ((1 << (-nBits)) - 1)
|
16365 | e >>= (-nBits)
|
16366 | nBits += mLen
|
16367 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
16368 |
|
16369 | if (e === 0) {
|
16370 | e = 1 - eBias
|
16371 | } else if (e === eMax) {
|
16372 | return m ? NaN : ((s ? -1 : 1) * Infinity)
|
16373 | } else {
|
16374 | m = m + Math.pow(2, mLen)
|
16375 | e = e - eBias
|
16376 | }
|
16377 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
16378 | }
|
16379 |
|
16380 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
16381 | var e, m, c
|
16382 | var eLen = (nBytes * 8) - mLen - 1
|
16383 | var eMax = (1 << eLen) - 1
|
16384 | var eBias = eMax >> 1
|
16385 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
16386 | var i = isLE ? 0 : (nBytes - 1)
|
16387 | var d = isLE ? 1 : -1
|
16388 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
16389 |
|
16390 | value = Math.abs(value)
|
16391 |
|
16392 | if (isNaN(value) || value === Infinity) {
|
16393 | m = isNaN(value) ? 1 : 0
|
16394 | e = eMax
|
16395 | } else {
|
16396 | e = Math.floor(Math.log(value) / Math.LN2)
|
16397 | if (value * (c = Math.pow(2, -e)) < 1) {
|
16398 | e--
|
16399 | c *= 2
|
16400 | }
|
16401 | if (e + eBias >= 1) {
|
16402 | value += rt / c
|
16403 | } else {
|
16404 | value += rt * Math.pow(2, 1 - eBias)
|
16405 | }
|
16406 | if (value * c >= 2) {
|
16407 | e++
|
16408 | c /= 2
|
16409 | }
|
16410 |
|
16411 | if (e + eBias >= eMax) {
|
16412 | m = 0
|
16413 | e = eMax
|
16414 | } else if (e + eBias >= 1) {
|
16415 | m = ((value * c) - 1) * Math.pow(2, mLen)
|
16416 | e = e + eBias
|
16417 | } else {
|
16418 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
16419 | e = 0
|
16420 | }
|
16421 | }
|
16422 |
|
16423 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
16424 |
|
16425 | e = (e << mLen) | m
|
16426 | eLen += mLen
|
16427 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
16428 |
|
16429 | buffer[offset + i - d] |= s * 128
|
16430 | }
|
16431 |
|
16432 |
|
16433 | }),
|
16434 |
|
16435 | 22:
|
16436 | (() => {
|
16437 |
|
16438 | (function (Prism) {
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 | var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
|
16444 |
|
16445 | var commandAfterHeredoc = {
|
16446 | pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
16447 | lookbehind: true,
|
16448 | alias: 'punctuation',
|
16449 | inside: null
|
16450 | };
|
16451 |
|
16452 | var insideString = {
|
16453 | 'bash': commandAfterHeredoc,
|
16454 | 'environment': {
|
16455 | pattern: RegExp('\\$' + envVars),
|
16456 | alias: 'constant'
|
16457 | },
|
16458 | 'variable': [
|
16459 |
|
16460 | {
|
16461 | pattern: /\$?\(\([\s\S]+?\)\)/,
|
16462 | greedy: true,
|
16463 | inside: {
|
16464 |
|
16465 | 'variable': [
|
16466 | {
|
16467 | pattern: /(^\$\(\([\s\S]+)\)\)/,
|
16468 | lookbehind: true
|
16469 | },
|
16470 | /^\$\(\(/
|
16471 | ],
|
16472 | 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
16473 |
|
16474 | 'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
16475 |
|
16476 | 'punctuation': /\(\(?|\)\)?|,|;/
|
16477 | }
|
16478 | },
|
16479 |
|
16480 | {
|
16481 | pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
16482 | greedy: true,
|
16483 | inside: {
|
16484 | 'variable': /^\$\(|^`|\)$|`$/
|
16485 | }
|
16486 | },
|
16487 |
|
16488 | {
|
16489 | pattern: /\$\{[^}]+\}/,
|
16490 | greedy: true,
|
16491 | inside: {
|
16492 | 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
16493 | 'punctuation': /[\[\]]/,
|
16494 | 'environment': {
|
16495 | pattern: RegExp('(\\{)' + envVars),
|
16496 | lookbehind: true,
|
16497 | alias: 'constant'
|
16498 | }
|
16499 | }
|
16500 | },
|
16501 | /\$(?:\w+|[#?*!@$])/
|
16502 | ],
|
16503 |
|
16504 | 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
16505 | };
|
16506 |
|
16507 | Prism.languages.bash = {
|
16508 | 'shebang': {
|
16509 | pattern: /^#!\s*\/.*/,
|
16510 | alias: 'important'
|
16511 | },
|
16512 | 'comment': {
|
16513 | pattern: /(^|[^"{\\$])#.*/,
|
16514 | lookbehind: true
|
16515 | },
|
16516 | 'function-name': [
|
16517 |
|
16518 |
|
16519 |
|
16520 |
|
16521 | {
|
16522 |
|
16523 | pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
16524 | lookbehind: true,
|
16525 | alias: 'function'
|
16526 | },
|
16527 | {
|
16528 |
|
16529 | pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
16530 | alias: 'function'
|
16531 | }
|
16532 | ],
|
16533 |
|
16534 | 'for-or-select': {
|
16535 | pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
16536 | alias: 'variable',
|
16537 | lookbehind: true
|
16538 | },
|
16539 |
|
16540 |
|
16541 | 'assign-left': {
|
16542 | pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
16543 | inside: {
|
16544 | 'environment': {
|
16545 | pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
|
16546 | lookbehind: true,
|
16547 | alias: 'constant'
|
16548 | }
|
16549 | },
|
16550 | alias: 'variable',
|
16551 | lookbehind: true
|
16552 | },
|
16553 |
|
16554 | 'parameter': {
|
16555 | pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
16556 | alias: 'variable',
|
16557 | lookbehind: true
|
16558 | },
|
16559 | 'string': [
|
16560 |
|
16561 | {
|
16562 | pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
16563 | lookbehind: true,
|
16564 | greedy: true,
|
16565 | inside: insideString
|
16566 | },
|
16567 |
|
16568 |
|
16569 | {
|
16570 | pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
16571 | lookbehind: true,
|
16572 | greedy: true,
|
16573 | inside: {
|
16574 | 'bash': commandAfterHeredoc
|
16575 | }
|
16576 | },
|
16577 |
|
16578 | {
|
16579 |
|
16580 | pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
16581 | lookbehind: true,
|
16582 | greedy: true,
|
16583 | inside: insideString
|
16584 | },
|
16585 | {
|
16586 |
|
16587 | pattern: /(^|[^$\\])'[^']*'/,
|
16588 | lookbehind: true,
|
16589 | greedy: true
|
16590 | },
|
16591 | {
|
16592 |
|
16593 | pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
16594 | greedy: true,
|
16595 | inside: {
|
16596 | 'entity': insideString.entity
|
16597 | }
|
16598 | }
|
16599 | ],
|
16600 | 'environment': {
|
16601 | pattern: RegExp('\\$?' + envVars),
|
16602 | alias: 'constant'
|
16603 | },
|
16604 | 'variable': insideString.variable,
|
16605 | 'function': {
|
16606 | pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
16607 | lookbehind: true
|
16608 | },
|
16609 | 'keyword': {
|
16610 | pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
16611 | lookbehind: true
|
16612 | },
|
16613 |
|
16614 | 'builtin': {
|
16615 | pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
16616 | lookbehind: true,
|
16617 |
|
16618 | alias: 'class-name'
|
16619 | },
|
16620 | 'boolean': {
|
16621 | pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
16622 | lookbehind: true
|
16623 | },
|
16624 | 'file-descriptor': {
|
16625 | pattern: /\B&\d\b/,
|
16626 | alias: 'important'
|
16627 | },
|
16628 | 'operator': {
|
16629 |
|
16630 | pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
16631 | inside: {
|
16632 | 'file-descriptor': {
|
16633 | pattern: /^\d/,
|
16634 | alias: 'important'
|
16635 | }
|
16636 | }
|
16637 | },
|
16638 | 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
16639 | 'number': {
|
16640 | pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
16641 | lookbehind: true
|
16642 | }
|
16643 | };
|
16644 |
|
16645 | commandAfterHeredoc.inside = Prism.languages.bash;
|
16646 |
|
16647 |
|
16648 | var toBeCopied = [
|
16649 | 'comment',
|
16650 | 'function-name',
|
16651 | 'for-or-select',
|
16652 | 'assign-left',
|
16653 | 'parameter',
|
16654 | 'string',
|
16655 | 'environment',
|
16656 | 'function',
|
16657 | 'keyword',
|
16658 | 'builtin',
|
16659 | 'boolean',
|
16660 | 'file-descriptor',
|
16661 | 'operator',
|
16662 | 'punctuation',
|
16663 | 'number'
|
16664 | ];
|
16665 | var inside = insideString.variable[1].inside;
|
16666 | for (var i = 0; i < toBeCopied.length; i++) {
|
16667 | inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
16668 | }
|
16669 |
|
16670 | Prism.languages.sh = Prism.languages.bash;
|
16671 | Prism.languages.shell = Prism.languages.bash;
|
16672 | }(Prism));
|
16673 |
|
16674 |
|
16675 | }),
|
16676 |
|
16677 | 651:
|
16678 | (() => {
|
16679 |
|
16680 | (function (Prism) {
|
16681 |
|
16682 | |
16683 |
|
16684 |
|
16685 |
|
16686 |
|
16687 |
|
16688 |
|
16689 |
|
16690 |
|
16691 |
|
16692 | function replace(pattern, replacements) {
|
16693 | return pattern.replace(/<<(\d+)>>/g, function (m, index) {
|
16694 | return '(?:' + replacements[+index] + ')';
|
16695 | });
|
16696 | }
|
16697 | |
16698 |
|
16699 |
|
16700 |
|
16701 |
|
16702 |
|
16703 | function re(pattern, replacements, flags) {
|
16704 | return RegExp(replace(pattern, replacements), flags || '');
|
16705 | }
|
16706 |
|
16707 | |
16708 |
|
16709 |
|
16710 |
|
16711 |
|
16712 |
|
16713 |
|
16714 | function nested(pattern, depthLog2) {
|
16715 | for (var i = 0; i < depthLog2; i++) {
|
16716 | pattern = pattern.replace(/<<self>>/g, function () { return '(?:' + pattern + ')'; });
|
16717 | }
|
16718 | return pattern.replace(/<<self>>/g, '[^\\s\\S]');
|
16719 | }
|
16720 |
|
16721 |
|
16722 | var keywordKinds = {
|
16723 |
|
16724 | type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
|
16725 |
|
16726 | typeDeclaration: 'class enum interface record struct',
|
16727 |
|
16728 |
|
16729 | contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
|
16730 |
|
16731 | other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
|
16732 | };
|
16733 |
|
16734 |
|
16735 | function keywordsToPattern(words) {
|
16736 | return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
|
16737 | }
|
16738 | var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
|
16739 | var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
|
16740 | var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
|
16741 | var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
|
16742 |
|
16743 |
|
16744 | var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
|
16745 | var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
|
16746 | var name = /@?\b[A-Za-z_]\w*\b/.source;
|
16747 | var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]);
|
16748 | var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]);
|
16749 | var array = /\[\s*(?:,\s*)*\]/.source;
|
16750 | var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [identifier, array]);
|
16751 | var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]);
|
16752 | var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
|
16753 | var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]);
|
16754 |
|
16755 | var typeInside = {
|
16756 | 'keyword': keywords,
|
16757 | 'punctuation': /[<>()?,.:[\]]/
|
16758 | };
|
16759 |
|
16760 |
|
16761 |
|
16762 |
|
16763 | var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
|
16764 | var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
|
16765 | var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
|
16766 |
|
16767 |
|
16768 | Prism.languages.csharp = Prism.languages.extend('clike', {
|
16769 | 'string': [
|
16770 | {
|
16771 | pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
|
16772 | lookbehind: true,
|
16773 | greedy: true
|
16774 | },
|
16775 | {
|
16776 | pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
|
16777 | lookbehind: true,
|
16778 | greedy: true
|
16779 | }
|
16780 | ],
|
16781 | 'class-name': [
|
16782 | {
|
16783 |
|
16784 |
|
16785 | pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
|
16786 | lookbehind: true,
|
16787 | inside: typeInside
|
16788 | },
|
16789 | {
|
16790 |
|
16791 |
|
16792 | pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]),
|
16793 | lookbehind: true,
|
16794 | inside: typeInside
|
16795 | },
|
16796 | {
|
16797 |
|
16798 |
|
16799 | pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
|
16800 | lookbehind: true
|
16801 | },
|
16802 | {
|
16803 |
|
16804 |
|
16805 |
|
16806 | pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]),
|
16807 | lookbehind: true,
|
16808 | inside: typeInside
|
16809 | },
|
16810 | {
|
16811 |
|
16812 |
|
16813 |
|
16814 | pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
|
16815 | lookbehind: true,
|
16816 | inside: typeInside
|
16817 | },
|
16818 | {
|
16819 |
|
16820 |
|
16821 | pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
|
16822 | lookbehind: true
|
16823 | },
|
16824 | {
|
16825 |
|
16826 |
|
16827 |
|
16828 | pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
|
16829 | lookbehind: true,
|
16830 | inside: typeInside
|
16831 | },
|
16832 | {
|
16833 |
|
16834 |
|
16835 | pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]),
|
16836 | inside: typeInside
|
16837 | }
|
16838 | ],
|
16839 | 'keyword': keywords,
|
16840 |
|
16841 | 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
|
16842 | 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
|
16843 | 'punctuation': /\?\.?|::|[{}[\];(),.:]/
|
16844 | });
|
16845 |
|
16846 | Prism.languages.insertBefore('csharp', 'number', {
|
16847 | 'range': {
|
16848 | pattern: /\.\./,
|
16849 | alias: 'operator'
|
16850 | }
|
16851 | });
|
16852 |
|
16853 | Prism.languages.insertBefore('csharp', 'punctuation', {
|
16854 | 'named-parameter': {
|
16855 | pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
|
16856 | lookbehind: true,
|
16857 | alias: 'punctuation'
|
16858 | }
|
16859 | });
|
16860 |
|
16861 | Prism.languages.insertBefore('csharp', 'class-name', {
|
16862 | 'namespace': {
|
16863 |
|
16864 |
|
16865 | pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
|
16866 | lookbehind: true,
|
16867 | inside: {
|
16868 | 'punctuation': /\./
|
16869 | }
|
16870 | },
|
16871 | 'type-expression': {
|
16872 |
|
16873 | pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
|
16874 | lookbehind: true,
|
16875 | alias: 'class-name',
|
16876 | inside: typeInside
|
16877 | },
|
16878 | 'return-type': {
|
16879 |
|
16880 |
|
16881 |
|
16882 | pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]),
|
16883 | inside: typeInside,
|
16884 | alias: 'class-name'
|
16885 | },
|
16886 | 'constructor-invocation': {
|
16887 |
|
16888 | pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
|
16889 | lookbehind: true,
|
16890 | inside: typeInside,
|
16891 | alias: 'class-name'
|
16892 | },
|
16893 | |
16894 |
|
16895 |
|
16896 |
|
16897 |
|
16898 |
|
16899 | 'generic-method': {
|
16900 |
|
16901 | pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]),
|
16902 | inside: {
|
16903 | 'function': re(/^<<0>>/.source, [name]),
|
16904 | 'generic': {
|
16905 | pattern: RegExp(generic),
|
16906 | alias: 'class-name',
|
16907 | inside: typeInside
|
16908 | }
|
16909 | }
|
16910 | },
|
16911 | 'type-list': {
|
16912 |
|
16913 |
|
16914 |
|
16915 | pattern: re(
|
16916 | /\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,
|
16917 | [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source]
|
16918 | ),
|
16919 | lookbehind: true,
|
16920 | inside: {
|
16921 | 'record-arguments': {
|
16922 | pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]),
|
16923 | lookbehind: true,
|
16924 | greedy: true,
|
16925 | inside: Prism.languages.csharp
|
16926 | },
|
16927 | 'keyword': keywords,
|
16928 | 'class-name': {
|
16929 | pattern: RegExp(typeExpression),
|
16930 | greedy: true,
|
16931 | inside: typeInside
|
16932 | },
|
16933 | 'punctuation': /[,()]/
|
16934 | }
|
16935 | },
|
16936 | 'preprocessor': {
|
16937 | pattern: /(^[\t ]*)#.*/m,
|
16938 | lookbehind: true,
|
16939 | alias: 'property',
|
16940 | inside: {
|
16941 | // highlight preprocessor directives as keywords
|
16942 | 'directive': {
|
16943 | pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
|
16944 | lookbehind: true,
|
16945 | alias: 'keyword'
|
16946 | }
|
16947 | }
|
16948 | }
|
16949 | });
|
16950 |
|
16951 | // attributes
|
16952 | var regularStringOrCharacter = regularString + '|' + character;
|
16953 | var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
|
16954 | var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
|
16955 |
|
16956 | // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets
|
16957 | var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
|
16958 | var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]);
|
16959 |
|
16960 | Prism.languages.insertBefore('csharp', 'class-name', {
|
16961 | 'attribute': {
|
16962 | // Attributes
|
16963 | // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
|
16964 | pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]),
|
16965 | lookbehind: true,
|
16966 | greedy: true,
|
16967 | inside: {
|
16968 | 'target': {
|
16969 | pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
|
16970 | alias: 'keyword'
|
16971 | },
|
16972 | 'attribute-arguments': {
|
16973 | pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
|
16974 | inside: Prism.languages.csharp
|
16975 | },
|
16976 | 'class-name': {
|
16977 | pattern: RegExp(identifier),
|
16978 | inside: {
|
16979 | 'punctuation': /\./
|
16980 | }
|
16981 | },
|
16982 | 'punctuation': /[:,]/
|
16983 | }
|
16984 | }
|
16985 | });
|
16986 |
|
16987 |
|
16988 | // string interpolation
|
16989 | var formatString = /:[^}\r\n]+/.source;
|
16990 | // multi line
|
16991 | var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
|
16992 | var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);
|
16993 | // single line
|
16994 | var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
|
16995 | var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
|
16996 |
|
16997 | function createInterpolationInside(interpolation, interpolationRound) {
|
16998 | return {
|
16999 | 'interpolation': {
|
17000 | pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
|
17001 | lookbehind: true,
|
17002 | inside: {
|
17003 | 'format-string': {
|
17004 | pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]),
|
17005 | lookbehind: true,
|
17006 | inside: {
|
17007 | 'punctuation': /^:/
|
17008 | }
|
17009 | },
|
17010 | 'punctuation': /^\{|\}$/,
|
17011 | 'expression': {
|
17012 | pattern: /[\s\S]+/,
|
17013 | alias: 'language-csharp',
|
17014 | inside: Prism.languages.csharp
|
17015 | }
|
17016 | }
|
17017 | },
|
17018 | 'string': /[\s\S]+/
|
17019 | };
|
17020 | }
|
17021 |
|
17022 | Prism.languages.insertBefore('csharp', 'string', {
|
17023 | 'interpolation-string': [
|
17024 | {
|
17025 | pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
|
17026 | lookbehind: true,
|
17027 | greedy: true,
|
17028 | inside: createInterpolationInside(mInterpolation, mInterpolationRound),
|
17029 | },
|
17030 | {
|
17031 | pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
|
17032 | lookbehind: true,
|
17033 | greedy: true,
|
17034 | inside: createInterpolationInside(sInterpolation, sInterpolationRound),
|
17035 | }
|
17036 | ],
|
17037 | 'char': {
|
17038 | pattern: RegExp(character),
|
17039 | greedy: true
|
17040 | }
|
17041 | });
|
17042 |
|
17043 | Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
|
17044 |
|
17045 | }(Prism));
|
17046 |
|
17047 |
|
17048 | /***/ }),
|
17049 |
|
17050 | /***/ 113:
|
17051 | /***/ (() => {
|
17052 |
|
17053 | (function (Prism) {
|
17054 |
|
17055 | var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
17056 |
|
17057 | Prism.languages.css = {
|
17058 | 'comment': /\/\*[\s\S]*?\*\//,
|
17059 | 'atrule': {
|
17060 | pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
17061 | inside: {
|
17062 | 'rule': /^@[\w-]+/,
|
17063 | 'selector-function-argument': {
|
17064 | pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
17065 | lookbehind: true,
|
17066 | alias: 'selector'
|
17067 | },
|
17068 | 'keyword': {
|
17069 | pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
17070 | lookbehind: true
|
17071 | }
|
17072 | // See rest below
|
17073 | }
|
17074 | },
|
17075 | 'url': {
|
17076 | // https://drafts.csswg.org/css-values-3/#urls
|
17077 | pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
17078 | greedy: true,
|
17079 | inside: {
|
17080 | 'function': /^url/i,
|
17081 | 'punctuation': /^\(|\)$/,
|
17082 | 'string': {
|
17083 | pattern: RegExp('^' + string.source + '$'),
|
17084 | alias: 'url'
|
17085 | }
|
17086 | }
|
17087 | },
|
17088 | 'selector': {
|
17089 | pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
17090 | lookbehind: true
|
17091 | },
|
17092 | 'string': {
|
17093 | pattern: string,
|
17094 | greedy: true
|
17095 | },
|
17096 | 'property': {
|
17097 | pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
17098 | lookbehind: true
|
17099 | },
|
17100 | 'important': /!important\b/i,
|
17101 | 'function': {
|
17102 | pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
17103 | lookbehind: true
|
17104 | },
|
17105 | 'punctuation': /[(){};:,]/
|
17106 | };
|
17107 |
|
17108 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
17109 |
|
17110 | var markup = Prism.languages.markup;
|
17111 | if (markup) {
|
17112 | markup.tag.addInlined('style', 'css');
|
17113 | markup.tag.addAttribute('style', 'css');
|
17114 | }
|
17115 |
|
17116 | }(Prism));
|
17117 |
|
17118 |
|
17119 | /***/ }),
|
17120 |
|
17121 | /***/ 378:
|
17122 | /***/ (() => {
|
17123 |
|
17124 | Prism.languages.go = Prism.languages.extend('clike', {
|
17125 | 'string': {
|
17126 | pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
|
17127 | lookbehind: true,
|
17128 | greedy: true
|
17129 | },
|
17130 | 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
17131 | 'boolean': /\b(?:_|false|iota|nil|true)\b/,
|
17132 | 'number': [
|
17133 | // binary and octal integers
|
17134 | /\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
17135 | // hexadecimal integers and floats
|
17136 | /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
17137 | // decimal integers and floats
|
17138 | /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
17139 | ],
|
17140 | 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
|
17141 | 'builtin': /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
|
17142 | });
|
17143 |
|
17144 | Prism.languages.insertBefore('go', 'string', {
|
17145 | 'char': {
|
17146 | pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
|
17147 | greedy: true
|
17148 | }
|
17149 | });
|
17150 |
|
17151 | delete Prism.languages.go['class-name'];
|
17152 |
|
17153 |
|
17154 | /***/ }),
|
17155 |
|
17156 | /***/ 784:
|
17157 | /***/ (() => {
|
17158 |
|
17159 | (function (Prism) {
|
17160 |
|
17161 | /**
|
17162 | * @param {string} name
|
17163 | * @returns {RegExp}
|
17164 | */
|
17165 | function headerValueOf(name) {
|
17166 | return RegExp('(^(?:' + name + '):[ \t]*(?![ \t]))[^]+', 'i');
|
17167 | }
|
17168 |
|
17169 | Prism.languages.http = {
|
17170 | 'request-line': {
|
17171 | pattern: /^(?:CONNECT|DELETE|GET|HEAD|OPTIONS|PATCH|POST|PRI|PUT|SEARCH|TRACE)\s(?:https?:\/\/|\/)\S*\sHTTP\/[\d.]+/m,
|
17172 | inside: {
|
17173 | // HTTP Method
|
17174 | 'method': {
|
17175 | pattern: /^[A-Z]+\b/,
|
17176 | alias: 'property'
|
17177 | },
|
17178 | // Request Target e.g. http://example.com, /path/to/file
|
17179 | 'request-target': {
|
17180 | pattern: /^(\s)(?:https?:\/\/|\/)\S*(?=\s)/,
|
17181 | lookbehind: true,
|
17182 | alias: 'url',
|
17183 | inside: Prism.languages.uri
|
17184 | },
|
17185 | // HTTP Version
|
17186 | 'http-version': {
|
17187 | pattern: /^(\s)HTTP\/[\d.]+/,
|
17188 | lookbehind: true,
|
17189 | alias: 'property'
|
17190 | },
|
17191 | }
|
17192 | },
|
17193 | 'response-status': {
|
17194 | pattern: /^HTTP\/[\d.]+ \d+ .+/m,
|
17195 | inside: {
|
17196 | // HTTP Version
|
17197 | 'http-version': {
|
17198 | pattern: /^HTTP\/[\d.]+/,
|
17199 | alias: 'property'
|
17200 | },
|
17201 | // Status Code
|
17202 | 'status-code': {
|
17203 | pattern: /^(\s)\d+(?=\s)/,
|
17204 | lookbehind: true,
|
17205 | alias: 'number'
|
17206 | },
|
17207 | // Reason Phrase
|
17208 | 'reason-phrase': {
|
17209 | pattern: /^(\s).+/,
|
17210 | lookbehind: true,
|
17211 | alias: 'string'
|
17212 | }
|
17213 | }
|
17214 | },
|
17215 | 'header': {
|
17216 | pattern: /^[\w-]+:.+(?:(?:\r\n?|\n)[ \t].+)*/m,
|
17217 | inside: {
|
17218 | 'header-value': [
|
17219 | {
|
17220 | pattern: headerValueOf(/Content-Security-Policy/.source),
|
17221 | lookbehind: true,
|
17222 | alias: ['csp', 'languages-csp'],
|
17223 | inside: Prism.languages.csp
|
17224 | },
|
17225 | {
|
17226 | pattern: headerValueOf(/Public-Key-Pins(?:-Report-Only)?/.source),
|
17227 | lookbehind: true,
|
17228 | alias: ['hpkp', 'languages-hpkp'],
|
17229 | inside: Prism.languages.hpkp
|
17230 | },
|
17231 | {
|
17232 | pattern: headerValueOf(/Strict-Transport-Security/.source),
|
17233 | lookbehind: true,
|
17234 | alias: ['hsts', 'languages-hsts'],
|
17235 | inside: Prism.languages.hsts
|
17236 | },
|
17237 | {
|
17238 | pattern: headerValueOf(/[^:]+/.source),
|
17239 | lookbehind: true
|
17240 | }
|
17241 | ],
|
17242 | 'header-name': {
|
17243 | pattern: /^[^:]+/,
|
17244 | alias: 'keyword'
|
17245 | },
|
17246 | 'punctuation': /^:/
|
17247 | }
|
17248 | }
|
17249 | };
|
17250 |
|
17251 | // Create a mapping of Content-Type headers to language definitions
|
17252 | var langs = Prism.languages;
|
17253 | var httpLanguages = {
|
17254 | 'application/javascript': langs.javascript,
|
17255 | 'application/json': langs.json || langs.javascript,
|
17256 | 'application/xml': langs.xml,
|
17257 | 'text/xml': langs.xml,
|
17258 | 'text/html': langs.html,
|
17259 | 'text/css': langs.css,
|
17260 | 'text/plain': langs.plain
|
17261 | };
|
17262 |
|
17263 | // Declare which types can also be suffixes
|
17264 | var suffixTypes = {
|
17265 | 'application/json': true,
|
17266 | 'application/xml': true
|
17267 | };
|
17268 |
|
17269 | /**
|
17270 | * Returns a pattern for the given content type which matches it and any type which has it as a suffix.
|
17271 | *
|
17272 | * @param {string} contentType
|
17273 | * @returns {string}
|
17274 | */
|
17275 | function getSuffixPattern(contentType) {
|
17276 | var suffix = contentType.replace(/^[a-z]+\//, '');
|
17277 | var suffixPattern = '\\w+/(?:[\\w.-]+\\+)+' + suffix + '(?![+\\w.-])';
|
17278 | return '(?:' + contentType + '|' + suffixPattern + ')';
|
17279 | }
|
17280 |
|
17281 | // Insert each content type parser that has its associated language
|
17282 | // currently loaded.
|
17283 | var options;
|
17284 | for (var contentType in httpLanguages) {
|
17285 | if (httpLanguages[contentType]) {
|
17286 | options = options || {};
|
17287 |
|
17288 | var pattern = suffixTypes[contentType] ? getSuffixPattern(contentType) : contentType;
|
17289 | options[contentType.replace(/\//g, '-')] = {
|
17290 | pattern: RegExp(
|
17291 | '(' + /content-type:\s*/.source + pattern + /(?:(?:\r\n?|\n)[\w-].*)*(?:\r(?:\n|(?!\n))|\n)/.source + ')' +
|
17292 | // This is a little interesting:
|
17293 | // The HTTP format spec required 1 empty line before the body to make everything unambiguous.
|
17294 | // However, when writing code by hand (e.g. to display on a website) people can forget about this,
|
17295 | // so we want to be liberal here. We will allow the empty line to be omitted if the first line of
|
17296 | // the body does not start with a [\w-] character (as headers do).
|
17297 | /[^ \t\w-][\s\S]*/.source,
|
17298 | 'i'
|
17299 | ),
|
17300 | lookbehind: true,
|
17301 | inside: httpLanguages[contentType]
|
17302 | };
|
17303 | }
|
17304 | }
|
17305 | if (options) {
|
17306 | Prism.languages.insertBefore('http', 'header', options);
|
17307 | }
|
17308 |
|
17309 | }(Prism));
|
17310 |
|
17311 |
|
17312 | /***/ }),
|
17313 |
|
17314 | /***/ 976:
|
17315 | /***/ (() => {
|
17316 |
|
17317 | (function (Prism) {
|
17318 |
|
17319 | var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
|
17320 |
|
17321 | // full package (optional) + parent classes (optional)
|
17322 | var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
|
17323 |
|
17324 | // based on the java naming conventions
|
17325 | var className = {
|
17326 | pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
17327 | lookbehind: true,
|
17328 | inside: {
|
17329 | 'namespace': {
|
17330 | pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
17331 | inside: {
|
17332 | 'punctuation': /\./
|
17333 | }
|
17334 | },
|
17335 | 'punctuation': /\./
|
17336 | }
|
17337 | };
|
17338 |
|
17339 | Prism.languages.java = Prism.languages.extend('clike', {
|
17340 | 'string': {
|
17341 | pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
17342 | lookbehind: true,
|
17343 | greedy: true
|
17344 | },
|
17345 | 'class-name': [
|
17346 | className,
|
17347 | {
|
17348 | // variables, parameters, and constructor references
|
17349 | // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
17350 | pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
|
17351 | lookbehind: true,
|
17352 | inside: className.inside
|
17353 | },
|
17354 | {
|
17355 | // class names based on keyword
|
17356 | // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
17357 | pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
|
17358 | lookbehind: true,
|
17359 | inside: className.inside
|
17360 | }
|
17361 | ],
|
17362 | 'keyword': keywords,
|
17363 | 'function': [
|
17364 | Prism.languages.clike.function,
|
17365 | {
|
17366 | pattern: /(::\s*)[a-z_]\w*/,
|
17367 | lookbehind: true
|
17368 | }
|
17369 | ],
|
17370 | 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
17371 | 'operator': {
|
17372 | pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
17373 | lookbehind: true
|
17374 | },
|
17375 | 'constant': /\b[A-Z][A-Z_\d]+\b/
|
17376 | });
|
17377 |
|
17378 | Prism.languages.insertBefore('java', 'string', {
|
17379 | 'triple-quoted-string': {
|
17380 | // http://openjdk.java.net/jeps/355#Description
|
17381 | pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
17382 | greedy: true,
|
17383 | alias: 'string'
|
17384 | },
|
17385 | 'char': {
|
17386 | pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
17387 | greedy: true
|
17388 | }
|
17389 | });
|
17390 |
|
17391 | Prism.languages.insertBefore('java', 'class-name', {
|
17392 | 'annotation': {
|
17393 | pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
17394 | lookbehind: true,
|
17395 | alias: 'punctuation'
|
17396 | },
|
17397 | 'generics': {
|
17398 | pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
17399 | inside: {
|
17400 | 'class-name': className,
|
17401 | 'keyword': keywords,
|
17402 | 'punctuation': /[<>(),.:]/,
|
17403 | 'operator': /[?&|]/
|
17404 | }
|
17405 | },
|
17406 | 'import': [
|
17407 | {
|
17408 | pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
|
17409 | lookbehind: true,
|
17410 | inside: {
|
17411 | 'namespace': className.inside.namespace,
|
17412 | 'punctuation': /\./,
|
17413 | 'operator': /\*/,
|
17414 | 'class-name': /\w+/
|
17415 | }
|
17416 | },
|
17417 | {
|
17418 | pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
|
17419 | lookbehind: true,
|
17420 | alias: 'static',
|
17421 | inside: {
|
17422 | 'namespace': className.inside.namespace,
|
17423 | 'static': /\b\w+$/,
|
17424 | 'punctuation': /\./,
|
17425 | 'operator': /\*/,
|
17426 | 'class-name': /\w+/
|
17427 | }
|
17428 | }
|
17429 | ],
|
17430 | 'namespace': {
|
17431 | pattern: RegExp(
|
17432 | /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
|
17433 | .source.replace(/<keyword>/g, function () { return keywords.source; })),
|
17434 | lookbehind: true,
|
17435 | inside: {
|
17436 | 'punctuation': /\./,
|
17437 | }
|
17438 | }
|
17439 | });
|
17440 | }(Prism));
|
17441 |
|
17442 |
|
17443 | /***/ }),
|
17444 |
|
17445 | /***/ 514:
|
17446 | /***/ (() => {
|
17447 |
|
17448 | // https://www.json.org/json-en.html
|
17449 | Prism.languages.json = {
|
17450 | 'property': {
|
17451 | pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
17452 | lookbehind: true,
|
17453 | greedy: true
|
17454 | },
|
17455 | 'string': {
|
17456 | pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
17457 | lookbehind: true,
|
17458 | greedy: true
|
17459 | },
|
17460 | 'comment': {
|
17461 | pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
17462 | greedy: true
|
17463 | },
|
17464 | 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
17465 | 'punctuation': /[{}[\],]/,
|
17466 | 'operator': /:/,
|
17467 | 'boolean': /\b(?:false|true)\b/,
|
17468 | 'null': {
|
17469 | pattern: /\bnull\b/,
|
17470 | alias: 'keyword'
|
17471 | }
|
17472 | };
|
17473 |
|
17474 | Prism.languages.webmanifest = Prism.languages.json;
|
17475 |
|
17476 |
|
17477 | /***/ }),
|
17478 |
|
17479 | /***/ 342:
|
17480 | /***/ (() => {
|
17481 |
|
17482 | Prism.languages.python = {
|
17483 | 'comment': {
|
17484 | pattern: /(^|[^\\])#.*/,
|
17485 | lookbehind: true,
|
17486 | greedy: true
|
17487 | },
|
17488 | 'string-interpolation': {
|
17489 | pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
17490 | greedy: true,
|
17491 | inside: {
|
17492 | 'interpolation': {
|
17493 | // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
17494 | pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
17495 | lookbehind: true,
|
17496 | inside: {
|
17497 | 'format-spec': {
|
17498 | pattern: /(:)[^:(){}]+(?=\}$)/,
|
17499 | lookbehind: true
|
17500 | },
|
17501 | 'conversion-option': {
|
17502 | pattern: /![sra](?=[:}]$)/,
|
17503 | alias: 'punctuation'
|
17504 | },
|
17505 | rest: null
|
17506 | }
|
17507 | },
|
17508 | 'string': /[\s\S]+/
|
17509 | }
|
17510 | },
|
17511 | 'triple-quoted-string': {
|
17512 | pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
17513 | greedy: true,
|
17514 | alias: 'string'
|
17515 | },
|
17516 | 'string': {
|
17517 | pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
17518 | greedy: true
|
17519 | },
|
17520 | 'function': {
|
17521 | pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
17522 | lookbehind: true
|
17523 | },
|
17524 | 'class-name': {
|
17525 | pattern: /(\bclass\s+)\w+/i,
|
17526 | lookbehind: true
|
17527 | },
|
17528 | 'decorator': {
|
17529 | pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
17530 | lookbehind: true,
|
17531 | alias: ['annotation', 'punctuation'],
|
17532 | inside: {
|
17533 | 'punctuation': /\./
|
17534 | }
|
17535 | },
|
17536 | 'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
17537 | 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
17538 | 'boolean': /\b(?:False|None|True)\b/,
|
17539 | 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
17540 | 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
17541 | 'punctuation': /[{}[\];(),.:]/
|
17542 | };
|
17543 |
|
17544 | Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
|
17545 |
|
17546 | Prism.languages.py = Prism.languages.python;
|
17547 |
|
17548 |
|
17549 | /***/ }),
|
17550 |
|
17551 | /***/ 83:
|
17552 | /***/ (() => {
|
17553 |
|
17554 | (function (Prism) {
|
17555 |
|
17556 | // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
17557 | // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
17558 | var anchorOrAlias = /[*&][^\s[\]{},]+/;
|
17559 | // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
17560 | var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
17561 | // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
17562 | var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
|
17563 | + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
|
17564 | // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
17565 | // This is a simplified version that doesn't support "#" and multiline keys
|
17566 | // All these long scarry character classes are simplified versions of YAML's characters
|
17567 | var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
|
17568 | .replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
|
17569 | var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
17570 |
|
17571 | /**
|
17572 | *
|
17573 | * @param {string} value
|
17574 | * @param {string} [flags]
|
17575 | * @returns {RegExp}
|
17576 | */
|
17577 | function createValuePattern(value, flags) {
|
17578 | flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
|
17579 | var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
|
17580 | .replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
|
17581 | return RegExp(pattern, flags);
|
17582 | }
|
17583 |
|
17584 | Prism.languages.yaml = {
|
17585 | 'scalar': {
|
17586 | pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
|
17587 | .replace(/<<prop>>/g, function () { return properties; })),
|
17588 | lookbehind: true,
|
17589 | alias: 'string'
|
17590 | },
|
17591 | 'comment': /#.*/,
|
17592 | 'key': {
|
17593 | pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
|
17594 | .replace(/<<prop>>/g, function () { return properties; })
|
17595 | .replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
|
17596 | lookbehind: true,
|
17597 | greedy: true,
|
17598 | alias: 'atrule'
|
17599 | },
|
17600 | 'directive': {
|
17601 | pattern: /(^[ \t]*)%.+/m,
|
17602 | lookbehind: true,
|
17603 | alias: 'important'
|
17604 | },
|
17605 | 'datetime': {
|
17606 | pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
|
17607 | lookbehind: true,
|
17608 | alias: 'number'
|
17609 | },
|
17610 | 'boolean': {
|
17611 | pattern: createValuePattern(/false|true/.source, 'i'),
|
17612 | lookbehind: true,
|
17613 | alias: 'important'
|
17614 | },
|
17615 | 'null': {
|
17616 | pattern: createValuePattern(/null|~/.source, 'i'),
|
17617 | lookbehind: true,
|
17618 | alias: 'important'
|
17619 | },
|
17620 | 'string': {
|
17621 | pattern: createValuePattern(string),
|
17622 | lookbehind: true,
|
17623 | greedy: true
|
17624 | },
|
17625 | 'number': {
|
17626 | pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
|
17627 | lookbehind: true
|
17628 | },
|
17629 | 'tag': tag,
|
17630 | 'important': anchorOrAlias,
|
17631 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
|
17632 | };
|
17633 |
|
17634 | Prism.languages.yml = Prism.languages.yaml;
|
17635 |
|
17636 | }(Prism));
|
17637 |
|
17638 |
|
17639 | /***/ }),
|
17640 |
|
17641 | /***/ 848:
|
17642 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
17643 |
|
17644 |
|
17645 | /* **********************************************
|
17646 | Begin prism-core.js
|
17647 | ********************************************** */
|
17648 |
|
17649 | /// <reference lib="WebWorker"/>
|
17650 |
|
17651 | var _self = (typeof window !== 'undefined')
|
17652 | ? window // if in browser
|
17653 | : (
|
17654 | (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
17655 | ? self // if in worker
|
17656 | : {} // if in node js
|
17657 | );
|
17658 |
|
17659 | /**
|
17660 | * Prism: Lightweight, robust, elegant syntax highlighting
|
17661 | *
|
17662 | * @license MIT <https://opensource.org/licenses/MIT>
|
17663 | * @author Lea Verou <https://lea.verou.me>
|
17664 | * @namespace
|
17665 | * @public
|
17666 | */
|
17667 | var Prism = (function (_self) {
|
17668 |
|
17669 | // Private helper vars
|
17670 | var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
17671 | var uniqueId = 0;
|
17672 |
|
17673 | // The grammar object for plaintext
|
17674 | var plainTextGrammar = {};
|
17675 |
|
17676 |
|
17677 | var _ = {
|
17678 | /**
|
17679 | * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
17680 | * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
17681 | * additional languages or plugins yourself.
|
17682 | *
|
17683 | * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
|
17684 | *
|
17685 | * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
|
17686 | * empty Prism object into the global scope before loading the Prism script like this:
|
17687 | *
|
17688 | * ```js
|
17689 | * window.Prism = window.Prism || {};
|
17690 | * Prism.manual = true;
|
17691 | * // add a new <script> to load Prism's script
|
17692 | * ```
|
17693 | *
|
17694 | * @default false
|
17695 | * @type {boolean}
|
17696 | * @memberof Prism
|
17697 | * @public
|
17698 | */
|
17699 | manual: _self.Prism && _self.Prism.manual,
|
17700 | /**
|
17701 | * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
17702 | * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
17703 | * own worker, you don't want it to do this.
|
17704 | *
|
17705 | * By setting this value to `true`, Prism will not add its own listeners to the worker.
|
17706 | *
|
17707 | * You obviously have to change this value before Prism executes. To do this, you can add an
|
17708 | * empty Prism object into the global scope before loading the Prism script like this:
|
17709 | *
|
17710 | * ```js
|
17711 | * window.Prism = window.Prism || {};
|
17712 | * Prism.disableWorkerMessageHandler = true;
|
17713 | * // Load Prism's script
|
17714 | * ```
|
17715 | *
|
17716 | * @default false
|
17717 | * @type {boolean}
|
17718 | * @memberof Prism
|
17719 | * @public
|
17720 | */
|
17721 | disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
|
17722 |
|
17723 | /**
|
17724 | * A namespace for utility methods.
|
17725 | *
|
17726 | * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
17727 | * change or disappear at any time.
|
17728 | *
|
17729 | * @namespace
|
17730 | * @memberof Prism
|
17731 | */
|
17732 | util: {
|
17733 | encode: function encode(tokens) {
|
17734 | if (tokens instanceof Token) {
|
17735 | return new Token(tokens.type, encode(tokens.content), tokens.alias);
|
17736 | } else if (Array.isArray(tokens)) {
|
17737 | return tokens.map(encode);
|
17738 | } else {
|
17739 | return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
17740 | }
|
17741 | },
|
17742 |
|
17743 | /**
|
17744 | * Returns the name of the type of the given value.
|
17745 | *
|
17746 | * @param {any} o
|
17747 | * @returns {string}
|
17748 | * @example
|
17749 | * type(null) === 'Null'
|
17750 | * type(undefined) === 'Undefined'
|
17751 | * type(123) === 'Number'
|
17752 | * type('foo') === 'String'
|
17753 | * type(true) === 'Boolean'
|
17754 | * type([1, 2]) === 'Array'
|
17755 | * type({}) === 'Object'
|
17756 | * type(String) === 'Function'
|
17757 | * type(/abc+/) === 'RegExp'
|
17758 | */
|
17759 | type: function (o) {
|
17760 | return Object.prototype.toString.call(o).slice(8, -1);
|
17761 | },
|
17762 |
|
17763 | /**
|
17764 | * Returns a unique number for the given object. Later calls will still return the same number.
|
17765 | *
|
17766 | * @param {Object} obj
|
17767 | * @returns {number}
|
17768 | */
|
17769 | objId: function (obj) {
|
17770 | if (!obj['__id']) {
|
17771 | Object.defineProperty(obj, '__id', { value: ++uniqueId });
|
17772 | }
|
17773 | return obj['__id'];
|
17774 | },
|
17775 |
|
17776 | /**
|
17777 | * Creates a deep clone of the given object.
|
17778 | *
|
17779 | * The main intended use of this function is to clone language definitions.
|
17780 | *
|
17781 | * @param {T} o
|
17782 | * @param {Record<number, any>} [visited]
|
17783 | * @returns {T}
|
17784 | * @template T
|
17785 | */
|
17786 | clone: function deepClone(o, visited) {
|
17787 | visited = visited || {};
|
17788 |
|
17789 | var clone; var id;
|
17790 | switch (_.util.type(o)) {
|
17791 | case 'Object':
|
17792 | id = _.util.objId(o);
|
17793 | if (visited[id]) {
|
17794 | return visited[id];
|
17795 | }
|
17796 | clone = /** @type {Record<string, any>} */ ({});
|
17797 | visited[id] = clone;
|
17798 |
|
17799 | for (var key in o) {
|
17800 | if (o.hasOwnProperty(key)) {
|
17801 | clone[key] = deepClone(o[key], visited);
|
17802 | }
|
17803 | }
|
17804 |
|
17805 | return /** @type {any} */ (clone);
|
17806 |
|
17807 | case 'Array':
|
17808 | id = _.util.objId(o);
|
17809 | if (visited[id]) {
|
17810 | return visited[id];
|
17811 | }
|
17812 | clone = [];
|
17813 | visited[id] = clone;
|
17814 |
|
17815 | (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
|
17816 | clone[i] = deepClone(v, visited);
|
17817 | });
|
17818 |
|
17819 | return /** @type {any} */ (clone);
|
17820 |
|
17821 | default:
|
17822 | return o;
|
17823 | }
|
17824 | },
|
17825 |
|
17826 | /**
|
17827 | * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
|
17828 | *
|
17829 | * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
|
17830 | *
|
17831 | * @param {Element} element
|
17832 | * @returns {string}
|
17833 | */
|
17834 | getLanguage: function (element) {
|
17835 | while (element) {
|
17836 | var m = lang.exec(element.className);
|
17837 | if (m) {
|
17838 | return m[1].toLowerCase();
|
17839 | }
|
17840 | element = element.parentElement;
|
17841 | }
|
17842 | return 'none';
|
17843 | },
|
17844 |
|
17845 | /**
|
17846 | * Sets the Prism `language-xxxx` class of the given element.
|
17847 | *
|
17848 | * @param {Element} element
|
17849 | * @param {string} language
|
17850 | * @returns {void}
|
17851 | */
|
17852 | setLanguage: function (element, language) {
|
17853 | // remove all `language-xxxx` classes
|
17854 | // (this might leave behind a leading space)
|
17855 | element.className = element.className.replace(RegExp(lang, 'gi'), '');
|
17856 |
|
17857 | // add the new `language-xxxx` class
|
17858 | // (using `classList` will automatically clean up spaces for us)
|
17859 | element.classList.add('language-' + language);
|
17860 | },
|
17861 |
|
17862 | /**
|
17863 | * Returns the script element that is currently executing.
|
17864 | *
|
17865 | * This does __not__ work for line script element.
|
17866 | *
|
17867 | * @returns {HTMLScriptElement | null}
|
17868 | */
|
17869 | currentScript: function () {
|
17870 | if (typeof document === 'undefined') {
|
17871 | return null;
|
17872 | }
|
17873 | if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
|
17874 | return /** @type {any} */ (document.currentScript);
|
17875 | }
|
17876 |
|
17877 | // IE11 workaround
|
17878 | // we'll get the src of the current script by parsing IE11's error stack trace
|
17879 | // this will not work for inline scripts
|
17880 |
|
17881 | try {
|
17882 | throw new Error();
|
17883 | } catch (err) {
|
17884 | // Get file src url from stack. Specifically works with the format of stack traces in IE.
|
17885 | // A stack will look like this:
|
17886 | //
|
17887 | // Error
|
17888 | // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
17889 | // at Global code (http://localhost/components/prism-core.js:606:1)
|
17890 |
|
17891 | var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
|
17892 | if (src) {
|
17893 | var scripts = document.getElementsByTagName('script');
|
17894 | for (var i in scripts) {
|
17895 | if (scripts[i].src == src) {
|
17896 | return scripts[i];
|
17897 | }
|
17898 | }
|
17899 | }
|
17900 | return null;
|
17901 | }
|
17902 | },
|
17903 |
|
17904 | /**
|
17905 | * Returns whether a given class is active for `element`.
|
17906 | *
|
17907 | * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
|
17908 | * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
|
17909 | * given class is just the given class with a `no-` prefix.
|
17910 | *
|
17911 | * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
|
17912 | * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
|
17913 | * ancestors have the given class or the negated version of it, then the default activation will be returned.
|
17914 | *
|
17915 | * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
|
17916 | * version of it, the class is considered active.
|
17917 | *
|
17918 | * @param {Element} element
|
17919 | * @param {string} className
|
17920 | * @param {boolean} [defaultActivation=false]
|
17921 | * @returns {boolean}
|
17922 | */
|
17923 | isActive: function (element, className, defaultActivation) {
|
17924 | var no = 'no-' + className;
|
17925 |
|
17926 | while (element) {
|
17927 | var classList = element.classList;
|
17928 | if (classList.contains(className)) {
|
17929 | return true;
|
17930 | }
|
17931 | if (classList.contains(no)) {
|
17932 | return false;
|
17933 | }
|
17934 | element = element.parentElement;
|
17935 | }
|
17936 | return !!defaultActivation;
|
17937 | }
|
17938 | },
|
17939 |
|
17940 | /**
|
17941 | * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
17942 | *
|
17943 | * @namespace
|
17944 | * @memberof Prism
|
17945 | * @public
|
17946 | */
|
17947 | languages: {
|
17948 | /**
|
17949 | * The grammar for plain, unformatted text.
|
17950 | */
|
17951 | plain: plainTextGrammar,
|
17952 | plaintext: plainTextGrammar,
|
17953 | text: plainTextGrammar,
|
17954 | txt: plainTextGrammar,
|
17955 |
|
17956 | /**
|
17957 | * Creates a deep copy of the language with the given id and appends the given tokens.
|
17958 | *
|
17959 | * If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
17960 | * will be overwritten at its original position.
|
17961 | *
|
17962 | * ## Best practices
|
17963 | *
|
17964 | * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
17965 | * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
17966 | * understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
17967 | *
|
17968 | * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
17969 | * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
17970 | *
|
17971 | * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
17972 | * @param {Grammar} redef The new tokens to append.
|
17973 | * @returns {Grammar} The new language created.
|
17974 | * @public
|
17975 | * @example
|
17976 | * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
17977 | * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
17978 | * // at its original position
|
17979 | * 'comment': { ... },
|
17980 | * // CSS doesn't have a 'color' token, so this token will be appended
|
17981 | * 'color': /\b(?:red|green|blue)\b/
|
17982 | * });
|
17983 | */
|
17984 | extend: function (id, redef) {
|
17985 | var lang = _.util.clone(_.languages[id]);
|
17986 |
|
17987 | for (var key in redef) {
|
17988 | lang[key] = redef[key];
|
17989 | }
|
17990 |
|
17991 | return lang;
|
17992 | },
|
17993 |
|
17994 | /**
|
17995 | * Inserts tokens _before_ another token in a language definition or any other grammar.
|
17996 | *
|
17997 | * ## Usage
|
17998 | *
|
17999 | * This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
18000 | * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
18001 | * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
18002 | * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
18003 | * this:
|
18004 | *
|
18005 | * ```js
|
18006 | * Prism.languages.markup.style = {
|
18007 | * // token
|
18008 | * };
|
18009 | * ```
|
18010 | *
|
18011 | * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
18012 | * before existing tokens. For the CSS example above, you would use it like this:
|
18013 | *
|
18014 | * ```js
|
18015 | * Prism.languages.insertBefore('markup', 'cdata', {
|
18016 | * 'style': {
|
18017 | * // token
|
18018 | * }
|
18019 | * });
|
18020 | * ```
|
18021 | *
|
18022 | * ## Special cases
|
18023 | *
|
18024 | * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
18025 | * will be ignored.
|
18026 | *
|
18027 | * This behavior can be used to insert tokens after `before`:
|
18028 | *
|
18029 | * ```js
|
18030 | * Prism.languages.insertBefore('markup', 'comment', {
|
18031 | * 'comment': Prism.languages.markup.comment,
|
18032 | * // tokens after 'comment'
|
18033 | * });
|
18034 | * ```
|
18035 | *
|
18036 | * ## Limitations
|
18037 | *
|
18038 | * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
18039 | * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
18040 | * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
18041 | * deleting properties which is necessary to insert at arbitrary positions.
|
18042 | *
|
18043 | * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
18044 | * Instead, it will create a new object and replace all references to the target object with the new one. This
|
18045 | * can be done without temporarily deleting properties, so the iteration order is well-defined.
|
18046 | *
|
18047 | * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
18048 | * you hold the target object in a variable, then the value of the variable will not change.
|
18049 | *
|
18050 | * ```js
|
18051 | * var oldMarkup = Prism.languages.markup;
|
18052 | * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
18053 | *
|
18054 | * assert(oldMarkup !== Prism.languages.markup);
|
18055 | * assert(newMarkup === Prism.languages.markup);
|
18056 | * ```
|
18057 | *
|
18058 | * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
18059 | * object to be modified.
|
18060 | * @param {string} before The key to insert before.
|
18061 | * @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
18062 | * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
18063 | * object to be modified.
|
18064 | *
|
18065 | * Defaults to `Prism.languages`.
|
18066 | * @returns {Grammar} The new grammar object.
|
18067 | * @public
|
18068 | */
|
18069 | insertBefore: function (inside, before, insert, root) {
|
18070 | root = root || /** @type {any} */ (_.languages);
|
18071 | var grammar = root[inside];
|
18072 | /** @type {Grammar} */
|
18073 | var ret = {};
|
18074 |
|
18075 | for (var token in grammar) {
|
18076 | if (grammar.hasOwnProperty(token)) {
|
18077 |
|
18078 | if (token == before) {
|
18079 | for (var newToken in insert) {
|
18080 | if (insert.hasOwnProperty(newToken)) {
|
18081 | ret[newToken] = insert[newToken];
|
18082 | }
|
18083 | }
|
18084 | }
|
18085 |
|
18086 | // Do not insert token which also occur in insert. See #1525
|
18087 | if (!insert.hasOwnProperty(token)) {
|
18088 | ret[token] = grammar[token];
|
18089 | }
|
18090 | }
|
18091 | }
|
18092 |
|
18093 | var old = root[inside];
|
18094 | root[inside] = ret;
|
18095 |
|
18096 | // Update references in other language definitions
|
18097 | _.languages.DFS(_.languages, function (key, value) {
|
18098 | if (value === old && key != inside) {
|
18099 | this[key] = ret;
|
18100 | }
|
18101 | });
|
18102 |
|
18103 | return ret;
|
18104 | },
|
18105 |
|
18106 | // Traverse a language definition with Depth First Search
|
18107 | DFS: function DFS(o, callback, type, visited) {
|
18108 | visited = visited || {};
|
18109 |
|
18110 | var objId = _.util.objId;
|
18111 |
|
18112 | for (var i in o) {
|
18113 | if (o.hasOwnProperty(i)) {
|
18114 | callback.call(o, i, o[i], type || i);
|
18115 |
|
18116 | var property = o[i];
|
18117 | var propertyType = _.util.type(property);
|
18118 |
|
18119 | if (propertyType === 'Object' && !visited[objId(property)]) {
|
18120 | visited[objId(property)] = true;
|
18121 | DFS(property, callback, null, visited);
|
18122 | } else if (propertyType === 'Array' && !visited[objId(property)]) {
|
18123 | visited[objId(property)] = true;
|
18124 | DFS(property, callback, i, visited);
|
18125 | }
|
18126 | }
|
18127 | }
|
18128 | }
|
18129 | },
|
18130 |
|
18131 | plugins: {},
|
18132 |
|
18133 | /**
|
18134 | * This is the most high-level function in Prism’s API.
|
18135 | * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
|
18136 | * each one of them.
|
18137 | *
|
18138 | * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
|
18139 | *
|
18140 | * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
|
18141 | * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
|
18142 | * @memberof Prism
|
18143 | * @public
|
18144 | */
|
18145 | highlightAll: function (async, callback) {
|
18146 | _.highlightAllUnder(document, async, callback);
|
18147 | },
|
18148 |
|
18149 | /**
|
18150 | * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
18151 | * {@link Prism.highlightElement} on each one of them.
|
18152 | *
|
18153 | * The following hooks will be run:
|
18154 | * 1. `before-highlightall`
|
18155 | * 2. `before-all-elements-highlight`
|
18156 | * 3. All hooks of {@link Prism.highlightElement} for each element.
|
18157 | *
|
18158 | * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
|
18159 | * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
|
18160 | * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
|
18161 | * @memberof Prism
|
18162 | * @public
|
18163 | */
|
18164 | highlightAllUnder: function (container, async, callback) {
|
18165 | var env = {
|
18166 | callback: callback,
|
18167 | container: container,
|
18168 | selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
18169 | };
|
18170 |
|
18171 | _.hooks.run('before-highlightall', env);
|
18172 |
|
18173 | env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
|
18174 |
|
18175 | _.hooks.run('before-all-elements-highlight', env);
|
18176 |
|
18177 | for (var i = 0, element; (element = env.elements[i++]);) {
|
18178 | _.highlightElement(element, async === true, env.callback);
|
18179 | }
|
18180 | },
|
18181 |
|
18182 | /**
|
18183 | * Highlights the code inside a single element.
|
18184 | *
|
18185 | * The following hooks will be run:
|
18186 | * 1. `before-sanity-check`
|
18187 | * 2. `before-highlight`
|
18188 | * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
|
18189 | * 4. `before-insert`
|
18190 | * 5. `after-highlight`
|
18191 | * 6. `complete`
|
18192 | *
|
18193 | * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
|
18194 | * the element's language.
|
18195 | *
|
18196 | * @param {Element} element The element containing the code.
|
18197 | * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
|
18198 | * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
|
18199 | * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
|
18200 | * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
|
18201 | *
|
18202 | * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
|
18203 | * asynchronous highlighting to work. You can build your own bundle on the
|
18204 | * [Download page](https://prismjs.com/download.html).
|
18205 | * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
|
18206 | * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
|
18207 | * @memberof Prism
|
18208 | * @public
|
18209 | */
|
18210 | highlightElement: function (element, async, callback) {
|
18211 | // Find language
|
18212 | var language = _.util.getLanguage(element);
|
18213 | var grammar = _.languages[language];
|
18214 |
|
18215 | // Set language on the element, if not present
|
18216 | _.util.setLanguage(element, language);
|
18217 |
|
18218 | // Set language on the parent, for styling
|
18219 | var parent = element.parentElement;
|
18220 | if (parent && parent.nodeName.toLowerCase() === 'pre') {
|
18221 | _.util.setLanguage(parent, language);
|
18222 | }
|
18223 |
|
18224 | var code = element.textContent;
|
18225 |
|
18226 | var env = {
|
18227 | element: element,
|
18228 | language: language,
|
18229 | grammar: grammar,
|
18230 | code: code
|
18231 | };
|
18232 |
|
18233 | function insertHighlightedCode(highlightedCode) {
|
18234 | env.highlightedCode = highlightedCode;
|
18235 |
|
18236 | _.hooks.run('before-insert', env);
|
18237 |
|
18238 | env.element.innerHTML = env.highlightedCode;
|
18239 |
|
18240 | _.hooks.run('after-highlight', env);
|
18241 | _.hooks.run('complete', env);
|
18242 | callback && callback.call(env.element);
|
18243 | }
|
18244 |
|
18245 | _.hooks.run('before-sanity-check', env);
|
18246 |
|
18247 | // plugins may change/add the parent/element
|
18248 | parent = env.element.parentElement;
|
18249 | if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
|
18250 | parent.setAttribute('tabindex', '0');
|
18251 | }
|
18252 |
|
18253 | if (!env.code) {
|
18254 | _.hooks.run('complete', env);
|
18255 | callback && callback.call(env.element);
|
18256 | return;
|
18257 | }
|
18258 |
|
18259 | _.hooks.run('before-highlight', env);
|
18260 |
|
18261 | if (!env.grammar) {
|
18262 | insertHighlightedCode(_.util.encode(env.code));
|
18263 | return;
|
18264 | }
|
18265 |
|
18266 | if (async && _self.Worker) {
|
18267 | var worker = new Worker(_.filename);
|
18268 |
|
18269 | worker.onmessage = function (evt) {
|
18270 | insertHighlightedCode(evt.data);
|
18271 | };
|
18272 |
|
18273 | worker.postMessage(JSON.stringify({
|
18274 | language: env.language,
|
18275 | code: env.code,
|
18276 | immediateClose: true
|
18277 | }));
|
18278 | } else {
|
18279 | insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
18280 | }
|
18281 | },
|
18282 |
|
18283 | /**
|
18284 | * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
18285 | * and the language definitions to use, and returns a string with the HTML produced.
|
18286 | *
|
18287 | * The following hooks will be run:
|
18288 | * 1. `before-tokenize`
|
18289 | * 2. `after-tokenize`
|
18290 | * 3. `wrap`: On each {@link Token}.
|
18291 | *
|
18292 | * @param {string} text A string with the code to be highlighted.
|
18293 | * @param {Grammar} grammar An object containing the tokens to use.
|
18294 | *
|
18295 | * Usually a language definition like `Prism.languages.markup`.
|
18296 | * @param {string} language The name of the language definition passed to `grammar`.
|
18297 | * @returns {string} The highlighted HTML.
|
18298 | * @memberof Prism
|
18299 | * @public
|
18300 | * @example
|
18301 | * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
18302 | */
|
18303 | highlight: function (text, grammar, language) {
|
18304 | var env = {
|
18305 | code: text,
|
18306 | grammar: grammar,
|
18307 | language: language
|
18308 | };
|
18309 | _.hooks.run('before-tokenize', env);
|
18310 | if (!env.grammar) {
|
18311 | throw new Error('The language "' + env.language + '" has no grammar.');
|
18312 | }
|
18313 | env.tokens = _.tokenize(env.code, env.grammar);
|
18314 | _.hooks.run('after-tokenize', env);
|
18315 | return Token.stringify(_.util.encode(env.tokens), env.language);
|
18316 | },
|
18317 |
|
18318 | /**
|
18319 | * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
18320 | * and the language definitions to use, and returns an array with the tokenized code.
|
18321 | *
|
18322 | * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
18323 | *
|
18324 | * This method could be useful in other contexts as well, as a very crude parser.
|
18325 | *
|
18326 | * @param {string} text A string with the code to be highlighted.
|
18327 | * @param {Grammar} grammar An object containing the tokens to use.
|
18328 | *
|
18329 | * Usually a language definition like `Prism.languages.markup`.
|
18330 | * @returns {TokenStream} An array of strings and tokens, a token stream.
|
18331 | * @memberof Prism
|
18332 | * @public
|
18333 | * @example
|
18334 | * let code = `var foo = 0;`;
|
18335 | * let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
18336 | * tokens.forEach(token => {
|
18337 | * if (token instanceof Prism.Token && token.type === 'number') {
|
18338 | * console.log(`Found numeric literal: ${token.content}`);
|
18339 | * }
|
18340 | * });
|
18341 | */
|
18342 | tokenize: function (text, grammar) {
|
18343 | var rest = grammar.rest;
|
18344 | if (rest) {
|
18345 | for (var token in rest) {
|
18346 | grammar[token] = rest[token];
|
18347 | }
|
18348 |
|
18349 | delete grammar.rest;
|
18350 | }
|
18351 |
|
18352 | var tokenList = new LinkedList();
|
18353 | addAfter(tokenList, tokenList.head, text);
|
18354 |
|
18355 | matchGrammar(text, tokenList, grammar, tokenList.head, 0);
|
18356 |
|
18357 | return toArray(tokenList);
|
18358 | },
|
18359 |
|
18360 | /**
|
18361 | * @namespace
|
18362 | * @memberof Prism
|
18363 | * @public
|
18364 | */
|
18365 | hooks: {
|
18366 | all: {},
|
18367 |
|
18368 | /**
|
18369 | * Adds the given callback to the list of callbacks for the given hook.
|
18370 | *
|
18371 | * The callback will be invoked when the hook it is registered for is run.
|
18372 | * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
18373 | *
|
18374 | * One callback function can be registered to multiple hooks and the same hook multiple times.
|
18375 | *
|
18376 | * @param {string} name The name of the hook.
|
18377 | * @param {HookCallback} callback The callback function which is given environment variables.
|
18378 | * @public
|
18379 | */
|
18380 | add: function (name, callback) {
|
18381 | var hooks = _.hooks.all;
|
18382 |
|
18383 | hooks[name] = hooks[name] || [];
|
18384 |
|
18385 | hooks[name].push(callback);
|
18386 | },
|
18387 |
|
18388 | /**
|
18389 | * Runs a hook invoking all registered callbacks with the given environment variables.
|
18390 | *
|
18391 | * Callbacks will be invoked synchronously and in the order in which they were registered.
|
18392 | *
|
18393 | * @param {string} name The name of the hook.
|
18394 | * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
18395 | * @public
|
18396 | */
|
18397 | run: function (name, env) {
|
18398 | var callbacks = _.hooks.all[name];
|
18399 |
|
18400 | if (!callbacks || !callbacks.length) {
|
18401 | return;
|
18402 | }
|
18403 |
|
18404 | for (var i = 0, callback; (callback = callbacks[i++]);) {
|
18405 | callback(env);
|
18406 | }
|
18407 | }
|
18408 | },
|
18409 |
|
18410 | Token: Token
|
18411 | };
|
18412 | _self.Prism = _;
|
18413 |
|
18414 |
|
18415 | // Typescript note:
|
18416 | // The following can be used to import the Token type in JSDoc:
|
18417 | //
|
18418 | // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
|
18419 |
|
18420 | /**
|
18421 | * Creates a new token.
|
18422 | *
|
18423 | * @param {string} type See {@link Token#type type}
|
18424 | * @param {string | TokenStream} content See {@link Token#content content}
|
18425 | * @param {string|string[]} [alias] The alias(es) of the token.
|
18426 | * @param {string} [matchedStr=""] A copy of the full string this token was created from.
|
18427 | * @class
|
18428 | * @global
|
18429 | * @public
|
18430 | */
|
18431 | function Token(type, content, alias, matchedStr) {
|
18432 | /**
|
18433 | * The type of the token.
|
18434 | *
|
18435 | * This is usually the key of a pattern in a {@link Grammar}.
|
18436 | *
|
18437 | * @type {string}
|
18438 | * @see GrammarToken
|
18439 | * @public
|
18440 | */
|
18441 | this.type = type;
|
18442 | /**
|
18443 | * The strings or tokens contained by this token.
|
18444 | *
|
18445 | * This will be a token stream if the pattern matched also defined an `inside` grammar.
|
18446 | *
|
18447 | * @type {string | TokenStream}
|
18448 | * @public
|
18449 | */
|
18450 | this.content = content;
|
18451 | /**
|
18452 | * The alias(es) of the token.
|
18453 | *
|
18454 | * @type {string|string[]}
|
18455 | * @see GrammarToken
|
18456 | * @public
|
18457 | */
|
18458 | this.alias = alias;
|
18459 | // Copy of the full string this token was created from
|
18460 | this.length = (matchedStr || '').length | 0;
|
18461 | }
|
18462 |
|
18463 | /**
|
18464 | * A token stream is an array of strings and {@link Token Token} objects.
|
18465 | *
|
18466 | * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
|
18467 | * them.
|
18468 | *
|
18469 | * 1. No adjacent strings.
|
18470 | * 2. No empty strings.
|
18471 | *
|
18472 | * The only exception here is the token stream that only contains the empty string and nothing else.
|
18473 | *
|
18474 | * @typedef {Array<string | Token>} TokenStream
|
18475 | * @global
|
18476 | * @public
|
18477 | */
|
18478 |
|
18479 | /**
|
18480 | * Converts the given token or token stream to an HTML representation.
|
18481 | *
|
18482 | * The following hooks will be run:
|
18483 | * 1. `wrap`: On each {@link Token}.
|
18484 | *
|
18485 | * @param {string | Token | TokenStream} o The token or token stream to be converted.
|
18486 | * @param {string} language The name of current language.
|
18487 | * @returns {string} The HTML representation of the token or token stream.
|
18488 | * @memberof Token
|
18489 | * @static
|
18490 | */
|
18491 | Token.stringify = function stringify(o, language) {
|
18492 | if (typeof o == 'string') {
|
18493 | return o;
|
18494 | }
|
18495 | if (Array.isArray(o)) {
|
18496 | var s = '';
|
18497 | o.forEach(function (e) {
|
18498 | s += stringify(e, language);
|
18499 | });
|
18500 | return s;
|
18501 | }
|
18502 |
|
18503 | var env = {
|
18504 | type: o.type,
|
18505 | content: stringify(o.content, language),
|
18506 | tag: 'span',
|
18507 | classes: ['token', o.type],
|
18508 | attributes: {},
|
18509 | language: language
|
18510 | };
|
18511 |
|
18512 | var aliases = o.alias;
|
18513 | if (aliases) {
|
18514 | if (Array.isArray(aliases)) {
|
18515 | Array.prototype.push.apply(env.classes, aliases);
|
18516 | } else {
|
18517 | env.classes.push(aliases);
|
18518 | }
|
18519 | }
|
18520 |
|
18521 | _.hooks.run('wrap', env);
|
18522 |
|
18523 | var attributes = '';
|
18524 | for (var name in env.attributes) {
|
18525 | attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
|
18526 | }
|
18527 |
|
18528 | return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
|
18529 | };
|
18530 |
|
18531 | /**
|
18532 | * @param {RegExp} pattern
|
18533 | * @param {number} pos
|
18534 | * @param {string} text
|
18535 | * @param {boolean} lookbehind
|
18536 | * @returns {RegExpExecArray | null}
|
18537 | */
|
18538 | function matchPattern(pattern, pos, text, lookbehind) {
|
18539 | pattern.lastIndex = pos;
|
18540 | var match = pattern.exec(text);
|
18541 | if (match && lookbehind && match[1]) {
|
18542 | // change the match to remove the text matched by the Prism lookbehind group
|
18543 | var lookbehindLength = match[1].length;
|
18544 | match.index += lookbehindLength;
|
18545 | match[0] = match[0].slice(lookbehindLength);
|
18546 | }
|
18547 | return match;
|
18548 | }
|
18549 |
|
18550 | /**
|
18551 | * @param {string} text
|
18552 | * @param {LinkedList<string | Token>} tokenList
|
18553 | * @param {any} grammar
|
18554 | * @param {LinkedListNode<string | Token>} startNode
|
18555 | * @param {number} startPos
|
18556 | * @param {RematchOptions} [rematch]
|
18557 | * @returns {void}
|
18558 | * @private
|
18559 | *
|
18560 | * @typedef RematchOptions
|
18561 | * @property {string} cause
|
18562 | * @property {number} reach
|
18563 | */
|
18564 | function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
|
18565 | for (var token in grammar) {
|
18566 | if (!grammar.hasOwnProperty(token) || !grammar[token]) {
|
18567 | continue;
|
18568 | }
|
18569 |
|
18570 | var patterns = grammar[token];
|
18571 | patterns = Array.isArray(patterns) ? patterns : [patterns];
|
18572 |
|
18573 | for (var j = 0; j < patterns.length; ++j) {
|
18574 | if (rematch && rematch.cause == token + ',' + j) {
|
18575 | return;
|
18576 | }
|
18577 |
|
18578 | var patternObj = patterns[j];
|
18579 | var inside = patternObj.inside;
|
18580 | var lookbehind = !!patternObj.lookbehind;
|
18581 | var greedy = !!patternObj.greedy;
|
18582 | var alias = patternObj.alias;
|
18583 |
|
18584 | if (greedy && !patternObj.pattern.global) {
|
18585 | // Without the global flag, lastIndex won't work
|
18586 | var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
|
18587 | patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
|
18588 | }
|
18589 |
|
18590 | /** @type {RegExp} */
|
18591 | var pattern = patternObj.pattern || patternObj;
|
18592 |
|
18593 | for ( // iterate the token list and keep track of the current token/string position
|
18594 | var currentNode = startNode.next, pos = startPos;
|
18595 | currentNode !== tokenList.tail;
|
18596 | pos += currentNode.value.length, currentNode = currentNode.next
|
18597 | ) {
|
18598 |
|
18599 | if (rematch && pos >= rematch.reach) {
|
18600 | break;
|
18601 | }
|
18602 |
|
18603 | var str = currentNode.value;
|
18604 |
|
18605 | if (tokenList.length > text.length) {
|
18606 | // Something went terribly wrong, ABORT, ABORT!
|
18607 | return;
|
18608 | }
|
18609 |
|
18610 | if (str instanceof Token) {
|
18611 | continue;
|
18612 | }
|
18613 |
|
18614 | var removeCount = 1; // this is the to parameter of removeBetween
|
18615 | var match;
|
18616 |
|
18617 | if (greedy) {
|
18618 | match = matchPattern(pattern, pos, text, lookbehind);
|
18619 | if (!match || match.index >= text.length) {
|
18620 | break;
|
18621 | }
|
18622 |
|
18623 | var from = match.index;
|
18624 | var to = match.index + match[0].length;
|
18625 | var p = pos;
|
18626 |
|
18627 | // find the node that contains the match
|
18628 | p += currentNode.value.length;
|
18629 | while (from >= p) {
|
18630 | currentNode = currentNode.next;
|
18631 | p += currentNode.value.length;
|
18632 | }
|
18633 | // adjust pos (and p)
|
18634 | p -= currentNode.value.length;
|
18635 | pos = p;
|
18636 |
|
18637 | // the current node is a Token, then the match starts inside another Token, which is invalid
|
18638 | if (currentNode.value instanceof Token) {
|
18639 | continue;
|
18640 | }
|
18641 |
|
18642 | // find the last node which is affected by this match
|
18643 | for (
|
18644 | var k = currentNode;
|
18645 | k !== tokenList.tail && (p < to || typeof k.value === 'string');
|
18646 | k = k.next
|
18647 | ) {
|
18648 | removeCount++;
|
18649 | p += k.value.length;
|
18650 | }
|
18651 | removeCount--;
|
18652 |
|
18653 | // replace with the new match
|
18654 | str = text.slice(pos, p);
|
18655 | match.index -= pos;
|
18656 | } else {
|
18657 | match = matchPattern(pattern, 0, str, lookbehind);
|
18658 | if (!match) {
|
18659 | continue;
|
18660 | }
|
18661 | }
|
18662 |
|
18663 | // eslint-disable-next-line no-redeclare
|
18664 | var from = match.index;
|
18665 | var matchStr = match[0];
|
18666 | var before = str.slice(0, from);
|
18667 | var after = str.slice(from + matchStr.length);
|
18668 |
|
18669 | var reach = pos + str.length;
|
18670 | if (rematch && reach > rematch.reach) {
|
18671 | rematch.reach = reach;
|
18672 | }
|
18673 |
|
18674 | var removeFrom = currentNode.prev;
|
18675 |
|
18676 | if (before) {
|
18677 | removeFrom = addAfter(tokenList, removeFrom, before);
|
18678 | pos += before.length;
|
18679 | }
|
18680 |
|
18681 | removeRange(tokenList, removeFrom, removeCount);
|
18682 |
|
18683 | var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
|
18684 | currentNode = addAfter(tokenList, removeFrom, wrapped);
|
18685 |
|
18686 | if (after) {
|
18687 | addAfter(tokenList, currentNode, after);
|
18688 | }
|
18689 |
|
18690 | if (removeCount > 1) {
|
18691 | // at least one Token object was removed, so we have to do some rematching
|
18692 | // this can only happen if the current pattern is greedy
|
18693 |
|
18694 | /** @type {RematchOptions} */
|
18695 | var nestedRematch = {
|
18696 | cause: token + ',' + j,
|
18697 | reach: reach
|
18698 | };
|
18699 | matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
|
18700 |
|
18701 | // the reach might have been extended because of the rematching
|
18702 | if (rematch && nestedRematch.reach > rematch.reach) {
|
18703 | rematch.reach = nestedRematch.reach;
|
18704 | }
|
18705 | }
|
18706 | }
|
18707 | }
|
18708 | }
|
18709 | }
|
18710 |
|
18711 | /**
|
18712 | * @typedef LinkedListNode
|
18713 | * @property {T} value
|
18714 | * @property {LinkedListNode<T> | null} prev The previous node.
|
18715 | * @property {LinkedListNode<T> | null} next The next node.
|
18716 | * @template T
|
18717 | * @private
|
18718 | */
|
18719 |
|
18720 | /**
|
18721 | * @template T
|
18722 | * @private
|
18723 | */
|
18724 | function LinkedList() {
|
18725 | /** @type {LinkedListNode<T>} */
|
18726 | var head = { value: null, prev: null, next: null };
|
18727 | /** @type {LinkedListNode<T>} */
|
18728 | var tail = { value: null, prev: head, next: null };
|
18729 | head.next = tail;
|
18730 |
|
18731 | /** @type {LinkedListNode<T>} */
|
18732 | this.head = head;
|
18733 | /** @type {LinkedListNode<T>} */
|
18734 | this.tail = tail;
|
18735 | this.length = 0;
|
18736 | }
|
18737 |
|
18738 | /**
|
18739 | * Adds a new node with the given value to the list.
|
18740 | *
|
18741 | * @param {LinkedList<T>} list
|
18742 | * @param {LinkedListNode<T>} node
|
18743 | * @param {T} value
|
18744 | * @returns {LinkedListNode<T>} The added node.
|
18745 | * @template T
|
18746 | */
|
18747 | function addAfter(list, node, value) {
|
18748 | // assumes that node != list.tail && values.length >= 0
|
18749 | var next = node.next;
|
18750 |
|
18751 | var newNode = { value: value, prev: node, next: next };
|
18752 | node.next = newNode;
|
18753 | next.prev = newNode;
|
18754 | list.length++;
|
18755 |
|
18756 | return newNode;
|
18757 | }
|
18758 | /**
|
18759 | * Removes `count` nodes after the given node. The given node will not be removed.
|
18760 | *
|
18761 | * @param {LinkedList<T>} list
|
18762 | * @param {LinkedListNode<T>} node
|
18763 | * @param {number} count
|
18764 | * @template T
|
18765 | */
|
18766 | function removeRange(list, node, count) {
|
18767 | var next = node.next;
|
18768 | for (var i = 0; i < count && next !== list.tail; i++) {
|
18769 | next = next.next;
|
18770 | }
|
18771 | node.next = next;
|
18772 | next.prev = node;
|
18773 | list.length -= i;
|
18774 | }
|
18775 | /**
|
18776 | * @param {LinkedList<T>} list
|
18777 | * @returns {T[]}
|
18778 | * @template T
|
18779 | */
|
18780 | function toArray(list) {
|
18781 | var array = [];
|
18782 | var node = list.head.next;
|
18783 | while (node !== list.tail) {
|
18784 | array.push(node.value);
|
18785 | node = node.next;
|
18786 | }
|
18787 | return array;
|
18788 | }
|
18789 |
|
18790 |
|
18791 | if (!_self.document) {
|
18792 | if (!_self.addEventListener) {
|
18793 | // in Node.js
|
18794 | return _;
|
18795 | }
|
18796 |
|
18797 | if (!_.disableWorkerMessageHandler) {
|
18798 | // In worker
|
18799 | _self.addEventListener('message', function (evt) {
|
18800 | var message = JSON.parse(evt.data);
|
18801 | var lang = message.language;
|
18802 | var code = message.code;
|
18803 | var immediateClose = message.immediateClose;
|
18804 |
|
18805 | _self.postMessage(_.highlight(code, _.languages[lang], lang));
|
18806 | if (immediateClose) {
|
18807 | _self.close();
|
18808 | }
|
18809 | }, false);
|
18810 | }
|
18811 |
|
18812 | return _;
|
18813 | }
|
18814 |
|
18815 | // Get current script and highlight
|
18816 | var script = _.util.currentScript();
|
18817 |
|
18818 | if (script) {
|
18819 | _.filename = script.src;
|
18820 |
|
18821 | if (script.hasAttribute('data-manual')) {
|
18822 | _.manual = true;
|
18823 | }
|
18824 | }
|
18825 |
|
18826 | function highlightAutomaticallyCallback() {
|
18827 | if (!_.manual) {
|
18828 | _.highlightAll();
|
18829 | }
|
18830 | }
|
18831 |
|
18832 | if (!_.manual) {
|
18833 | // If the document state is "loading", then we'll use DOMContentLoaded.
|
18834 | // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
|
18835 | // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
|
18836 | // might take longer one animation frame to execute which can create a race condition where only some plugins have
|
18837 | // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
|
18838 | // See https://github.com/PrismJS/prism/issues/2102
|
18839 | var readyState = document.readyState;
|
18840 | if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
|
18841 | document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
|
18842 | } else {
|
18843 | if (window.requestAnimationFrame) {
|
18844 | window.requestAnimationFrame(highlightAutomaticallyCallback);
|
18845 | } else {
|
18846 | window.setTimeout(highlightAutomaticallyCallback, 16);
|
18847 | }
|
18848 | }
|
18849 | }
|
18850 |
|
18851 | return _;
|
18852 |
|
18853 | }(_self));
|
18854 |
|
18855 | if ( true && module.exports) {
|
18856 | module.exports = Prism;
|
18857 | }
|
18858 |
|
18859 | // hack for components to work correctly in node.js
|
18860 | if (typeof __webpack_require__.g !== 'undefined') {
|
18861 | __webpack_require__.g.Prism = Prism;
|
18862 | }
|
18863 |
|
18864 | // some additional documentation/types
|
18865 |
|
18866 | /**
|
18867 | * The expansion of a simple `RegExp` literal to support additional properties.
|
18868 | *
|
18869 | * @typedef GrammarToken
|
18870 | * @property {RegExp} pattern The regular expression of the token.
|
18871 | * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
|
18872 | * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
|
18873 | * @property {boolean} [greedy=false] Whether the token is greedy.
|
18874 | * @property {string|string[]} [alias] An optional alias or list of aliases.
|
18875 | * @property {Grammar} [inside] The nested grammar of this token.
|
18876 | *
|
18877 | * The `inside` grammar will be used to tokenize the text value of each token of this kind.
|
18878 | *
|
18879 | * This can be used to make nested and even recursive language definitions.
|
18880 | *
|
18881 | * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
|
18882 | * each another.
|
18883 | * @global
|
18884 | * @public
|
18885 | */
|
18886 |
|
18887 | /**
|
18888 | * @typedef Grammar
|
18889 | * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
|
18890 | * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
|
18891 | * @global
|
18892 | * @public
|
18893 | */
|
18894 |
|
18895 | /**
|
18896 | * A function which will invoked after an element was successfully highlighted.
|
18897 | *
|
18898 | * @callback HighlightCallback
|
18899 | * @param {Element} element The element successfully highlighted.
|
18900 | * @returns {void}
|
18901 | * @global
|
18902 | * @public
|
18903 | */
|
18904 |
|
18905 | /**
|
18906 | * @callback HookCallback
|
18907 | * @param {Object<string, any>} env The environment variables of the hook.
|
18908 | * @returns {void}
|
18909 | * @global
|
18910 | * @public
|
18911 | */
|
18912 |
|
18913 |
|
18914 | /* **********************************************
|
18915 | Begin prism-markup.js
|
18916 | ********************************************** */
|
18917 |
|
18918 | Prism.languages.markup = {
|
18919 | 'comment': {
|
18920 | pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
18921 | greedy: true
|
18922 | },
|
18923 | 'prolog': {
|
18924 | pattern: /<\?[\s\S]+?\?>/,
|
18925 | greedy: true
|
18926 | },
|
18927 | 'doctype': {
|
18928 | // https://www.w3.org/TR/xml/#NT-doctypedecl
|
18929 | pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
18930 | greedy: true,
|
18931 | inside: {
|
18932 | 'internal-subset': {
|
18933 | pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
18934 | lookbehind: true,
|
18935 | greedy: true,
|
18936 | inside: null // see below
|
18937 | },
|
18938 | 'string': {
|
18939 | pattern: /"[^"]*"|'[^']*'/,
|
18940 | greedy: true
|
18941 | },
|
18942 | 'punctuation': /^<!|>$|[[\]]/,
|
18943 | 'doctype-tag': /^DOCTYPE/i,
|
18944 | 'name': /[^\s<>'"]+/
|
18945 | }
|
18946 | },
|
18947 | 'cdata': {
|
18948 | pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
18949 | greedy: true
|
18950 | },
|
18951 | 'tag': {
|
18952 | pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
18953 | greedy: true,
|
18954 | inside: {
|
18955 | 'tag': {
|
18956 | pattern: /^<\/?[^\s>\/]+/,
|
18957 | inside: {
|
18958 | 'punctuation': /^<\/?/,
|
18959 | 'namespace': /^[^\s>\/:]+:/
|
18960 | }
|
18961 | },
|
18962 | 'special-attr': [],
|
18963 | 'attr-value': {
|
18964 | pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
18965 | inside: {
|
18966 | 'punctuation': [
|
18967 | {
|
18968 | pattern: /^=/,
|
18969 | alias: 'attr-equals'
|
18970 | },
|
18971 | {
|
18972 | pattern: /^(\s*)["']|["']$/,
|
18973 | lookbehind: true
|
18974 | }
|
18975 | ]
|
18976 | }
|
18977 | },
|
18978 | 'punctuation': /\/?>/,
|
18979 | 'attr-name': {
|
18980 | pattern: /[^\s>\/]+/,
|
18981 | inside: {
|
18982 | 'namespace': /^[^\s>\/:]+:/
|
18983 | }
|
18984 | }
|
18985 |
|
18986 | }
|
18987 | },
|
18988 | 'entity': [
|
18989 | {
|
18990 | pattern: /&[\da-z]{1,8};/i,
|
18991 | alias: 'named-entity'
|
18992 | },
|
18993 | /&#x?[\da-f]{1,8};/i
|
18994 | ]
|
18995 | };
|
18996 |
|
18997 | Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
18998 | Prism.languages.markup['entity'];
|
18999 | Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
|
19000 |
|
19001 | // Plugin to make entity title show the real entity, idea by Roman Komarov
|
19002 | Prism.hooks.add('wrap', function (env) {
|
19003 |
|
19004 | if (env.type === 'entity') {
|
19005 | env.attributes['title'] = env.content.replace(/&/, '&');
|
19006 | }
|
19007 | });
|
19008 |
|
19009 | Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
|
19010 | /**
|
19011 | * Adds an inlined language to markup.
|
19012 | *
|
19013 | * An example of an inlined language is CSS with `<style>` tags.
|
19014 | *
|
19015 | * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
19016 | * case insensitive.
|
19017 | * @param {string} lang The language key.
|
19018 | * @example
|
19019 | * addInlined('style', 'css');
|
19020 | */
|
19021 | value: function addInlined(tagName, lang) {
|
19022 | var includedCdataInside = {};
|
19023 | includedCdataInside['language-' + lang] = {
|
19024 | pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
19025 | lookbehind: true,
|
19026 | inside: Prism.languages[lang]
|
19027 | };
|
19028 | includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
|
19029 |
|
19030 | var inside = {
|
19031 | 'included-cdata': {
|
19032 | pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
19033 | inside: includedCdataInside
|
19034 | }
|
19035 | };
|
19036 | inside['language-' + lang] = {
|
19037 | pattern: /[\s\S]+/,
|
19038 | inside: Prism.languages[lang]
|
19039 | };
|
19040 |
|
19041 | var def = {};
|
19042 | def[tagName] = {
|
19043 | pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
|
19044 | lookbehind: true,
|
19045 | greedy: true,
|
19046 | inside: inside
|
19047 | };
|
19048 |
|
19049 | Prism.languages.insertBefore('markup', 'cdata', def);
|
19050 | }
|
19051 | });
|
19052 | Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
|
19053 | /**
|
19054 | * Adds an pattern to highlight languages embedded in HTML attributes.
|
19055 | *
|
19056 | * An example of an inlined language is CSS with `style` attributes.
|
19057 | *
|
19058 | * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
19059 | * case insensitive.
|
19060 | * @param {string} lang The language key.
|
19061 | * @example
|
19062 | * addAttribute('style', 'css');
|
19063 | */
|
19064 | value: function (attrName, lang) {
|
19065 | Prism.languages.markup.tag.inside['special-attr'].push({
|
19066 | pattern: RegExp(
|
19067 | /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
19068 | 'i'
|
19069 | ),
|
19070 | lookbehind: true,
|
19071 | inside: {
|
19072 | 'attr-name': /^[^\s=]+/,
|
19073 | 'attr-value': {
|
19074 | pattern: /=[\s\S]+/,
|
19075 | inside: {
|
19076 | 'value': {
|
19077 | pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
19078 | lookbehind: true,
|
19079 | alias: [lang, 'language-' + lang],
|
19080 | inside: Prism.languages[lang]
|
19081 | },
|
19082 | 'punctuation': [
|
19083 | {
|
19084 | pattern: /^=/,
|
19085 | alias: 'attr-equals'
|
19086 | },
|
19087 | /"|'/
|
19088 | ]
|
19089 | }
|
19090 | }
|
19091 | }
|
19092 | });
|
19093 | }
|
19094 | });
|
19095 |
|
19096 | Prism.languages.html = Prism.languages.markup;
|
19097 | Prism.languages.mathml = Prism.languages.markup;
|
19098 | Prism.languages.svg = Prism.languages.markup;
|
19099 |
|
19100 | Prism.languages.xml = Prism.languages.extend('markup', {});
|
19101 | Prism.languages.ssml = Prism.languages.xml;
|
19102 | Prism.languages.atom = Prism.languages.xml;
|
19103 | Prism.languages.rss = Prism.languages.xml;
|
19104 |
|
19105 |
|
19106 | /* **********************************************
|
19107 | Begin prism-css.js
|
19108 | ********************************************** */
|
19109 |
|
19110 | (function (Prism) {
|
19111 |
|
19112 | var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
19113 |
|
19114 | Prism.languages.css = {
|
19115 | 'comment': /\/\*[\s\S]*?\*\//,
|
19116 | 'atrule': {
|
19117 | pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
19118 | inside: {
|
19119 | 'rule': /^@[\w-]+/,
|
19120 | 'selector-function-argument': {
|
19121 | pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
19122 | lookbehind: true,
|
19123 | alias: 'selector'
|
19124 | },
|
19125 | 'keyword': {
|
19126 | pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
19127 | lookbehind: true
|
19128 | }
|
19129 | // See rest below
|
19130 | }
|
19131 | },
|
19132 | 'url': {
|
19133 | // https://drafts.csswg.org/css-values-3/#urls
|
19134 | pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
19135 | greedy: true,
|
19136 | inside: {
|
19137 | 'function': /^url/i,
|
19138 | 'punctuation': /^\(|\)$/,
|
19139 | 'string': {
|
19140 | pattern: RegExp('^' + string.source + '$'),
|
19141 | alias: 'url'
|
19142 | }
|
19143 | }
|
19144 | },
|
19145 | 'selector': {
|
19146 | pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
19147 | lookbehind: true
|
19148 | },
|
19149 | 'string': {
|
19150 | pattern: string,
|
19151 | greedy: true
|
19152 | },
|
19153 | 'property': {
|
19154 | pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
19155 | lookbehind: true
|
19156 | },
|
19157 | 'important': /!important\b/i,
|
19158 | 'function': {
|
19159 | pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
19160 | lookbehind: true
|
19161 | },
|
19162 | 'punctuation': /[(){};:,]/
|
19163 | };
|
19164 |
|
19165 | Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
19166 |
|
19167 | var markup = Prism.languages.markup;
|
19168 | if (markup) {
|
19169 | markup.tag.addInlined('style', 'css');
|
19170 | markup.tag.addAttribute('style', 'css');
|
19171 | }
|
19172 |
|
19173 | }(Prism));
|
19174 |
|
19175 |
|
19176 | /* **********************************************
|
19177 | Begin prism-clike.js
|
19178 | ********************************************** */
|
19179 |
|
19180 | Prism.languages.clike = {
|
19181 | 'comment': [
|
19182 | {
|
19183 | pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
19184 | lookbehind: true,
|
19185 | greedy: true
|
19186 | },
|
19187 | {
|
19188 | pattern: /(^|[^\\:])\/\/.*/,
|
19189 | lookbehind: true,
|
19190 | greedy: true
|
19191 | }
|
19192 | ],
|
19193 | 'string': {
|
19194 | pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
19195 | greedy: true
|
19196 | },
|
19197 | 'class-name': {
|
19198 | pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
19199 | lookbehind: true,
|
19200 | inside: {
|
19201 | 'punctuation': /[.\\]/
|
19202 | }
|
19203 | },
|
19204 | 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
19205 | 'boolean': /\b(?:false|true)\b/,
|
19206 | 'function': /\b\w+(?=\()/,
|
19207 | 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
19208 | 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
19209 | 'punctuation': /[{}[\];(),.:]/
|
19210 | };
|
19211 |
|
19212 |
|
19213 | /* **********************************************
|
19214 | Begin prism-javascript.js
|
19215 | ********************************************** */
|
19216 |
|
19217 | Prism.languages.javascript = Prism.languages.extend('clike', {
|
19218 | 'class-name': [
|
19219 | Prism.languages.clike['class-name'],
|
19220 | {
|
19221 | pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
19222 | lookbehind: true
|
19223 | }
|
19224 | ],
|
19225 | 'keyword': [
|
19226 | {
|
19227 | pattern: /((?:^|\})\s*)catch\b/,
|
19228 | lookbehind: true
|
19229 | },
|
19230 | {
|
19231 | pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
19232 | lookbehind: true
|
19233 | },
|
19234 | ],
|
19235 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
19236 | 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
19237 | 'number': {
|
19238 | pattern: RegExp(
|
19239 | /(^|[^\w$])/.source +
|
19240 | '(?:' +
|
19241 | (
|
19242 | // constant
|
19243 | /NaN|Infinity/.source +
|
19244 | '|' +
|
19245 | // binary integer
|
19246 | /0[bB][01]+(?:_[01]+)*n?/.source +
|
19247 | '|' +
|
19248 | // octal integer
|
19249 | /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
|
19250 | '|' +
|
19251 | // hexadecimal integer
|
19252 | /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
|
19253 | '|' +
|
19254 | // decimal bigint
|
19255 | /\d+(?:_\d+)*n/.source +
|
19256 | '|' +
|
19257 | // decimal number (integer or float) but no bigint
|
19258 | /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
|
19259 | ) +
|
19260 | ')' +
|
19261 | /(?![\w$])/.source
|
19262 | ),
|
19263 | lookbehind: true
|
19264 | },
|
19265 | 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
19266 | });
|
19267 |
|
19268 | Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
19269 |
|
19270 | Prism.languages.insertBefore('javascript', 'keyword', {
|
19271 | 'regex': {
|
19272 | pattern: RegExp(
|
19273 | // lookbehind
|
19274 | // eslint-disable-next-line regexp/no-dupe-characters-character-class
|
19275 | /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
19276 | // Regex pattern:
|
19277 | // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
19278 | // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
19279 | // with the only syntax, so we have to define 2 different regex patterns.
|
19280 | /\//.source +
|
19281 | '(?:' +
|
19282 | /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
|
19283 | '|' +
|
19284 | // `v` flag syntax. This supports 3 levels of nested character classes.
|
19285 | /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
|
19286 | ')' +
|
19287 | // lookahead
|
19288 | /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
19289 | ),
|
19290 | lookbehind: true,
|
19291 | greedy: true,
|
19292 | inside: {
|
19293 | 'regex-source': {
|
19294 | pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
19295 | lookbehind: true,
|
19296 | alias: 'language-regex',
|
19297 | inside: Prism.languages.regex
|
19298 | },
|
19299 | 'regex-delimiter': /^\/|\/$/,
|
19300 | 'regex-flags': /^[a-z]+$/,
|
19301 | }
|
19302 | },
|
19303 | // This must be declared before keyword because we use "function" inside the look-forward
|
19304 | 'function-variable': {
|
19305 | pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
19306 | alias: 'function'
|
19307 | },
|
19308 | 'parameter': [
|
19309 | {
|
19310 | pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
19311 | lookbehind: true,
|
19312 | inside: Prism.languages.javascript
|
19313 | },
|
19314 | {
|
19315 | pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
19316 | lookbehind: true,
|
19317 | inside: Prism.languages.javascript
|
19318 | },
|
19319 | {
|
19320 | pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
19321 | lookbehind: true,
|
19322 | inside: Prism.languages.javascript
|
19323 | },
|
19324 | {
|
19325 | pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
19326 | lookbehind: true,
|
19327 | inside: Prism.languages.javascript
|
19328 | }
|
19329 | ],
|
19330 | 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
19331 | });
|
19332 |
|
19333 | Prism.languages.insertBefore('javascript', 'string', {
|
19334 | 'hashbang': {
|
19335 | pattern: /^#!.*/,
|
19336 | greedy: true,
|
19337 | alias: 'comment'
|
19338 | },
|
19339 | 'template-string': {
|
19340 | pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
19341 | greedy: true,
|
19342 | inside: {
|
19343 | 'template-punctuation': {
|
19344 | pattern: /^`|`$/,
|
19345 | alias: 'string'
|
19346 | },
|
19347 | 'interpolation': {
|
19348 | pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
19349 | lookbehind: true,
|
19350 | inside: {
|
19351 | 'interpolation-punctuation': {
|
19352 | pattern: /^\$\{|\}$/,
|
19353 | alias: 'punctuation'
|
19354 | },
|
19355 | rest: Prism.languages.javascript
|
19356 | }
|
19357 | },
|
19358 | 'string': /[\s\S]+/
|
19359 | }
|
19360 | },
|
19361 | 'string-property': {
|
19362 | pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
19363 | lookbehind: true,
|
19364 | greedy: true,
|
19365 | alias: 'property'
|
19366 | }
|
19367 | });
|
19368 |
|
19369 | Prism.languages.insertBefore('javascript', 'operator', {
|
19370 | 'literal-property': {
|
19371 | pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
19372 | lookbehind: true,
|
19373 | alias: 'property'
|
19374 | },
|
19375 | });
|
19376 |
|
19377 | if (Prism.languages.markup) {
|
19378 | Prism.languages.markup.tag.addInlined('script', 'javascript');
|
19379 |
|
19380 | // add attribute support for all DOM events.
|
19381 | // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
19382 | Prism.languages.markup.tag.addAttribute(
|
19383 | /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
19384 | 'javascript'
|
19385 | );
|
19386 | }
|
19387 |
|
19388 | Prism.languages.js = Prism.languages.javascript;
|
19389 |
|
19390 |
|
19391 | /* **********************************************
|
19392 | Begin prism-file-highlight.js
|
19393 | ********************************************** */
|
19394 |
|
19395 | (function () {
|
19396 |
|
19397 | if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
19398 | return;
|
19399 | }
|
19400 |
|
19401 | // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
|
19402 | if (!Element.prototype.matches) {
|
19403 | Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
19404 | }
|
19405 |
|
19406 | var LOADING_MESSAGE = 'Loading…';
|
19407 | var FAILURE_MESSAGE = function (status, message) {
|
19408 | return '✖ Error ' + status + ' while fetching file: ' + message;
|
19409 | };
|
19410 | var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
|
19411 |
|
19412 | var EXTENSIONS = {
|
19413 | 'js': 'javascript',
|
19414 | 'py': 'python',
|
19415 | 'rb': 'ruby',
|
19416 | 'ps1': 'powershell',
|
19417 | 'psm1': 'powershell',
|
19418 | 'sh': 'bash',
|
19419 | 'bat': 'batch',
|
19420 | 'h': 'c',
|
19421 | 'tex': 'latex'
|
19422 | };
|
19423 |
|
19424 | var STATUS_ATTR = 'data-src-status';
|
19425 | var STATUS_LOADING = 'loading';
|
19426 | var STATUS_LOADED = 'loaded';
|
19427 | var STATUS_FAILED = 'failed';
|
19428 |
|
19429 | var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
|
19430 | + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
|
19431 |
|
19432 | /**
|
19433 | * Loads the given file.
|
19434 | *
|
19435 | * @param {string} src The URL or path of the source file to load.
|
19436 | * @param {(result: string) => void} success
|
19437 | * @param {(reason: string) => void} error
|
19438 | */
|
19439 | function loadFile(src, success, error) {
|
19440 | var xhr = new XMLHttpRequest();
|
19441 | xhr.open('GET', src, true);
|
19442 | xhr.onreadystatechange = function () {
|
19443 | if (xhr.readyState == 4) {
|
19444 | if (xhr.status < 400 && xhr.responseText) {
|
19445 | success(xhr.responseText);
|
19446 | } else {
|
19447 | if (xhr.status >= 400) {
|
19448 | error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
|
19449 | } else {
|
19450 | error(FAILURE_EMPTY_MESSAGE);
|
19451 | }
|
19452 | }
|
19453 | }
|
19454 | };
|
19455 | xhr.send(null);
|
19456 | }
|
19457 |
|
19458 | /**
|
19459 | * Parses the given range.
|
19460 | *
|
19461 | * This returns a range with inclusive ends.
|
19462 | *
|
19463 | * @param {string | null | undefined} range
|
19464 | * @returns {[number, number | undefined] | undefined}
|
19465 | */
|
19466 | function parseRange(range) {
|
19467 | var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
|
19468 | if (m) {
|
19469 | var start = Number(m[1]);
|
19470 | var comma = m[2];
|
19471 | var end = m[3];
|
19472 |
|
19473 | if (!comma) {
|
19474 | return [start, start];
|
19475 | }
|
19476 | if (!end) {
|
19477 | return [start, undefined];
|
19478 | }
|
19479 | return [start, Number(end)];
|
19480 | }
|
19481 | return undefined;
|
19482 | }
|
19483 |
|
19484 | Prism.hooks.add('before-highlightall', function (env) {
|
19485 | env.selector += ', ' + SELECTOR;
|
19486 | });
|
19487 |
|
19488 | Prism.hooks.add('before-sanity-check', function (env) {
|
19489 | var pre = /** @type {HTMLPreElement} */ (env.element);
|
19490 | if (pre.matches(SELECTOR)) {
|
19491 | env.code = ''; // fast-path the whole thing and go to complete
|
19492 |
|
19493 | pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
|
19494 |
|
19495 | // add code element with loading message
|
19496 | var code = pre.appendChild(document.createElement('CODE'));
|
19497 | code.textContent = LOADING_MESSAGE;
|
19498 |
|
19499 | var src = pre.getAttribute('data-src');
|
19500 |
|
19501 | var language = env.language;
|
19502 | if (language === 'none') {
|
19503 | // the language might be 'none' because there is no language set;
|
19504 | // in this case, we want to use the extension as the language
|
19505 | var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
|
19506 | language = EXTENSIONS[extension] || extension;
|
19507 | }
|
19508 |
|
19509 | // set language classes
|
19510 | Prism.util.setLanguage(code, language);
|
19511 | Prism.util.setLanguage(pre, language);
|
19512 |
|
19513 | // preload the language
|
19514 | var autoloader = Prism.plugins.autoloader;
|
19515 | if (autoloader) {
|
19516 | autoloader.loadLanguages(language);
|
19517 | }
|
19518 |
|
19519 | // load file
|
19520 | loadFile(
|
19521 | src,
|
19522 | function (text) {
|
19523 | // mark as loaded
|
19524 | pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
|
19525 |
|
19526 | // handle data-range
|
19527 | var range = parseRange(pre.getAttribute('data-range'));
|
19528 | if (range) {
|
19529 | var lines = text.split(/\r\n?|\n/g);
|
19530 |
|
19531 | // the range is one-based and inclusive on both ends
|
19532 | var start = range[0];
|
19533 | var end = range[1] == null ? lines.length : range[1];
|
19534 |
|
19535 | if (start < 0) { start += lines.length; }
|
19536 | start = Math.max(0, Math.min(start - 1, lines.length));
|
19537 | if (end < 0) { end += lines.length; }
|
19538 | end = Math.max(0, Math.min(end, lines.length));
|
19539 |
|
19540 | text = lines.slice(start, end).join('\n');
|
19541 |
|
19542 | // add data-start for line numbers
|
19543 | if (!pre.hasAttribute('data-start')) {
|
19544 | pre.setAttribute('data-start', String(start + 1));
|
19545 | }
|
19546 | }
|
19547 |
|
19548 | // highlight code
|
19549 | code.textContent = text;
|
19550 | Prism.highlightElement(code);
|
19551 | },
|
19552 | function (error) {
|
19553 | // mark as failed
|
19554 | pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
|
19555 |
|
19556 | code.textContent = error;
|
19557 | }
|
19558 | );
|
19559 | }
|
19560 | });
|
19561 |
|
19562 | Prism.plugins.fileHighlight = {
|
19563 | /**
|
19564 | * Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
19565 | *
|
19566 | * Note: Elements which are already loaded or currently loading will not be touched by this method.
|
19567 | *
|
19568 | * @param {ParentNode} [container=document]
|
19569 | */
|
19570 | highlight: function highlight(container) {
|
19571 | var elements = (container || document).querySelectorAll(SELECTOR);
|
19572 |
|
19573 | for (var i = 0, element; (element = elements[i++]);) {
|
19574 | Prism.highlightElement(element);
|
19575 | }
|
19576 | }
|
19577 | };
|
19578 |
|
19579 | var logged = false;
|
19580 | /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
|
19581 | Prism.fileHighlight = function () {
|
19582 | if (!logged) {
|
19583 | console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
|
19584 | logged = true;
|
19585 | }
|
19586 | Prism.plugins.fileHighlight.highlight.apply(this, arguments);
|
19587 | };
|
19588 |
|
19589 | }());
|
19590 |
|
19591 |
|
19592 | /***/ }),
|
19593 |
|
19594 | /***/ 859:
|
19595 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
19596 |
|
19597 | const ret = __webpack_require__(96);
|
19598 | const DRange = __webpack_require__(4);
|
19599 | const types = ret.types;
|
19600 |
|
19601 |
|
19602 | module.exports = class RandExp {
|
19603 | /**
|
19604 | * @constructor
|
19605 | * @param {RegExp|String} regexp
|
19606 | * @param {String} m
|
19607 | */
|
19608 | constructor(regexp, m) {
|
19609 | this._setDefaults(regexp);
|
19610 | if (regexp instanceof RegExp) {
|
19611 | this.ignoreCase = regexp.ignoreCase;
|
19612 | this.multiline = regexp.multiline;
|
19613 | regexp = regexp.source;
|
19614 |
|
19615 | } else if (typeof regexp === 'string') {
|
19616 | this.ignoreCase = m && m.indexOf('i') !== -1;
|
19617 | this.multiline = m && m.indexOf('m') !== -1;
|
19618 | } else {
|
19619 | throw new Error('Expected a regexp or string');
|
19620 | }
|
19621 |
|
19622 | this.tokens = ret(regexp);
|
19623 | }
|
19624 |
|
19625 |
|
19626 | /**
|
19627 | * Checks if some custom properties have been set for this regexp.
|
19628 | *
|
19629 | * @param {RandExp} randexp
|
19630 | * @param {RegExp} regexp
|
19631 | */
|
19632 | _setDefaults(regexp) {
|
19633 | // When a repetitional token has its max set to Infinite,
|
19634 | // randexp won't actually generate a random amount between min and Infinite
|
19635 | // instead it will see Infinite as min + 100.
|
19636 | this.max = regexp.max != null ? regexp.max :
|
19637 | RandExp.prototype.max != null ? RandExp.prototype.max : 100;
|
19638 |
|
19639 | // This allows expanding to include additional characters
|
19640 | // for instance: RandExp.defaultRange.add(0, 65535);
|
19641 | this.defaultRange = regexp.defaultRange ?
|
19642 | regexp.defaultRange : this.defaultRange.clone();
|
19643 |
|
19644 | if (regexp.randInt) {
|
19645 | this.randInt = regexp.randInt;
|
19646 | }
|
19647 | }
|
19648 |
|
19649 |
|
19650 | /**
|
19651 | * Generates the random string.
|
19652 | *
|
19653 | * @return {String}
|
19654 | */
|
19655 | gen() {
|
19656 | return this._gen(this.tokens, []);
|
19657 | }
|
19658 |
|
19659 |
|
19660 | /**
|
19661 | * Generate random string modeled after given tokens.
|
19662 | *
|
19663 | * @param {Object} token
|
19664 | * @param {Array.<String>} groups
|
19665 | * @return {String}
|
19666 | */
|
19667 | _gen(token, groups) {
|
19668 | var stack, str, n, i, l;
|
19669 |
|
19670 | switch (token.type) {
|
19671 | case types.ROOT:
|
19672 | case types.GROUP:
|
19673 | // Ignore lookaheads for now.
|
19674 | if (token.followedBy || token.notFollowedBy) { return ''; }
|
19675 |
|
19676 | // Insert placeholder until group string is generated.
|
19677 | if (token.remember && token.groupNumber === undefined) {
|
19678 | token.groupNumber = groups.push(null) - 1;
|
19679 | }
|
19680 |
|
19681 | stack = token.options ?
|
19682 | this._randSelect(token.options) : token.stack;
|
19683 |
|
19684 | str = '';
|
19685 | for (i = 0, l = stack.length; i < l; i++) {
|
19686 | str += this._gen(stack[i], groups);
|
19687 | }
|
19688 |
|
19689 | if (token.remember) {
|
19690 | groups[token.groupNumber] = str;
|
19691 | }
|
19692 | return str;
|
19693 |
|
19694 | case types.POSITION:
|
19695 | // Do nothing for now.
|
19696 | return '';
|
19697 |
|
19698 | case types.SET:
|
19699 | var expandedSet = this._expand(token);
|
19700 | if (!expandedSet.length) { return ''; }
|
19701 | return String.fromCharCode(this._randSelect(expandedSet));
|
19702 |
|
19703 | case types.REPETITION:
|
19704 | // Randomly generate number between min and max.
|
19705 | n = this.randInt(token.min,
|
19706 | token.max === Infinity ? token.min + this.max : token.max);
|
19707 |
|
19708 | str = '';
|
19709 | for (i = 0; i < n; i++) {
|
19710 | str += this._gen(token.value, groups);
|
19711 | }
|
19712 |
|
19713 | return str;
|
19714 |
|
19715 | case types.REFERENCE:
|
19716 | return groups[token.value - 1] || '';
|
19717 |
|
19718 | case types.CHAR:
|
19719 | var code = this.ignoreCase && this._randBool() ?
|
19720 | this._toOtherCase(token.value) : token.value;
|
19721 | return String.fromCharCode(code);
|
19722 | }
|
19723 | }
|
19724 |
|
19725 |
|
19726 | /**
|
19727 | * If code is alphabetic, converts to other case.
|
19728 | * If not alphabetic, returns back code.
|
19729 | *
|
19730 | * @param {Number} code
|
19731 | * @return {Number}
|
19732 | */
|
19733 | _toOtherCase(code) {
|
19734 | return code + (97 <= code && code <= 122 ? -32 :
|
19735 | 65 <= code && code <= 90 ? 32 : 0);
|
19736 | }
|
19737 |
|
19738 |
|
19739 | /**
|
19740 | * Randomly returns a true or false value.
|
19741 | *
|
19742 | * @return {Boolean}
|
19743 | */
|
19744 | _randBool() {
|
19745 | return !this.randInt(0, 1);
|
19746 | }
|
19747 |
|
19748 |
|
19749 | /**
|
19750 | * Randomly selects and returns a value from the array.
|
19751 | *
|
19752 | * @param {Array.<Object>} arr
|
19753 | * @return {Object}
|
19754 | */
|
19755 | _randSelect(arr) {
|
19756 | if (arr instanceof DRange) {
|
19757 | return arr.index(this.randInt(0, arr.length - 1));
|
19758 | }
|
19759 | return arr[this.randInt(0, arr.length - 1)];
|
19760 | }
|
19761 |
|
19762 |
|
19763 | /**
|
19764 | * expands a token to a DiscontinuousRange of characters which has a
|
19765 | * length and an index function (for random selecting)
|
19766 | *
|
19767 | * @param {Object} token
|
19768 | * @return {DiscontinuousRange}
|
19769 | */
|
19770 | _expand(token) {
|
19771 | if (token.type === ret.types.CHAR) {
|
19772 | return new DRange(token.value);
|
19773 | } else if (token.type === ret.types.RANGE) {
|
19774 | return new DRange(token.from, token.to);
|
19775 | } else {
|
19776 | let drange = new DRange();
|
19777 | for (let i = 0; i < token.set.length; i++) {
|
19778 | let subrange = this._expand(token.set[i]);
|
19779 | drange.add(subrange);
|
19780 | if (this.ignoreCase) {
|
19781 | for (let j = 0; j < subrange.length; j++) {
|
19782 | let code = subrange.index(j);
|
19783 | let otherCaseCode = this._toOtherCase(code);
|
19784 | if (code !== otherCaseCode) {
|
19785 | drange.add(otherCaseCode);
|
19786 | }
|
19787 | }
|
19788 | }
|
19789 | }
|
19790 | if (token.not) {
|
19791 | return this.defaultRange.clone().subtract(drange);
|
19792 | } else {
|
19793 | return this.defaultRange.clone().intersect(drange);
|
19794 | }
|
19795 | }
|
19796 | }
|
19797 |
|
19798 |
|
19799 | /**
|
19800 | * Randomly generates and returns a number between a and b (inclusive).
|
19801 | *
|
19802 | * @param {Number} a
|
19803 | * @param {Number} b
|
19804 | * @return {Number}
|
19805 | */
|
19806 | randInt(a, b) {
|
19807 | return a + Math.floor(Math.random() * (1 + b - a));
|
19808 | }
|
19809 |
|
19810 |
|
19811 | /**
|
19812 | * Default range of characters to generate from.
|
19813 | */
|
19814 | get defaultRange() {
|
19815 | return this._range = this._range || new DRange(32, 126);
|
19816 | }
|
19817 |
|
19818 | set defaultRange(range) {
|
19819 | this._range = range;
|
19820 | }
|
19821 |
|
19822 |
|
19823 | /**
|
19824 | *
|
19825 | * Enables use of randexp with a shorter call.
|
19826 | *
|
19827 | * @param {RegExp|String| regexp}
|
19828 | * @param {String} m
|
19829 | * @return {String}
|
19830 | */
|
19831 | static randexp(regexp, m) {
|
19832 | var randexp;
|
19833 | if(typeof regexp === 'string') {
|
19834 | regexp = new RegExp(regexp, m);
|
19835 | }
|
19836 |
|
19837 | if (regexp._randexp === undefined) {
|
19838 | randexp = new RandExp(regexp, m);
|
19839 | regexp._randexp = randexp;
|
19840 | } else {
|
19841 | randexp = regexp._randexp;
|
19842 | randexp._setDefaults(regexp);
|
19843 | }
|
19844 | return randexp.gen();
|
19845 | }
|
19846 |
|
19847 |
|
19848 | /**
|
19849 | * Enables sugary /regexp/.gen syntax.
|
19850 | */
|
19851 | static sugar() {
|
19852 | /* eshint freeze:false */
|
19853 | RegExp.prototype.gen = function() {
|
19854 | return RandExp.randexp(this);
|
19855 | };
|
19856 | }
|
19857 | };
|
19858 |
|
19859 |
|
19860 | /***/ }),
|
19861 |
|
19862 | /***/ 208:
|
19863 | /***/ ((module) => {
|
19864 |
|
19865 | "use strict";
|
19866 | /*!
|
19867 | * repeat-string <https://github.com/jonschlinkert/repeat-string>
|
19868 | *
|
19869 | * Copyright (c) 2014-2015, Jon Schlinkert.
|
19870 | * Licensed under the MIT License.
|
19871 | */
|
19872 |
|
19873 |
|
19874 |
|
19875 | /**
|
19876 | * Results cache
|
19877 | */
|
19878 |
|
19879 | var res = '';
|
19880 | var cache;
|
19881 |
|
19882 | /**
|
19883 | * Expose `repeat`
|
19884 | */
|
19885 |
|
19886 | module.exports = repeat;
|
19887 |
|
19888 | /**
|
19889 | * Repeat the given `string` the specified `number`
|
19890 | * of times.
|
19891 | *
|
19892 | * **Example:**
|
19893 | *
|
19894 | * ```js
|
19895 | * var repeat = require('repeat-string');
|
19896 | * repeat('A', 5);
|
19897 | * //=> AAAAA
|
19898 | * ```
|
19899 | *
|
19900 | * @param {String} `string` The string to repeat
|
19901 | * @param {Number} `number` The number of times to repeat the string
|
19902 | * @return {String} Repeated string
|
19903 | * @api public
|
19904 | */
|
19905 |
|
19906 | function repeat(str, num) {
|
19907 | if (typeof str !== 'string') {
|
19908 | throw new TypeError('expected a string');
|
19909 | }
|
19910 |
|
19911 | // cover common, quick use cases
|
19912 | if (num === 1) return str;
|
19913 | if (num === 2) return str + str;
|
19914 |
|
19915 | var max = str.length * num;
|
19916 | if (cache !== str || typeof cache === 'undefined') {
|
19917 | cache = str;
|
19918 | res = '';
|
19919 | } else if (res.length >= max) {
|
19920 | return res.substr(0, max);
|
19921 | }
|
19922 |
|
19923 | while (max > res.length && num > 1) {
|
19924 | if (num & 1) {
|
19925 | res += str;
|
19926 | }
|
19927 |
|
19928 | num >>= 1;
|
19929 | str += str;
|
19930 | }
|
19931 |
|
19932 | res += str;
|
19933 | res = res.substr(0, max);
|
19934 | return res;
|
19935 | }
|
19936 |
|
19937 |
|
19938 | /***/ }),
|
19939 |
|
19940 | /***/ 96:
|
19941 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
19942 |
|
19943 | const util = __webpack_require__(586);
|
19944 | const types = __webpack_require__(205);
|
19945 | const sets = __webpack_require__(23);
|
19946 | const positions = __webpack_require__(48);
|
19947 |
|
19948 |
|
19949 | module.exports = (regexpStr) => {
|
19950 | var i = 0, l, c,
|
19951 | start = { type: types.ROOT, stack: []},
|
19952 |
|
19953 | // Keep track of last clause/group and stack.
|
19954 | lastGroup = start,
|
19955 | last = start.stack,
|
19956 | groupStack = [];
|
19957 |
|
19958 |
|
19959 | var repeatErr = (i) => {
|
19960 | util.error(regexpStr, `Nothing to repeat at column ${i - 1}`);
|
19961 | };
|
19962 |
|
19963 | // Decode a few escaped characters.
|
19964 | var str = util.strToChars(regexpStr);
|
19965 | l = str.length;
|
19966 |
|
19967 | // Iterate through each character in string.
|
19968 | while (i < l) {
|
19969 | c = str[i++];
|
19970 |
|
19971 | switch (c) {
|
19972 | // Handle escaped characters, inclues a few sets.
|
19973 | case '\\':
|
19974 | c = str[i++];
|
19975 |
|
19976 | switch (c) {
|
19977 | case 'b':
|
19978 | last.push(positions.wordBoundary());
|
19979 | break;
|
19980 |
|
19981 | case 'B':
|
19982 | last.push(positions.nonWordBoundary());
|
19983 | break;
|
19984 |
|
19985 | case 'w':
|
19986 | last.push(sets.words());
|
19987 | break;
|
19988 |
|
19989 | case 'W':
|
19990 | last.push(sets.notWords());
|
19991 | break;
|
19992 |
|
19993 | case 'd':
|
19994 | last.push(sets.ints());
|
19995 | break;
|
19996 |
|
19997 | case 'D':
|
19998 | last.push(sets.notInts());
|
19999 | break;
|
20000 |
|
20001 | case 's':
|
20002 | last.push(sets.whitespace());
|
20003 | break;
|
20004 |
|
20005 | case 'S':
|
20006 | last.push(sets.notWhitespace());
|
20007 | break;
|
20008 |
|
20009 | default:
|
20010 | // Check if c is integer.
|
20011 | // In which case it's a reference.
|
20012 | if (/\d/.test(c)) {
|
20013 | last.push({ type: types.REFERENCE, value: parseInt(c, 10) });
|
20014 |
|
20015 | // Escaped character.
|
20016 | } else {
|
20017 | last.push({ type: types.CHAR, value: c.charCodeAt(0) });
|
20018 | }
|
20019 | }
|
20020 |
|
20021 | break;
|
20022 |
|
20023 |
|
20024 | // Positionals.
|
20025 | case '^':
|
20026 | last.push(positions.begin());
|
20027 | break;
|
20028 |
|
20029 | case '$':
|
20030 | last.push(positions.end());
|
20031 | break;
|
20032 |
|
20033 |
|
20034 | // Handle custom sets.
|
20035 | case '[':
|
20036 | // Check if this class is 'anti' i.e. [^abc].
|
20037 | var not;
|
20038 | if (str[i] === '^') {
|
20039 | not = true;
|
20040 | i++;
|
20041 | } else {
|
20042 | not = false;
|
20043 | }
|
20044 |
|
20045 | // Get all the characters in class.
|
20046 | var classTokens = util.tokenizeClass(str.slice(i), regexpStr);
|
20047 |
|
20048 | // Increase index by length of class.
|
20049 | i += classTokens[1];
|
20050 | last.push({
|
20051 | type: types.SET,
|
20052 | set: classTokens[0],
|
20053 | not,
|
20054 | });
|
20055 |
|
20056 | break;
|
20057 |
|
20058 |
|
20059 | // Class of any character except \n.
|
20060 | case '.':
|
20061 | last.push(sets.anyChar());
|
20062 | break;
|
20063 |
|
20064 |
|
20065 | // Push group onto stack.
|
20066 | case '(':
|
20067 | // Create group.
|
20068 | var group = {
|
20069 | type: types.GROUP,
|
20070 | stack: [],
|
20071 | remember: true,
|
20072 | };
|
20073 |
|
20074 | c = str[i];
|
20075 |
|
20076 | // If if this is a special kind of group.
|
20077 | if (c === '?') {
|
20078 | c = str[i + 1];
|
20079 | i += 2;
|
20080 |
|
20081 | // Match if followed by.
|
20082 | if (c === '=') {
|
20083 | group.followedBy = true;
|
20084 |
|
20085 | // Match if not followed by.
|
20086 | } else if (c === '!') {
|
20087 | group.notFollowedBy = true;
|
20088 |
|
20089 | } else if (c !== ':') {
|
20090 | util.error(regexpStr,
|
20091 | `Invalid group, character '${c}'` +
|
20092 | ` after '?' at column ${i - 1}`);
|
20093 | }
|
20094 |
|
20095 | group.remember = false;
|
20096 | }
|
20097 |
|
20098 | // Insert subgroup into current group stack.
|
20099 | last.push(group);
|
20100 |
|
20101 | // Remember the current group for when the group closes.
|
20102 | groupStack.push(lastGroup);
|
20103 |
|
20104 | // Make this new group the current group.
|
20105 | lastGroup = group;
|
20106 | last = group.stack;
|
20107 | break;
|
20108 |
|
20109 |
|
20110 | // Pop group out of stack.
|
20111 | case ')':
|
20112 | if (groupStack.length === 0) {
|
20113 | util.error(regexpStr, `Unmatched ) at column ${i - 1}`);
|
20114 | }
|
20115 | lastGroup = groupStack.pop();
|
20116 |
|
20117 | // Check if this group has a PIPE.
|
20118 | // To get back the correct last stack.
|
20119 | last = lastGroup.options ?
|
20120 | lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;
|
20121 | break;
|
20122 |
|
20123 |
|
20124 | // Use pipe character to give more choices.
|
20125 | case '|':
|
20126 | // Create array where options are if this is the first PIPE
|
20127 | // in this clause.
|
20128 | if (!lastGroup.options) {
|
20129 | lastGroup.options = [lastGroup.stack];
|
20130 | delete lastGroup.stack;
|
20131 | }
|
20132 |
|
20133 | // Create a new stack and add to options for rest of clause.
|
20134 | var stack = [];
|
20135 | lastGroup.options.push(stack);
|
20136 | last = stack;
|
20137 | break;
|
20138 |
|
20139 |
|
20140 | // Repetition.
|
20141 | // For every repetition, remove last element from last stack
|
20142 | // then insert back a RANGE object.
|
20143 | // This design is chosen because there could be more than
|
20144 | // one repetition symbols in a regex i.e. `a?+{2,3}`.
|
20145 | case '{':
|
20146 | var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)), min, max;
|
20147 | if (rs !== null) {
|
20148 | if (last.length === 0) {
|
20149 | repeatErr(i);
|
20150 | }
|
20151 | min = parseInt(rs[1], 10);
|
20152 | max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;
|
20153 | i += rs[0].length;
|
20154 |
|
20155 | last.push({
|
20156 | type: types.REPETITION,
|
20157 | min,
|
20158 | max,
|
20159 | value: last.pop(),
|
20160 | });
|
20161 | } else {
|
20162 | last.push({
|
20163 | type: types.CHAR,
|
20164 | value: 123,
|
20165 | });
|
20166 | }
|
20167 | break;
|
20168 |
|
20169 | case '?':
|
20170 | if (last.length === 0) {
|
20171 | repeatErr(i);
|
20172 | }
|
20173 | last.push({
|
20174 | type: types.REPETITION,
|
20175 | min: 0,
|
20176 | max: 1,
|
20177 | value: last.pop(),
|
20178 | });
|
20179 | break;
|
20180 |
|
20181 | case '+':
|
20182 | if (last.length === 0) {
|
20183 | repeatErr(i);
|
20184 | }
|
20185 | last.push({
|
20186 | type: types.REPETITION,
|
20187 | min: 1,
|
20188 | max: Infinity,
|
20189 | value: last.pop(),
|
20190 | });
|
20191 | break;
|
20192 |
|
20193 | case '*':
|
20194 | if (last.length === 0) {
|
20195 | repeatErr(i);
|
20196 | }
|
20197 | last.push({
|
20198 | type: types.REPETITION,
|
20199 | min: 0,
|
20200 | max: Infinity,
|
20201 | value: last.pop(),
|
20202 | });
|
20203 | break;
|
20204 |
|
20205 |
|
20206 | // Default is a character that is not `\[](){}?+*^$`.
|
20207 | default:
|
20208 | last.push({
|
20209 | type: types.CHAR,
|
20210 | value: c.charCodeAt(0),
|
20211 | });
|
20212 | }
|
20213 |
|
20214 | }
|
20215 |
|
20216 | // Check if any groups have not been closed.
|
20217 | if (groupStack.length !== 0) {
|
20218 | util.error(regexpStr, 'Unterminated group');
|
20219 | }
|
20220 |
|
20221 | return start;
|
20222 | };
|
20223 |
|
20224 | module.exports.types = types;
|
20225 |
|
20226 |
|
20227 | /***/ }),
|
20228 |
|
20229 | /***/ 48:
|
20230 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
20231 |
|
20232 | const types = __webpack_require__(205);
|
20233 | exports.wordBoundary = () => ({ type: types.POSITION, value: 'b' });
|
20234 | exports.nonWordBoundary = () => ({ type: types.POSITION, value: 'B' });
|
20235 | exports.begin = () => ({ type: types.POSITION, value: '^' });
|
20236 | exports.end = () => ({ type: types.POSITION, value: '$' });
|
20237 |
|
20238 |
|
20239 | /***/ }),
|
20240 |
|
20241 | /***/ 23:
|
20242 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
20243 |
|
20244 | const types = __webpack_require__(205);
|
20245 |
|
20246 | const INTS = () => [{ type: types.RANGE , from: 48, to: 57 }];
|
20247 |
|
20248 | const WORDS = () => {
|
20249 | return [
|
20250 | { type: types.CHAR, value: 95 },
|
20251 | { type: types.RANGE, from: 97, to: 122 },
|
20252 | { type: types.RANGE, from: 65, to: 90 }
|
20253 | ].concat(INTS());
|
20254 | };
|
20255 |
|
20256 | const WHITESPACE = () => {
|
20257 | return [
|
20258 | { type: types.CHAR, value: 9 },
|
20259 | { type: types.CHAR, value: 10 },
|
20260 | { type: types.CHAR, value: 11 },
|
20261 | { type: types.CHAR, value: 12 },
|
20262 | { type: types.CHAR, value: 13 },
|
20263 | { type: types.CHAR, value: 32 },
|
20264 | { type: types.CHAR, value: 160 },
|
20265 | { type: types.CHAR, value: 5760 },
|
20266 | { type: types.RANGE, from: 8192, to: 8202 },
|
20267 | { type: types.CHAR, value: 8232 },
|
20268 | { type: types.CHAR, value: 8233 },
|
20269 | { type: types.CHAR, value: 8239 },
|
20270 | { type: types.CHAR, value: 8287 },
|
20271 | { type: types.CHAR, value: 12288 },
|
20272 | { type: types.CHAR, value: 65279 }
|
20273 | ];
|
20274 | };
|
20275 |
|
20276 | const NOTANYCHAR = () => {
|
20277 | return [
|
20278 | { type: types.CHAR, value: 10 },
|
20279 | { type: types.CHAR, value: 13 },
|
20280 | { type: types.CHAR, value: 8232 },
|
20281 | { type: types.CHAR, value: 8233 },
|
20282 | ];
|
20283 | };
|
20284 |
|
20285 | // Predefined class objects.
|
20286 | exports.words = () => ({ type: types.SET, set: WORDS(), not: false });
|
20287 | exports.notWords = () => ({ type: types.SET, set: WORDS(), not: true });
|
20288 | exports.ints = () => ({ type: types.SET, set: INTS(), not: false });
|
20289 | exports.notInts = () => ({ type: types.SET, set: INTS(), not: true });
|
20290 | exports.whitespace = () => ({ type: types.SET, set: WHITESPACE(), not: false });
|
20291 | exports.notWhitespace = () => ({ type: types.SET, set: WHITESPACE(), not: true });
|
20292 | exports.anyChar = () => ({ type: types.SET, set: NOTANYCHAR(), not: true });
|
20293 |
|
20294 |
|
20295 | /***/ }),
|
20296 |
|
20297 | /***/ 205:
|
20298 | /***/ ((module) => {
|
20299 |
|
20300 | module.exports = {
|
20301 | ROOT : 0,
|
20302 | GROUP : 1,
|
20303 | POSITION : 2,
|
20304 | SET : 3,
|
20305 | RANGE : 4,
|
20306 | REPETITION : 5,
|
20307 | REFERENCE : 6,
|
20308 | CHAR : 7,
|
20309 | };
|
20310 |
|
20311 |
|
20312 | /***/ }),
|
20313 |
|
20314 | /***/ 586:
|
20315 | /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
20316 |
|
20317 | const types = __webpack_require__(205);
|
20318 | const sets = __webpack_require__(23);
|
20319 |
|
20320 |
|
20321 | const CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?';
|
20322 | const SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 };
|
20323 |
|
20324 | /**
|
20325 | * Finds character representations in str and convert all to
|
20326 | * their respective characters
|
20327 | *
|
20328 | * @param {String} str
|
20329 | * @return {String}
|
20330 | */
|
20331 | exports.strToChars = function(str) {
|
20332 | /* jshint maxlen: false */
|
20333 | var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;
|
20334 | str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) {
|
20335 | if (lbs) {
|
20336 | return s;
|
20337 | }
|
20338 |
|
20339 | var code = b ? 8 :
|
20340 | a16 ? parseInt(a16, 16) :
|
20341 | b16 ? parseInt(b16, 16) :
|
20342 | c8 ? parseInt(c8, 8) :
|
20343 | dctrl ? CTRL.indexOf(dctrl) :
|
20344 | SLSH[eslsh];
|
20345 |
|
20346 | var c = String.fromCharCode(code);
|
20347 |
|
20348 | // Escape special regex characters.
|
20349 | if (/[[\]{}^$.|?*+()]/.test(c)) {
|
20350 | c = '\\' + c;
|
20351 | }
|
20352 |
|
20353 | return c;
|
20354 | });
|
20355 |
|
20356 | return str;
|
20357 | };
|
20358 |
|
20359 |
|
20360 | /**
|
20361 | * turns class into tokens
|
20362 | * reads str until it encounters a ] not preceeded by a \
|
20363 | *
|
20364 | * @param {String} str
|
20365 | * @param {String} regexpStr
|
20366 | * @return {Array.<Array.<Object>, Number>}
|
20367 | */
|
20368 | exports.tokenizeClass = (str, regexpStr) => {
|
20369 | /* jshint maxlen: false */
|
20370 | var tokens = [];
|
20371 | var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g;
|
20372 | var rs, c;
|
20373 |
|
20374 |
|
20375 | while ((rs = regexp.exec(str)) != null) {
|
20376 | if (rs[1]) {
|
20377 | tokens.push(sets.words());
|
20378 |
|
20379 | } else if (rs[2]) {
|
20380 | tokens.push(sets.ints());
|
20381 |
|
20382 | } else if (rs[3]) {
|
20383 | tokens.push(sets.whitespace());
|
20384 |
|
20385 | } else if (rs[4]) {
|
20386 | tokens.push(sets.notWords());
|
20387 |
|
20388 | } else if (rs[5]) {
|
20389 | tokens.push(sets.notInts());
|
20390 |
|
20391 | } else if (rs[6]) {
|
20392 | tokens.push(sets.notWhitespace());
|
20393 |
|
20394 | } else if (rs[7]) {
|
20395 | tokens.push({
|
20396 | type: types.RANGE,
|
20397 | from: (rs[8] || rs[9]).charCodeAt(0),
|
20398 | to: rs[10].charCodeAt(0),
|
20399 | });
|
20400 |
|
20401 | } else if ((c = rs[12])) {
|
20402 | tokens.push({
|
20403 | type: types.CHAR,
|
20404 | value: c.charCodeAt(0),
|
20405 | });
|
20406 |
|
20407 | } else {
|
20408 | return [tokens, regexp.lastIndex];
|
20409 | }
|
20410 | }
|
20411 |
|
20412 | exports.error(regexpStr, 'Unterminated character class');
|
20413 | };
|
20414 |
|
20415 |
|
20416 | /**
|
20417 | * Shortcut to throw errors.
|
20418 | *
|
20419 | * @param {String} regexp
|
20420 | * @param {String} msg
|
20421 | */
|
20422 | exports.error = (regexp, msg) => {
|
20423 | throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);
|
20424 | };
|
20425 |
|
20426 |
|
20427 | /***/ }),
|
20428 |
|
20429 | /***/ 657:
|
20430 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
20431 |
|
20432 | "use strict";
|
20433 |
|
20434 |
|
20435 | var repeat = __webpack_require__(208);
|
20436 |
|
20437 | var splitOnTags = function splitOnTags(str) {
|
20438 | return str.split(/(<\/?[^>]+>)/g).filter(function (line) {
|
20439 | return line.trim() !== '';
|
20440 | });
|
20441 | };
|
20442 | var isTag = function isTag(str) {
|
20443 | return (/<[^>!]+>/.test(str)
|
20444 | );
|
20445 | };
|
20446 | var isClosingTag = function isClosingTag(str) {
|
20447 | return (/<\/+[^>]+>/.test(str)
|
20448 | );
|
20449 | };
|
20450 | var isSelfClosingTag = function isSelfClosingTag(str) {
|
20451 | return (/<[^>]+\/>/.test(str)
|
20452 | );
|
20453 | };
|
20454 | var isOpeningTag = function isOpeningTag(str) {
|
20455 | return isTag(str) && !isClosingTag(str) && !isSelfClosingTag(str);
|
20456 | };
|
20457 |
|
20458 | module.exports = function (xml) {
|
20459 | var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
20460 | var indentor = config.indentor,
|
20461 | textNodesOnSameLine = config.textNodesOnSameLine;
|
20462 |
|
20463 | var depth = 0;
|
20464 | var indicesToRemove = [];
|
20465 | indentor = indentor || ' ';
|
20466 |
|
20467 | var rawResult = lexer(xml).map(function (element, i, arr) {
|
20468 | var value = element.value,
|
20469 | type = element.type;
|
20470 |
|
20471 | if (type === 'ClosingTag') {
|
20472 | depth--;
|
20473 | }
|
20474 |
|
20475 | var indentation = repeat(indentor, depth);
|
20476 | var line = indentation + value;
|
20477 |
|
20478 | if (type === 'OpeningTag') {
|
20479 | depth++;
|
20480 | }
|
20481 |
|
20482 | if (textNodesOnSameLine) {
|
20483 | // Lookbehind for [OpeningTag][Text][ClosingTag]
|
20484 | var oneBefore = arr[i - 1];
|
20485 | var twoBefore = arr[i - 2];
|
20486 |
|
20487 | if (type === "ClosingTag" && oneBefore.type === "Text" && twoBefore.type === "OpeningTag") {
|
20488 | // collapse into a single line
|
20489 | line = '' + indentation + twoBefore.value + oneBefore.value + value;
|
20490 | indicesToRemove.push(i - 2, i - 1);
|
20491 | }
|
20492 | }
|
20493 |
|
20494 | return line;
|
20495 | });
|
20496 |
|
20497 | indicesToRemove.forEach(function (idx) {
|
20498 | return rawResult[idx] = null;
|
20499 | });
|
20500 |
|
20501 | return rawResult.filter(function (val) {
|
20502 | return !!val;
|
20503 | }).join('\n');
|
20504 | };
|
20505 |
|
20506 | function lexer(xmlStr) {
|
20507 | var values = splitOnTags(xmlStr);
|
20508 | return values.map(function (value) {
|
20509 | return {
|
20510 | value: value,
|
20511 | type: getType(value)
|
20512 | };
|
20513 | });
|
20514 | }
|
20515 |
|
20516 | // Helpers
|
20517 |
|
20518 | function getType(str) {
|
20519 | if (isClosingTag(str)) {
|
20520 | return 'ClosingTag';
|
20521 | }
|
20522 |
|
20523 | if (isOpeningTag(str)) {
|
20524 | return 'OpeningTag';
|
20525 | }
|
20526 |
|
20527 | if (isSelfClosingTag(str)) {
|
20528 | return 'SelfClosingTag';
|
20529 | }
|
20530 |
|
20531 | return 'Text';
|
20532 | }
|
20533 |
|
20534 | /***/ })
|
20535 |
|
20536 | /******/ });
|
20537 | /************************************************************************/
|
20538 | /******/ // The module cache
|
20539 | /******/ var __webpack_module_cache__ = {};
|
20540 | /******/
|
20541 | /******/ // The require function
|
20542 | /******/ function __webpack_require__(moduleId) {
|
20543 | /******/ // Check if module is in cache
|
20544 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
|
20545 | /******/ if (cachedModule !== undefined) {
|
20546 | /******/ if (cachedModule.error !== undefined) throw cachedModule.error;
|
20547 | /******/ return cachedModule.exports;
|
20548 | /******/ }
|
20549 | /******/ // Create a new module (and put it into the cache)
|
20550 | /******/ var module = __webpack_module_cache__[moduleId] = {
|
20551 | /******/ // no module.id needed
|
20552 | /******/ // no module.loaded needed
|
20553 | /******/ exports: {}
|
20554 | /******/ };
|
20555 | /******/
|
20556 | /******/ // Execute the module function
|
20557 | /******/ try {
|
20558 | /******/ var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };
|
20559 | /******/ __webpack_require__.i.forEach(function(handler) { handler(execOptions); });
|
20560 | /******/ module = execOptions.module;
|
20561 | /******/ execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
|
20562 | /******/ } catch(e) {
|
20563 | /******/ module.error = e;
|
20564 | /******/ throw e;
|
20565 | /******/ }
|
20566 | /******/
|
20567 | /******/ // Return the exports of the module
|
20568 | /******/ return module.exports;
|
20569 | /******/ }
|
20570 | /******/
|
20571 | /******/ // expose the modules object (__webpack_modules__)
|
20572 | /******/ __webpack_require__.m = __webpack_modules__;
|
20573 | /******/
|
20574 | /******/ // expose the module cache
|
20575 | /******/ __webpack_require__.c = __webpack_module_cache__;
|
20576 | /******/
|
20577 | /******/ // expose the module execution interceptor
|
20578 | /******/ __webpack_require__.i = [];
|
20579 | /******/
|
20580 | /************************************************************************/
|
20581 | /******/ /* webpack/runtime/compat get default export */
|
20582 | /******/ (() => {
|
20583 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
20584 | /******/ __webpack_require__.n = (module) => {
|
20585 | /******/ var getter = module && module.__esModule ?
|
20586 | /******/ () => (module['default']) :
|
20587 | /******/ () => (module);
|
20588 | /******/ __webpack_require__.d(getter, { a: getter });
|
20589 | /******/ return getter;
|
20590 | /******/ };
|
20591 | /******/ })();
|
20592 | /******/
|
20593 | /******/ /* webpack/runtime/define property getters */
|
20594 | /******/ (() => {
|
20595 | /******/ // define getter functions for harmony exports
|
20596 | /******/ __webpack_require__.d = (exports, definition) => {
|
20597 | /******/ for(var key in definition) {
|
20598 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
20599 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
20600 | /******/ }
|
20601 | /******/ }
|
20602 | /******/ };
|
20603 | /******/ })();
|
20604 | /******/
|
20605 | /******/ /* webpack/runtime/get javascript update chunk filename */
|
20606 | /******/ (() => {
|
20607 | /******/ // This function allow to reference all chunks
|
20608 | /******/ __webpack_require__.hu = (chunkId) => {
|
20609 | /******/ // return url for filenames based on template
|
20610 | /******/ return "" + chunkId + "." + __webpack_require__.h() + ".hot-update.js";
|
20611 | /******/ };
|
20612 | /******/ })();
|
20613 | /******/
|
20614 | /******/ /* webpack/runtime/get update manifest filename */
|
20615 | /******/ (() => {
|
20616 | /******/ __webpack_require__.hmrF = () => ("main." + __webpack_require__.h() + ".hot-update.json");
|
20617 | /******/ })();
|
20618 | /******/
|
20619 | /******/ /* webpack/runtime/getFullHash */
|
20620 | /******/ (() => {
|
20621 | /******/ __webpack_require__.h = () => ("2337278d415d81467132")
|
20622 | /******/ })();
|
20623 | /******/
|
20624 | /******/ /* webpack/runtime/global */
|
20625 | /******/ (() => {
|
20626 | /******/ __webpack_require__.g = (function() {
|
20627 | /******/ if (typeof globalThis === 'object') return globalThis;
|
20628 | /******/ try {
|
20629 | /******/ return this || new Function('return this')();
|
20630 | /******/ } catch (e) {
|
20631 | /******/ if (typeof window === 'object') return window;
|
20632 | /******/ }
|
20633 | /******/ })();
|
20634 | /******/ })();
|
20635 | /******/
|
20636 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
|
20637 | /******/ (() => {
|
20638 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
20639 | /******/ })();
|
20640 | /******/
|
20641 | /******/ /* webpack/runtime/load script */
|
20642 | /******/ (() => {
|
20643 | /******/ var inProgress = {};
|
20644 | /******/ var dataWebpackPrefix = "rapidoc:";
|
20645 | /******/ // loadScript function to load a script via script tag
|
20646 | /******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
20647 | /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
20648 | /******/ var script, needAttach;
|
20649 | /******/ if(key !== undefined) {
|
20650 | /******/ var scripts = document.getElementsByTagName("script");
|
20651 | /******/ for(var i = 0; i < scripts.length; i++) {
|
20652 | /******/ var s = scripts[i];
|
20653 | /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
20654 | /******/ }
|
20655 | /******/ }
|
20656 | /******/ if(!script) {
|
20657 | /******/ needAttach = true;
|
20658 | /******/ script = document.createElement('script');
|
20659 | /******/
|
20660 | /******/ script.charset = 'utf-8';
|
20661 | /******/ script.timeout = 120;
|
20662 | /******/ if (__webpack_require__.nc) {
|
20663 | /******/ script.setAttribute("nonce", __webpack_require__.nc);
|
20664 | /******/ }
|
20665 | /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
20666 | /******/
|
20667 | /******/ script.src = url;
|
20668 | /******/ }
|
20669 | /******/ inProgress[url] = [done];
|
20670 | /******/ var onScriptComplete = (prev, event) => {
|
20671 | /******/ // avoid mem leaks in IE.
|
20672 | /******/ script.onerror = script.onload = null;
|
20673 | /******/ clearTimeout(timeout);
|
20674 | /******/ var doneFns = inProgress[url];
|
20675 | /******/ delete inProgress[url];
|
20676 | /******/ script.parentNode && script.parentNode.removeChild(script);
|
20677 | /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
20678 | /******/ if(prev) return prev(event);
|
20679 | /******/ }
|
20680 | /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
20681 | /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
20682 | /******/ script.onload = onScriptComplete.bind(null, script.onload);
|
20683 | /******/ needAttach && document.head.appendChild(script);
|
20684 | /******/ };
|
20685 | /******/ })();
|
20686 | /******/
|
20687 | /******/ /* webpack/runtime/hot module replacement */
|
20688 | /******/ (() => {
|
20689 | /******/ var currentModuleData = {};
|
20690 | /******/ var installedModules = __webpack_require__.c;
|
20691 | /******/
|
20692 | /******/ // module and require creation
|
20693 | /******/ var currentChildModule;
|
20694 | /******/ var currentParents = [];
|
20695 | /******/
|
20696 | /******/ // status
|
20697 | /******/ var registeredStatusHandlers = [];
|
20698 | /******/ var currentStatus = "idle";
|
20699 | /******/
|
20700 | /******/ // while downloading
|
20701 | /******/ var blockingPromises = 0;
|
20702 | /******/ var blockingPromisesWaiting = [];
|
20703 | /******/
|
20704 | /******/ // The update info
|
20705 | /******/ var currentUpdateApplyHandlers;
|
20706 | /******/ var queuedInvalidatedModules;
|
20707 | /******/
|
20708 | /******/ __webpack_require__.hmrD = currentModuleData;
|
20709 | /******/
|
20710 | /******/ __webpack_require__.i.push(function (options) {
|
20711 | /******/ var module = options.module;
|
20712 | /******/ var require = createRequire(options.require, options.id);
|
20713 | /******/ module.hot = createModuleHotObject(options.id, module);
|
20714 | /******/ module.parents = currentParents;
|
20715 | /******/ module.children = [];
|
20716 | /******/ currentParents = [];
|
20717 | /******/ options.require = require;
|
20718 | /******/ });
|
20719 | /******/
|
20720 | /******/ __webpack_require__.hmrC = {};
|
20721 | /******/ __webpack_require__.hmrI = {};
|
20722 | /******/
|
20723 | /******/ function createRequire(require, moduleId) {
|
20724 | /******/ var me = installedModules[moduleId];
|
20725 | /******/ if (!me) return require;
|
20726 | /******/ var fn = function (request) {
|
20727 | /******/ if (me.hot.active) {
|
20728 | /******/ if (installedModules[request]) {
|
20729 | /******/ var parents = installedModules[request].parents;
|
20730 | /******/ if (parents.indexOf(moduleId) === -1) {
|
20731 | /******/ parents.push(moduleId);
|
20732 | /******/ }
|
20733 | /******/ } else {
|
20734 | /******/ currentParents = [moduleId];
|
20735 | /******/ currentChildModule = request;
|
20736 | /******/ }
|
20737 | /******/ if (me.children.indexOf(request) === -1) {
|
20738 | /******/ me.children.push(request);
|
20739 | /******/ }
|
20740 | /******/ } else {
|
20741 | /******/ console.warn(
|
20742 | /******/ "[HMR] unexpected require(" +
|
20743 | /******/ request +
|
20744 | /******/ ") from disposed module " +
|
20745 | /******/ moduleId
|
20746 | /******/ );
|
20747 | /******/ currentParents = [];
|
20748 | /******/ }
|
20749 | /******/ return require(request);
|
20750 | /******/ };
|
20751 | /******/ var createPropertyDescriptor = function (name) {
|
20752 | /******/ return {
|
20753 | /******/ configurable: true,
|
20754 | /******/ enumerable: true,
|
20755 | /******/ get: function () {
|
20756 | /******/ return require[name];
|
20757 | /******/ },
|
20758 | /******/ set: function (value) {
|
20759 | /******/ require[name] = value;
|
20760 | /******/ }
|
20761 | /******/ };
|
20762 | /******/ };
|
20763 | /******/ for (var name in require) {
|
20764 | /******/ if (Object.prototype.hasOwnProperty.call(require, name) && name !== "e") {
|
20765 | /******/ Object.defineProperty(fn, name, createPropertyDescriptor(name));
|
20766 | /******/ }
|
20767 | /******/ }
|
20768 | /******/ fn.e = function (chunkId, fetchPriority) {
|
20769 | /******/ return trackBlockingPromise(require.e(chunkId, fetchPriority));
|
20770 | /******/ };
|
20771 | /******/ return fn;
|
20772 | /******/ }
|
20773 | /******/
|
20774 | /******/ function createModuleHotObject(moduleId, me) {
|
20775 | /******/ var _main = currentChildModule !== moduleId;
|
20776 | /******/ var hot = {
|
20777 | /******/ // private stuff
|
20778 | /******/ _acceptedDependencies: {},
|
20779 | /******/ _acceptedErrorHandlers: {},
|
20780 | /******/ _declinedDependencies: {},
|
20781 | /******/ _selfAccepted: false,
|
20782 | /******/ _selfDeclined: false,
|
20783 | /******/ _selfInvalidated: false,
|
20784 | /******/ _disposeHandlers: [],
|
20785 | /******/ _main: _main,
|
20786 | /******/ _requireSelf: function () {
|
20787 | /******/ currentParents = me.parents.slice();
|
20788 | /******/ currentChildModule = _main ? undefined : moduleId;
|
20789 | /******/ __webpack_require__(moduleId);
|
20790 | /******/ },
|
20791 | /******/
|
20792 | /******/ // Module API
|
20793 | /******/ active: true,
|
20794 | /******/ accept: function (dep, callback, errorHandler) {
|
20795 | /******/ if (dep === undefined) hot._selfAccepted = true;
|
20796 | /******/ else if (typeof dep === "function") hot._selfAccepted = dep;
|
20797 | /******/ else if (typeof dep === "object" && dep !== null) {
|
20798 | /******/ for (var i = 0; i < dep.length; i++) {
|
20799 | /******/ hot._acceptedDependencies[dep[i]] = callback || function () {};
|
20800 | /******/ hot._acceptedErrorHandlers[dep[i]] = errorHandler;
|
20801 | /******/ }
|
20802 | /******/ } else {
|
20803 | /******/ hot._acceptedDependencies[dep] = callback || function () {};
|
20804 | /******/ hot._acceptedErrorHandlers[dep] = errorHandler;
|
20805 | /******/ }
|
20806 | /******/ },
|
20807 | /******/ decline: function (dep) {
|
20808 | /******/ if (dep === undefined) hot._selfDeclined = true;
|
20809 | /******/ else if (typeof dep === "object" && dep !== null)
|
20810 | /******/ for (var i = 0; i < dep.length; i++)
|
20811 | /******/ hot._declinedDependencies[dep[i]] = true;
|
20812 | /******/ else hot._declinedDependencies[dep] = true;
|
20813 | /******/ },
|
20814 | /******/ dispose: function (callback) {
|
20815 | /******/ hot._disposeHandlers.push(callback);
|
20816 | /******/ },
|
20817 | /******/ addDisposeHandler: function (callback) {
|
20818 | /******/ hot._disposeHandlers.push(callback);
|
20819 | /******/ },
|
20820 | /******/ removeDisposeHandler: function (callback) {
|
20821 | /******/ var idx = hot._disposeHandlers.indexOf(callback);
|
20822 | /******/ if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
20823 | /******/ },
|
20824 | /******/ invalidate: function () {
|
20825 | /******/ this._selfInvalidated = true;
|
20826 | /******/ switch (currentStatus) {
|
20827 | /******/ case "idle":
|
20828 | /******/ currentUpdateApplyHandlers = [];
|
20829 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) {
|
20830 | /******/ __webpack_require__.hmrI[key](
|
20831 | /******/ moduleId,
|
20832 | /******/ currentUpdateApplyHandlers
|
20833 | /******/ );
|
20834 | /******/ });
|
20835 | /******/ setStatus("ready");
|
20836 | /******/ break;
|
20837 | /******/ case "ready":
|
20838 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) {
|
20839 | /******/ __webpack_require__.hmrI[key](
|
20840 | /******/ moduleId,
|
20841 | /******/ currentUpdateApplyHandlers
|
20842 | /******/ );
|
20843 | /******/ });
|
20844 | /******/ break;
|
20845 | /******/ case "prepare":
|
20846 | /******/ case "check":
|
20847 | /******/ case "dispose":
|
20848 | /******/ case "apply":
|
20849 | /******/ (queuedInvalidatedModules = queuedInvalidatedModules || []).push(
|
20850 | /******/ moduleId
|
20851 | /******/ );
|
20852 | /******/ break;
|
20853 | /******/ default:
|
20854 | /******/ // ignore requests in error states
|
20855 | /******/ break;
|
20856 | /******/ }
|
20857 | /******/ },
|
20858 | /******/
|
20859 | /******/ // Management API
|
20860 | /******/ check: hotCheck,
|
20861 | /******/ apply: hotApply,
|
20862 | /******/ status: function (l) {
|
20863 | /******/ if (!l) return currentStatus;
|
20864 | /******/ registeredStatusHandlers.push(l);
|
20865 | /******/ },
|
20866 | /******/ addStatusHandler: function (l) {
|
20867 | /******/ registeredStatusHandlers.push(l);
|
20868 | /******/ },
|
20869 | /******/ removeStatusHandler: function (l) {
|
20870 | /******/ var idx = registeredStatusHandlers.indexOf(l);
|
20871 | /******/ if (idx >= 0) registeredStatusHandlers.splice(idx, 1);
|
20872 | /******/ },
|
20873 | /******/
|
20874 | /******/ // inherit from previous dispose call
|
20875 | /******/ data: currentModuleData[moduleId]
|
20876 | /******/ };
|
20877 | /******/ currentChildModule = undefined;
|
20878 | /******/ return hot;
|
20879 | /******/ }
|
20880 | /******/
|
20881 | /******/ function setStatus(newStatus) {
|
20882 | /******/ currentStatus = newStatus;
|
20883 | /******/ var results = [];
|
20884 | /******/
|
20885 | /******/ for (var i = 0; i < registeredStatusHandlers.length; i++)
|
20886 | /******/ results[i] = registeredStatusHandlers[i].call(null, newStatus);
|
20887 | /******/
|
20888 | /******/ return Promise.all(results).then(function () {});
|
20889 | /******/ }
|
20890 | /******/
|
20891 | /******/ function unblock() {
|
20892 | /******/ if (--blockingPromises === 0) {
|
20893 | /******/ setStatus("ready").then(function () {
|
20894 | /******/ if (blockingPromises === 0) {
|
20895 | /******/ var list = blockingPromisesWaiting;
|
20896 | /******/ blockingPromisesWaiting = [];
|
20897 | /******/ for (var i = 0; i < list.length; i++) {
|
20898 | /******/ list[i]();
|
20899 | /******/ }
|
20900 | /******/ }
|
20901 | /******/ });
|
20902 | /******/ }
|
20903 | /******/ }
|
20904 | /******/
|
20905 | /******/ function trackBlockingPromise(promise) {
|
20906 | /******/ switch (currentStatus) {
|
20907 | /******/ case "ready":
|
20908 | /******/ setStatus("prepare");
|
20909 | /******/ /* fallthrough */
|
20910 | /******/ case "prepare":
|
20911 | /******/ blockingPromises++;
|
20912 | /******/ promise.then(unblock, unblock);
|
20913 | /******/ return promise;
|
20914 | /******/ default:
|
20915 | /******/ return promise;
|
20916 | /******/ }
|
20917 | /******/ }
|
20918 | /******/
|
20919 | /******/ function waitForBlockingPromises(fn) {
|
20920 | /******/ if (blockingPromises === 0) return fn();
|
20921 | /******/ return new Promise(function (resolve) {
|
20922 | /******/ blockingPromisesWaiting.push(function () {
|
20923 | /******/ resolve(fn());
|
20924 | /******/ });
|
20925 | /******/ });
|
20926 | /******/ }
|
20927 | /******/
|
20928 | /******/ function hotCheck(applyOnUpdate) {
|
20929 | /******/ if (currentStatus !== "idle") {
|
20930 | /******/ throw new Error("check() is only allowed in idle status");
|
20931 | /******/ }
|
20932 | /******/ return setStatus("check")
|
20933 | /******/ .then(__webpack_require__.hmrM)
|
20934 | /******/ .then(function (update) {
|
20935 | /******/ if (!update) {
|
20936 | /******/ return setStatus(applyInvalidatedModules() ? "ready" : "idle").then(
|
20937 | /******/ function () {
|
20938 | /******/ return null;
|
20939 | /******/ }
|
20940 | /******/ );
|
20941 | /******/ }
|
20942 | /******/
|
20943 | /******/ return setStatus("prepare").then(function () {
|
20944 | /******/ var updatedModules = [];
|
20945 | /******/ currentUpdateApplyHandlers = [];
|
20946 | /******/
|
20947 | /******/ return Promise.all(
|
20948 | /******/ Object.keys(__webpack_require__.hmrC).reduce(function (
|
20949 | /******/ promises,
|
20950 | /******/ key
|
20951 | /******/ ) {
|
20952 | /******/ __webpack_require__.hmrC[key](
|
20953 | /******/ update.c,
|
20954 | /******/ update.r,
|
20955 | /******/ update.m,
|
20956 | /******/ promises,
|
20957 | /******/ currentUpdateApplyHandlers,
|
20958 | /******/ updatedModules
|
20959 | /******/ );
|
20960 | /******/ return promises;
|
20961 | /******/ }, [])
|
20962 | /******/ ).then(function () {
|
20963 | /******/ return waitForBlockingPromises(function () {
|
20964 | /******/ if (applyOnUpdate) {
|
20965 | /******/ return internalApply(applyOnUpdate);
|
20966 | /******/ }
|
20967 | /******/ return setStatus("ready").then(function () {
|
20968 | /******/ return updatedModules;
|
20969 | /******/ });
|
20970 | /******/ });
|
20971 | /******/ });
|
20972 | /******/ });
|
20973 | /******/ });
|
20974 | /******/ }
|
20975 | /******/
|
20976 | /******/ function hotApply(options) {
|
20977 | /******/ if (currentStatus !== "ready") {
|
20978 | /******/ return Promise.resolve().then(function () {
|
20979 | /******/ throw new Error(
|
20980 | /******/ "apply() is only allowed in ready status (state: " +
|
20981 | /******/ currentStatus +
|
20982 | /******/ ")"
|
20983 | /******/ );
|
20984 | /******/ });
|
20985 | /******/ }
|
20986 | /******/ return internalApply(options);
|
20987 | /******/ }
|
20988 | /******/
|
20989 | /******/ function internalApply(options) {
|
20990 | /******/ options = options || {};
|
20991 | /******/
|
20992 | /******/ applyInvalidatedModules();
|
20993 | /******/
|
20994 | /******/ var results = currentUpdateApplyHandlers.map(function (handler) {
|
20995 | /******/ return handler(options);
|
20996 | /******/ });
|
20997 | /******/ currentUpdateApplyHandlers = undefined;
|
20998 | /******/
|
20999 | /******/ var errors = results
|
21000 | /******/ .map(function (r) {
|
21001 | /******/ return r.error;
|
21002 | /******/ })
|
21003 | /******/ .filter(Boolean);
|
21004 | /******/
|
21005 | /******/ if (errors.length > 0) {
|
21006 | /******/ return setStatus("abort").then(function () {
|
21007 | /******/ throw errors[0];
|
21008 | /******/ });
|
21009 | /******/ }
|
21010 | /******/
|
21011 | /******/ // Now in "dispose" phase
|
21012 | /******/ var disposePromise = setStatus("dispose");
|
21013 | /******/
|
21014 | /******/ results.forEach(function (result) {
|
21015 | /******/ if (result.dispose) result.dispose();
|
21016 | /******/ });
|
21017 | /******/
|
21018 | /******/ // Now in "apply" phase
|
21019 | /******/ var applyPromise = setStatus("apply");
|
21020 | /******/
|
21021 | /******/ var error;
|
21022 | /******/ var reportError = function (err) {
|
21023 | /******/ if (!error) error = err;
|
21024 | /******/ };
|
21025 | /******/
|
21026 | /******/ var outdatedModules = [];
|
21027 | /******/ results.forEach(function (result) {
|
21028 | /******/ if (result.apply) {
|
21029 | /******/ var modules = result.apply(reportError);
|
21030 | /******/ if (modules) {
|
21031 | /******/ for (var i = 0; i < modules.length; i++) {
|
21032 | /******/ outdatedModules.push(modules[i]);
|
21033 | /******/ }
|
21034 | /******/ }
|
21035 | /******/ }
|
21036 | /******/ });
|
21037 | /******/
|
21038 | /******/ return Promise.all([disposePromise, applyPromise]).then(function () {
|
21039 | /******/ // handle errors in accept handlers and self accepted module load
|
21040 | /******/ if (error) {
|
21041 | /******/ return setStatus("fail").then(function () {
|
21042 | /******/ throw error;
|
21043 | /******/ });
|
21044 | /******/ }
|
21045 | /******/
|
21046 | /******/ if (queuedInvalidatedModules) {
|
21047 | /******/ return internalApply(options).then(function (list) {
|
21048 | /******/ outdatedModules.forEach(function (moduleId) {
|
21049 | /******/ if (list.indexOf(moduleId) < 0) list.push(moduleId);
|
21050 | /******/ });
|
21051 | /******/ return list;
|
21052 | /******/ });
|
21053 | /******/ }
|
21054 | /******/
|
21055 | /******/ return setStatus("idle").then(function () {
|
21056 | /******/ return outdatedModules;
|
21057 | /******/ });
|
21058 | /******/ });
|
21059 | /******/ }
|
21060 | /******/
|
21061 | /******/ function applyInvalidatedModules() {
|
21062 | /******/ if (queuedInvalidatedModules) {
|
21063 | /******/ if (!currentUpdateApplyHandlers) currentUpdateApplyHandlers = [];
|
21064 | /******/ Object.keys(__webpack_require__.hmrI).forEach(function (key) {
|
21065 | /******/ queuedInvalidatedModules.forEach(function (moduleId) {
|
21066 | /******/ __webpack_require__.hmrI[key](
|
21067 | /******/ moduleId,
|
21068 | /******/ currentUpdateApplyHandlers
|
21069 | /******/ );
|
21070 | /******/ });
|
21071 | /******/ });
|
21072 | /******/ queuedInvalidatedModules = undefined;
|
21073 | /******/ return true;
|
21074 | /******/ }
|
21075 | /******/ }
|
21076 | /******/ })();
|
21077 | /******/
|
21078 | /******/ /* webpack/runtime/publicPath */
|
21079 | /******/ (() => {
|
21080 | /******/ __webpack_require__.p = "";
|
21081 | /******/ })();
|
21082 | /******/
|
21083 | /******/ /* webpack/runtime/jsonp chunk loading */
|
21084 | /******/ (() => {
|
21085 | /******/ // no baseURI
|
21086 | /******/
|
21087 | /******/ // object to store loaded and loading chunks
|
21088 | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
21089 | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
21090 | /******/ var installedChunks = __webpack_require__.hmrS_jsonp = __webpack_require__.hmrS_jsonp || {
|
21091 | /******/ 792: 0
|
21092 | /******/ };
|
21093 | /******/
|
21094 | /******/ // no chunk on demand loading
|
21095 | /******/
|
21096 | /******/ // no prefetching
|
21097 | /******/
|
21098 | /******/ // no preloaded
|
21099 | /******/
|
21100 | /******/ var currentUpdatedModulesList;
|
21101 | /******/ var waitingUpdateResolves = {};
|
21102 | /******/ function loadUpdateChunk(chunkId, updatedModulesList) {
|
21103 | /******/ currentUpdatedModulesList = updatedModulesList;
|
21104 | /******/ return new Promise((resolve, reject) => {
|
21105 | /******/ waitingUpdateResolves[chunkId] = resolve;
|
21106 | /******/ // start update chunk loading
|
21107 | /******/ var url = __webpack_require__.p + __webpack_require__.hu(chunkId);
|
21108 | /******/ // create error before stack unwound to get useful stacktrace later
|
21109 | /******/ var error = new Error();
|
21110 | /******/ var loadingEnded = (event) => {
|
21111 | /******/ if(waitingUpdateResolves[chunkId]) {
|
21112 | /******/ waitingUpdateResolves[chunkId] = undefined
|
21113 | /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
21114 | /******/ var realSrc = event && event.target && event.target.src;
|
21115 | /******/ error.message = 'Loading hot update chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
21116 | /******/ error.name = 'ChunkLoadError';
|
21117 | /******/ error.type = errorType;
|
21118 | /******/ error.request = realSrc;
|
21119 | /******/ reject(error);
|
21120 | /******/ }
|
21121 | /******/ };
|
21122 | /******/ __webpack_require__.l(url, loadingEnded);
|
21123 | /******/ });
|
21124 | /******/ }
|
21125 | /******/
|
21126 | /******/ self["webpackHotUpdaterapidoc"] = (chunkId, moreModules, runtime) => {
|
21127 | /******/ for(var moduleId in moreModules) {
|
21128 | /******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
21129 | /******/ currentUpdate[moduleId] = moreModules[moduleId];
|
21130 | /******/ if(currentUpdatedModulesList) currentUpdatedModulesList.push(moduleId);
|
21131 | /******/ }
|
21132 | /******/ }
|
21133 | /******/ if(runtime) currentUpdateRuntime.push(runtime);
|
21134 | /******/ if(waitingUpdateResolves[chunkId]) {
|
21135 | /******/ waitingUpdateResolves[chunkId]();
|
21136 | /******/ waitingUpdateResolves[chunkId] = undefined;
|
21137 | /******/ }
|
21138 | /******/ };
|
21139 | /******/
|
21140 | /******/ var currentUpdateChunks;
|
21141 | /******/ var currentUpdate;
|
21142 | /******/ var currentUpdateRemovedChunks;
|
21143 | /******/ var currentUpdateRuntime;
|
21144 | /******/ function applyHandler(options) {
|
21145 | /******/ if (__webpack_require__.f) delete __webpack_require__.f.jsonpHmr;
|
21146 | /******/ currentUpdateChunks = undefined;
|
21147 | /******/ function getAffectedModuleEffects(updateModuleId) {
|
21148 | /******/ var outdatedModules = [updateModuleId];
|
21149 | /******/ var outdatedDependencies = {};
|
21150 | /******/
|
21151 | /******/ var queue = outdatedModules.map(function (id) {
|
21152 | /******/ return {
|
21153 | /******/ chain: [id],
|
21154 | /******/ id: id
|
21155 | /******/ };
|
21156 | /******/ });
|
21157 | /******/ while (queue.length > 0) {
|
21158 | /******/ var queueItem = queue.pop();
|
21159 | /******/ var moduleId = queueItem.id;
|
21160 | /******/ var chain = queueItem.chain;
|
21161 | /******/ var module = __webpack_require__.c[moduleId];
|
21162 | /******/ if (
|
21163 | /******/ !module ||
|
21164 | /******/ (module.hot._selfAccepted && !module.hot._selfInvalidated)
|
21165 | /******/ )
|
21166 | /******/ continue;
|
21167 | /******/ if (module.hot._selfDeclined) {
|
21168 | /******/ return {
|
21169 | /******/ type: "self-declined",
|
21170 | /******/ chain: chain,
|
21171 | /******/ moduleId: moduleId
|
21172 | /******/ };
|
21173 | /******/ }
|
21174 | /******/ if (module.hot._main) {
|
21175 | /******/ return {
|
21176 | /******/ type: "unaccepted",
|
21177 | /******/ chain: chain,
|
21178 | /******/ moduleId: moduleId
|
21179 | /******/ };
|
21180 | /******/ }
|
21181 | /******/ for (var i = 0; i < module.parents.length; i++) {
|
21182 | /******/ var parentId = module.parents[i];
|
21183 | /******/ var parent = __webpack_require__.c[parentId];
|
21184 | /******/ if (!parent) continue;
|
21185 | /******/ if (parent.hot._declinedDependencies[moduleId]) {
|
21186 | /******/ return {
|
21187 | /******/ type: "declined",
|
21188 | /******/ chain: chain.concat([parentId]),
|
21189 | /******/ moduleId: moduleId,
|
21190 | /******/ parentId: parentId
|
21191 | /******/ };
|
21192 | /******/ }
|
21193 | /******/ if (outdatedModules.indexOf(parentId) !== -1) continue;
|
21194 | /******/ if (parent.hot._acceptedDependencies[moduleId]) {
|
21195 | /******/ if (!outdatedDependencies[parentId])
|
21196 | /******/ outdatedDependencies[parentId] = [];
|
21197 | /******/ addAllToSet(outdatedDependencies[parentId], [moduleId]);
|
21198 | /******/ continue;
|
21199 | /******/ }
|
21200 | /******/ delete outdatedDependencies[parentId];
|
21201 | /******/ outdatedModules.push(parentId);
|
21202 | /******/ queue.push({
|
21203 | /******/ chain: chain.concat([parentId]),
|
21204 | /******/ id: parentId
|
21205 | /******/ });
|
21206 | /******/ }
|
21207 | /******/ }
|
21208 | /******/
|
21209 | /******/ return {
|
21210 | /******/ type: "accepted",
|
21211 | /******/ moduleId: updateModuleId,
|
21212 | /******/ outdatedModules: outdatedModules,
|
21213 | /******/ outdatedDependencies: outdatedDependencies
|
21214 | /******/ };
|
21215 | /******/ }
|
21216 | /******/
|
21217 | /******/ function addAllToSet(a, b) {
|
21218 | /******/ for (var i = 0; i < b.length; i++) {
|
21219 | /******/ var item = b[i];
|
21220 | /******/ if (a.indexOf(item) === -1) a.push(item);
|
21221 | /******/ }
|
21222 | /******/ }
|
21223 | /******/
|
21224 | /******/ // at begin all updates modules are outdated
|
21225 | /******/ // the "outdated" status can propagate to parents if they don't accept the children
|
21226 | /******/ var outdatedDependencies = {};
|
21227 | /******/ var outdatedModules = [];
|
21228 | /******/ var appliedUpdate = {};
|
21229 | /******/
|
21230 | /******/ var warnUnexpectedRequire = function warnUnexpectedRequire(module) {
|
21231 | /******/ console.warn(
|
21232 | /******/ "[HMR] unexpected require(" + module.id + ") to disposed module"
|
21233 | /******/ );
|
21234 | /******/ };
|
21235 | /******/
|
21236 | /******/ for (var moduleId in currentUpdate) {
|
21237 | /******/ if (__webpack_require__.o(currentUpdate, moduleId)) {
|
21238 | /******/ var newModuleFactory = currentUpdate[moduleId];
|
21239 | /******/ /** @type {TODO} */
|
21240 | /******/ var result = newModuleFactory
|
21241 | /******/ ? getAffectedModuleEffects(moduleId)
|
21242 | /******/ : {
|
21243 | /******/ type: "disposed",
|
21244 | /******/ moduleId: moduleId
|
21245 | /******/ };
|
21246 | /******/ /** @type {Error|false} */
|
21247 | /******/ var abortError = false;
|
21248 | /******/ var doApply = false;
|
21249 | /******/ var doDispose = false;
|
21250 | /******/ var chainInfo = "";
|
21251 | /******/ if (result.chain) {
|
21252 | /******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
|
21253 | /******/ }
|
21254 | /******/ switch (result.type) {
|
21255 | /******/ case "self-declined":
|
21256 | /******/ if (options.onDeclined) options.onDeclined(result);
|
21257 | /******/ if (!options.ignoreDeclined)
|
21258 | /******/ abortError = new Error(
|
21259 | /******/ "Aborted because of self decline: " +
|
21260 | /******/ result.moduleId +
|
21261 | /******/ chainInfo
|
21262 | /******/ );
|
21263 | /******/ break;
|
21264 | /******/ case "declined":
|
21265 | /******/ if (options.onDeclined) options.onDeclined(result);
|
21266 | /******/ if (!options.ignoreDeclined)
|
21267 | /******/ abortError = new Error(
|
21268 | /******/ "Aborted because of declined dependency: " +
|
21269 | /******/ result.moduleId +
|
21270 | /******/ " in " +
|
21271 | /******/ result.parentId +
|
21272 | /******/ chainInfo
|
21273 | /******/ );
|
21274 | /******/ break;
|
21275 | /******/ case "unaccepted":
|
21276 | /******/ if (options.onUnaccepted) options.onUnaccepted(result);
|
21277 | /******/ if (!options.ignoreUnaccepted)
|
21278 | /******/ abortError = new Error(
|
21279 | /******/ "Aborted because " + moduleId + " is not accepted" + chainInfo
|
21280 | /******/ );
|
21281 | /******/ break;
|
21282 | /******/ case "accepted":
|
21283 | /******/ if (options.onAccepted) options.onAccepted(result);
|
21284 | /******/ doApply = true;
|
21285 | /******/ break;
|
21286 | /******/ case "disposed":
|
21287 | /******/ if (options.onDisposed) options.onDisposed(result);
|
21288 | /******/ doDispose = true;
|
21289 | /******/ break;
|
21290 | /******/ default:
|
21291 | /******/ throw new Error("Unexception type " + result.type);
|
21292 | /******/ }
|
21293 | /******/ if (abortError) {
|
21294 | /******/ return {
|
21295 | /******/ error: abortError
|
21296 | /******/ };
|
21297 | /******/ }
|
21298 | /******/ if (doApply) {
|
21299 | /******/ appliedUpdate[moduleId] = newModuleFactory;
|
21300 | /******/ addAllToSet(outdatedModules, result.outdatedModules);
|
21301 | /******/ for (moduleId in result.outdatedDependencies) {
|
21302 | /******/ if (__webpack_require__.o(result.outdatedDependencies, moduleId)) {
|
21303 | /******/ if (!outdatedDependencies[moduleId])
|
21304 | /******/ outdatedDependencies[moduleId] = [];
|
21305 | /******/ addAllToSet(
|
21306 | /******/ outdatedDependencies[moduleId],
|
21307 | /******/ result.outdatedDependencies[moduleId]
|
21308 | /******/ );
|
21309 | /******/ }
|
21310 | /******/ }
|
21311 | /******/ }
|
21312 | /******/ if (doDispose) {
|
21313 | /******/ addAllToSet(outdatedModules, [result.moduleId]);
|
21314 | /******/ appliedUpdate[moduleId] = warnUnexpectedRequire;
|
21315 | /******/ }
|
21316 | /******/ }
|
21317 | /******/ }
|
21318 | /******/ currentUpdate = undefined;
|
21319 | /******/
|
21320 | /******/ // Store self accepted outdated modules to require them later by the module system
|
21321 | /******/ var outdatedSelfAcceptedModules = [];
|
21322 | /******/ for (var j = 0; j < outdatedModules.length; j++) {
|
21323 | /******/ var outdatedModuleId = outdatedModules[j];
|
21324 | /******/ var module = __webpack_require__.c[outdatedModuleId];
|
21325 | /******/ if (
|
21326 | /******/ module &&
|
21327 | /******/ (module.hot._selfAccepted || module.hot._main) &&
|
21328 | /******/ // removed self-accepted modules should not be required
|
21329 | /******/ appliedUpdate[outdatedModuleId] !== warnUnexpectedRequire &&
|
21330 | /******/ // when called invalidate self-accepting is not possible
|
21331 | /******/ !module.hot._selfInvalidated
|
21332 | /******/ ) {
|
21333 | /******/ outdatedSelfAcceptedModules.push({
|
21334 | /******/ module: outdatedModuleId,
|
21335 | /******/ require: module.hot._requireSelf,
|
21336 | /******/ errorHandler: module.hot._selfAccepted
|
21337 | /******/ });
|
21338 | /******/ }
|
21339 | /******/ }
|
21340 | /******/
|
21341 | /******/ var moduleOutdatedDependencies;
|
21342 | /******/
|
21343 | /******/ return {
|
21344 | /******/ dispose: function () {
|
21345 | /******/ currentUpdateRemovedChunks.forEach(function (chunkId) {
|
21346 | /******/ delete installedChunks[chunkId];
|
21347 | /******/ });
|
21348 | /******/ currentUpdateRemovedChunks = undefined;
|
21349 | /******/
|
21350 | /******/ var idx;
|
21351 | /******/ var queue = outdatedModules.slice();
|
21352 | /******/ while (queue.length > 0) {
|
21353 | /******/ var moduleId = queue.pop();
|
21354 | /******/ var module = __webpack_require__.c[moduleId];
|
21355 | /******/ if (!module) continue;
|
21356 | /******/
|
21357 | /******/ var data = {};
|
21358 | /******/
|
21359 | /******/ // Call dispose handlers
|
21360 | /******/ var disposeHandlers = module.hot._disposeHandlers;
|
21361 | /******/ for (j = 0; j < disposeHandlers.length; j++) {
|
21362 | /******/ disposeHandlers[j].call(null, data);
|
21363 | /******/ }
|
21364 | /******/ __webpack_require__.hmrD[moduleId] = data;
|
21365 | /******/
|
21366 | /******/ // disable module (this disables requires from this module)
|
21367 | /******/ module.hot.active = false;
|
21368 | /******/
|
21369 | /******/ // remove module from cache
|
21370 | /******/ delete __webpack_require__.c[moduleId];
|
21371 | /******/
|
21372 | /******/ // when disposing there is no need to call dispose handler
|
21373 | /******/ delete outdatedDependencies[moduleId];
|
21374 | /******/
|
21375 | /******/ // remove "parents" references from all children
|
21376 | /******/ for (j = 0; j < module.children.length; j++) {
|
21377 | /******/ var child = __webpack_require__.c[module.children[j]];
|
21378 | /******/ if (!child) continue;
|
21379 | /******/ idx = child.parents.indexOf(moduleId);
|
21380 | /******/ if (idx >= 0) {
|
21381 | /******/ child.parents.splice(idx, 1);
|
21382 | /******/ }
|
21383 | /******/ }
|
21384 | /******/ }
|
21385 | /******/
|
21386 | /******/ // remove outdated dependency from module children
|
21387 | /******/ var dependency;
|
21388 | /******/ for (var outdatedModuleId in outdatedDependencies) {
|
21389 | /******/ if (__webpack_require__.o(outdatedDependencies, outdatedModuleId)) {
|
21390 | /******/ module = __webpack_require__.c[outdatedModuleId];
|
21391 | /******/ if (module) {
|
21392 | /******/ moduleOutdatedDependencies =
|
21393 | /******/ outdatedDependencies[outdatedModuleId];
|
21394 | /******/ for (j = 0; j < moduleOutdatedDependencies.length; j++) {
|
21395 | /******/ dependency = moduleOutdatedDependencies[j];
|
21396 | /******/ idx = module.children.indexOf(dependency);
|
21397 | /******/ if (idx >= 0) module.children.splice(idx, 1);
|
21398 | /******/ }
|
21399 | /******/ }
|
21400 | /******/ }
|
21401 | /******/ }
|
21402 | /******/ },
|
21403 | /******/ apply: function (reportError) {
|
21404 | /******/ // insert new code
|
21405 | /******/ for (var updateModuleId in appliedUpdate) {
|
21406 | /******/ if (__webpack_require__.o(appliedUpdate, updateModuleId)) {
|
21407 | /******/ __webpack_require__.m[updateModuleId] = appliedUpdate[updateModuleId];
|
21408 | /******/ }
|
21409 | /******/ }
|
21410 | /******/
|
21411 | /******/ // run new runtime modules
|
21412 | /******/ for (var i = 0; i < currentUpdateRuntime.length; i++) {
|
21413 | /******/ currentUpdateRuntime[i](__webpack_require__);
|
21414 | /******/ }
|
21415 | /******/
|
21416 | /******/ // call accept handlers
|
21417 | /******/ for (var outdatedModuleId in outdatedDependencies) {
|
21418 | /******/ if (__webpack_require__.o(outdatedDependencies, outdatedModuleId)) {
|
21419 | /******/ var module = __webpack_require__.c[outdatedModuleId];
|
21420 | /******/ if (module) {
|
21421 | /******/ moduleOutdatedDependencies =
|
21422 | /******/ outdatedDependencies[outdatedModuleId];
|
21423 | /******/ var callbacks = [];
|
21424 | /******/ var errorHandlers = [];
|
21425 | /******/ var dependenciesForCallbacks = [];
|
21426 | /******/ for (var j = 0; j < moduleOutdatedDependencies.length; j++) {
|
21427 | /******/ var dependency = moduleOutdatedDependencies[j];
|
21428 | /******/ var acceptCallback =
|
21429 | /******/ module.hot._acceptedDependencies[dependency];
|
21430 | /******/ var errorHandler =
|
21431 | /******/ module.hot._acceptedErrorHandlers[dependency];
|
21432 | /******/ if (acceptCallback) {
|
21433 | /******/ if (callbacks.indexOf(acceptCallback) !== -1) continue;
|
21434 | /******/ callbacks.push(acceptCallback);
|
21435 | /******/ errorHandlers.push(errorHandler);
|
21436 | /******/ dependenciesForCallbacks.push(dependency);
|
21437 | /******/ }
|
21438 | /******/ }
|
21439 | /******/ for (var k = 0; k < callbacks.length; k++) {
|
21440 | /******/ try {
|
21441 | /******/ callbacks[k].call(null, moduleOutdatedDependencies);
|
21442 | /******/ } catch (err) {
|
21443 | /******/ if (typeof errorHandlers[k] === "function") {
|
21444 | /******/ try {
|
21445 | /******/ errorHandlers[k](err, {
|
21446 | /******/ moduleId: outdatedModuleId,
|
21447 | /******/ dependencyId: dependenciesForCallbacks[k]
|
21448 | /******/ });
|
21449 | /******/ } catch (err2) {
|
21450 | /******/ if (options.onErrored) {
|
21451 | /******/ options.onErrored({
|
21452 | /******/ type: "accept-error-handler-errored",
|
21453 | /******/ moduleId: outdatedModuleId,
|
21454 | /******/ dependencyId: dependenciesForCallbacks[k],
|
21455 | /******/ error: err2,
|
21456 | /******/ originalError: err
|
21457 | /******/ });
|
21458 | /******/ }
|
21459 | /******/ if (!options.ignoreErrored) {
|
21460 | /******/ reportError(err2);
|
21461 | /******/ reportError(err);
|
21462 | /******/ }
|
21463 | /******/ }
|
21464 | /******/ } else {
|
21465 | /******/ if (options.onErrored) {
|
21466 | /******/ options.onErrored({
|
21467 | /******/ type: "accept-errored",
|
21468 | /******/ moduleId: outdatedModuleId,
|
21469 | /******/ dependencyId: dependenciesForCallbacks[k],
|
21470 | /******/ error: err
|
21471 | /******/ });
|
21472 | /******/ }
|
21473 | /******/ if (!options.ignoreErrored) {
|
21474 | /******/ reportError(err);
|
21475 | /******/ }
|
21476 | /******/ }
|
21477 | /******/ }
|
21478 | /******/ }
|
21479 | /******/ }
|
21480 | /******/ }
|
21481 | /******/ }
|
21482 | /******/
|
21483 | /******/ // Load self accepted modules
|
21484 | /******/ for (var o = 0; o < outdatedSelfAcceptedModules.length; o++) {
|
21485 | /******/ var item = outdatedSelfAcceptedModules[o];
|
21486 | /******/ var moduleId = item.module;
|
21487 | /******/ try {
|
21488 | /******/ item.require(moduleId);
|
21489 | /******/ } catch (err) {
|
21490 | /******/ if (typeof item.errorHandler === "function") {
|
21491 | /******/ try {
|
21492 | /******/ item.errorHandler(err, {
|
21493 | /******/ moduleId: moduleId,
|
21494 | /******/ module: __webpack_require__.c[moduleId]
|
21495 | /******/ });
|
21496 | /******/ } catch (err1) {
|
21497 | /******/ if (options.onErrored) {
|
21498 | /******/ options.onErrored({
|
21499 | /******/ type: "self-accept-error-handler-errored",
|
21500 | /******/ moduleId: moduleId,
|
21501 | /******/ error: err1,
|
21502 | /******/ originalError: err
|
21503 | /******/ });
|
21504 | /******/ }
|
21505 | /******/ if (!options.ignoreErrored) {
|
21506 | /******/ reportError(err1);
|
21507 | /******/ reportError(err);
|
21508 | /******/ }
|
21509 | /******/ }
|
21510 | /******/ } else {
|
21511 | /******/ if (options.onErrored) {
|
21512 | /******/ options.onErrored({
|
21513 | /******/ type: "self-accept-errored",
|
21514 | /******/ moduleId: moduleId,
|
21515 | /******/ error: err
|
21516 | /******/ });
|
21517 | /******/ }
|
21518 | /******/ if (!options.ignoreErrored) {
|
21519 | /******/ reportError(err);
|
21520 | /******/ }
|
21521 | /******/ }
|
21522 | /******/ }
|
21523 | /******/ }
|
21524 | /******/
|
21525 | /******/ return outdatedModules;
|
21526 | /******/ }
|
21527 | /******/ };
|
21528 | /******/ }
|
21529 | /******/ __webpack_require__.hmrI.jsonp = function (moduleId, applyHandlers) {
|
21530 | /******/ if (!currentUpdate) {
|
21531 | /******/ currentUpdate = {};
|
21532 | /******/ currentUpdateRuntime = [];
|
21533 | /******/ currentUpdateRemovedChunks = [];
|
21534 | /******/ applyHandlers.push(applyHandler);
|
21535 | /******/ }
|
21536 | /******/ if (!__webpack_require__.o(currentUpdate, moduleId)) {
|
21537 | /******/ currentUpdate[moduleId] = __webpack_require__.m[moduleId];
|
21538 | /******/ }
|
21539 | /******/ };
|
21540 | /******/ __webpack_require__.hmrC.jsonp = function (
|
21541 | /******/ chunkIds,
|
21542 | /******/ removedChunks,
|
21543 | /******/ removedModules,
|
21544 | /******/ promises,
|
21545 | /******/ applyHandlers,
|
21546 | /******/ updatedModulesList
|
21547 | /******/ ) {
|
21548 | /******/ applyHandlers.push(applyHandler);
|
21549 | /******/ currentUpdateChunks = {};
|
21550 | /******/ currentUpdateRemovedChunks = removedChunks;
|
21551 | /******/ currentUpdate = removedModules.reduce(function (obj, key) {
|
21552 | /******/ obj[key] = false;
|
21553 | /******/ return obj;
|
21554 | /******/ }, {});
|
21555 | /******/ currentUpdateRuntime = [];
|
21556 | /******/ chunkIds.forEach(function (chunkId) {
|
21557 | /******/ if (
|
21558 | /******/ __webpack_require__.o(installedChunks, chunkId) &&
|
21559 | /******/ installedChunks[chunkId] !== undefined
|
21560 | /******/ ) {
|
21561 | /******/ promises.push(loadUpdateChunk(chunkId, updatedModulesList));
|
21562 | /******/ currentUpdateChunks[chunkId] = true;
|
21563 | /******/ } else {
|
21564 | /******/ currentUpdateChunks[chunkId] = false;
|
21565 | /******/ }
|
21566 | /******/ });
|
21567 | /******/ if (__webpack_require__.f) {
|
21568 | /******/ __webpack_require__.f.jsonpHmr = function (chunkId, promises) {
|
21569 | /******/ if (
|
21570 | /******/ currentUpdateChunks &&
|
21571 | /******/ __webpack_require__.o(currentUpdateChunks, chunkId) &&
|
21572 | /******/ !currentUpdateChunks[chunkId]
|
21573 | /******/ ) {
|
21574 | /******/ promises.push(loadUpdateChunk(chunkId));
|
21575 | /******/ currentUpdateChunks[chunkId] = true;
|
21576 | /******/ }
|
21577 | /******/ };
|
21578 | /******/ }
|
21579 | /******/ };
|
21580 | /******/
|
21581 | /******/ __webpack_require__.hmrM = () => {
|
21582 | /******/ if (typeof fetch === "undefined") throw new Error("No browser support: need fetch API");
|
21583 | /******/ return fetch(__webpack_require__.p + __webpack_require__.hmrF()).then((response) => {
|
21584 | /******/ if(response.status === 404) return; // no update available
|
21585 | /******/ if(!response.ok) throw new Error("Failed to fetch update manifest " + response.statusText);
|
21586 | /******/ return response.json();
|
21587 | /******/ });
|
21588 | /******/ };
|
21589 | /******/
|
21590 | /******/ // no on chunks loaded
|
21591 | /******/
|
21592 | /******/ // no jsonp function
|
21593 | /******/ })();
|
21594 | /******/
|
21595 | /************************************************************************/
|
21596 | /******/
|
21597 | /******/ // module cache are used so entry inlining is disabled
|
21598 | /******/ // startup
|
21599 | /******/ // Load entry module and return exports
|
21600 | /******/ var __webpack_exports__ = __webpack_require__(557);
|
21601 | /******/
|
21602 | /******/ })()
|
21603 | ; |
\ | No newline at end of file |