@apitools/openapi-parser
Version:
Resolve OpenAPI Refs and/or convert Swagger 2.0 to OpenAPI
7 lines • 452 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self)["openapi-parser"]=t()}(this,(function(){const e="application/json, application/yaml",t="https://swagger.io",r=Object.freeze({url:"/"}),{fetch:n,Response:s,Headers:i,Request:o,FormData:a,File:c,Blob:l}=globalThis;function u(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 p(e,t){return Array.isArray(e)&&e.some((e=>u(e,t)))}void 0===globalThis.fetch&&(globalThis.fetch=n),void 0===globalThis.Headers&&(globalThis.Headers=i),void 0===globalThis.Request&&(globalThis.Request=o),void 0===globalThis.Response&&(globalThis.Response=s),void 0===globalThis.FormData&&(globalThis.FormData=a),void 0===globalThis.File&&(globalThis.File=c),void 0===globalThis.Blob&&(globalThis.Blob=l);class h extends File{constructor(e,t="",r={}){super([e],t,r),this.data=e}valueOf(){return this.data}toString(){return this.valueOf()}}function f(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 d(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=>m(e,s))).join(",");if("label"===r)return`.${t.map((e=>m(e,s))).join(".")}`;if("matrix"===r)return t.map((e=>m(e,s))).reduce(((t,r)=>!t||n?`${t||""};${e}=${r}`:`${t},${r}`),"");if("form"===r){const r=n?`&${e}=`:",";return t.map((e=>m(e,s))).join(r)}if("spaceDelimited"===r){const r=n?`${e}=`:"";return t.map((e=>m(e,s))).join(` ${r}`)}if("pipeDelimited"===r){const r=n?`${e}=`:"";return t.map((e=>m(e,s))).join(`|${r}`)}}(e):"object"==typeof t?function({key:e,value:t,style:r,explode:n,escape:s}){const i=Object.keys(t);return"simple"===r?i.reduce(((e,r)=>{const i=m(t[r],s);return`${e?`${e},`:""}${r}${n?"=":","}${i}`}),""):"label"===r?i.reduce(((e,r)=>{const i=m(t[r],s);return`${e?`${e}.`:"."}${r}${n?"=":"."}${i}`}),""):"matrix"===r&&n?i.reduce(((e,r)=>`${e?`${e};`:";"}${r}=${m(t[r],s)}`),""):"matrix"===r?i.reduce(((r,n)=>{const i=m(t[n],s);return`${r?`${r},`:`;${e}=`}${n},${i}`}),""):"form"===r?i.reduce(((e,r)=>{const i=m(t[r],s);return`${e?`${e}${n?"&":","}`:""}${r}${n?"=":","}${i}`}),""):void 0}(e):function({key:e,value:t,style:r,escape:n}){return"simple"===r?m(t,n):"label"===r?`.${m(t,n)}`:"matrix"===r?`;${e}=${m(t,n)}`:"form"===r||"deepObject"===r?m(t,n):void 0}(e)}function m(e,t=!1){var r;return Array.isArray(e)||null!==e&&"object"==typeof e?e=JSON.stringify(e):"number"!=typeof e&&"boolean"!=typeof e||(e=String(e)),t&&"string"==typeof e&&e.length>0?f(e,t):null!==(r=e)&&void 0!==r?r:""}const y={form:",",spaceDelimited:"%20",pipeDelimited:"|"},g={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function v(e,t,r=!1){const{collectionFormat:n,allowEmptyValue:s,serializationOption:i,encoding:o}=t,a="object"!=typeof t||Array.isArray(t)?t:t.value,c=r?e=>e.toString():e=>encodeURIComponent(e),l=c(e);if(void 0===a&&s)return[[l,""]];if(u(a)||p(a))return[[l,a]];if(i)return b(e,a,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 b(e,a,r,{style:t,explode:n,allowReserved:s})}if("string"==typeof o.contentType){if(o.contentType.startsWith("application/json")){const e=c("string"==typeof a?a:JSON.stringify(a));return[[l,new h(e,"blob",{type:o.contentType})]]}const e=c(String(a));return[[l,new h(e,"blob",{type:o.contentType})]]}return"object"!=typeof a?[[l,c(a)]]:Array.isArray(a)&&a.every((e=>"object"!=typeof e))?[[l,a.map(c).join(",")]]:[[l,c(JSON.stringify(a))]]}return"object"!=typeof a?[[l,c(a)]]:Array.isArray(a)?"multi"===n?[[l,a.map(c)]]:[[l,a.map(c).join(g[n||"csv"])]]:[[l,""]]}function b(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"),a=e=>m(e,o),c=r?e=>e:e=>a(e);return"object"!=typeof t?[[c(e),a(t)]]:Array.isArray(t)?i?[[c(e),t.map(a)]]:[[c(e),t.map(a).join(y[s])]]:"deepObject"===s?Object.keys(t).map((r=>[c(`${e}[${r}]`),a(t[r])])):i?Object.keys(t).map((e=>[c(e),a(t[e])])):[[c(e),Object.keys(t).map((e=>[`${c(e)},${a(t[e])}`])).join(",")]]}function x(e){return((e,{encode:t=!0}={})=>{const r=(e,t,n)=>(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 v(r,e[r]))t[n]=s instanceof h?s.valueOf():s;return t}),{}),{encode:!1})}function E(e={}){const{url:t="",query:r,form:n}=e;if(n){const t=Object.keys(n).some((e=>{const{value:t}=n[e];return u(t)||p(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 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=x(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,x(r));e.url=n+o,delete e.query}return e}
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function w(e){return null==e}var j={isNothing:w,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e: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: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}};function O(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 S(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=O(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}S.prototype=Object.create(Error.prototype),S.prototype.constructor=S,S.prototype.toString=function(e){return this.name+": "+O(this,e)};var A=S;function P(e,t,r,n,s){var i="",o="",a=Math.floor(s/2)-1;return n-t>a&&(t=n-a+(i=" ... ").length),r-n>a&&(r=n+a-(o=" ...").length),{str:i+e.slice(t,r).replace(/\t/g,"→")+o,pos:n-t+i.length}}function $(e,t){return j.repeat(" ",t-e.length)+e}var k=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],T=["scalar","sequence","mapping"],C=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===k.indexOf(t))throw new A('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===T.indexOf(this.kind))throw new A('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function M(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 F(e){return this.extend(e)}F.prototype.extend=function(e){var t=[],r=[];if(e instanceof C)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 A("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 C))throw new A("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new A("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 A("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 C))throw new A("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var n=Object.create(F.prototype);return n.implicit=(this.implicit||[]).concat(t),n.explicit=(this.explicit||[]).concat(r),n.compiledImplicit=M(n,"implicit"),n.compiledExplicit=M(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 I=F,_=new C("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),R=new C("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),D=new C("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),q=new I({explicit:[_,R,D]}),N=new C("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"}),L=new C("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 B(e){return 48<=e&&e<=55}function U(e){return 48<=e&&e<=57}var V=new C("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(!B(e.charCodeAt(s)))return!1;i=!0}return i&&"_"!==t}}if("_"===t)return!1;for(;s<n;s++)if("_"!==(t=e[s])){if(!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&&!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"]}}),z=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),H=/^[-+]?[0-9]+e/,J=new C("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!z.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||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(j.isNegativeZero(e))return"-0.0";return r=e.toString(10),H.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),G=q.extend({implicit:[N,L,V,J]}),W=G,K=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),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]))?))?$"),X=new C("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==K.exec(e)||null!==Y.exec(e))},construct:function(e){var t,r,n,s,i,o,a,c,l=0,u=null;if(null===(t=K.exec(e))&&(t=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],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(r,n,s,i,o,a,l)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}}),Z=new C("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",ee=new C("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,s=e.length,i=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=Q,o=0,a=[];for(t=0;t<s;t++)t%4==0&&t&&(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)),o=o<<6|i.indexOf(n.charAt(t));return 0==(r=s%4*6)?(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)):18===r?(a.push(o>>10&255),a.push(o>>2&255)):12===r&&a.push(o>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,r,n="",s=0,i=e.length,o=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,ne=new C("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,s,i,o=[],a=e;for(t=0,r=a.length;t<r;t+=1){if(n=a[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,ie=new C("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,ae=new C("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:{}}}),ce=W.extend({implicit:[X,Z],explicit:[ee,ne,ie,ae]}),le=Object.prototype.hasOwnProperty,ue=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,pe=/[\x85\u2028\u2029]/,he=/[,\[\]\{\}]/,fe=/^(?:!|!!|![a-z\-]+!)$/i,de=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function me(e){return Object.prototype.toString.call(e)}function ye(e){return 10===e||13===e}function ge(e){return 9===e||32===e}function ve(e){return 9===e||32===e||10===e||13===e}function be(e){return 44===e||91===e||93===e||123===e||125===e}function xe(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function Ee(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 we(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var je=new Array(256),Oe=new Array(256),Se=0;Se<256;Se++)je[Se]=Ee(Se)?1:0,Oe[Se]=Ee(Se);function Ae(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||ce,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 Pe(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=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 a,c,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,p=t.maxLength-(t.indent+u+3);for(a=1;a<=t.linesBefore&&!(o-a<0);a++)c=P(e.buffer,s[o-a],i[o-a],e.position-(s[o]-s[o-a]),p),l=j.repeat(" ",t.indent)+$((e.line-a+1).toString(),u)+" | "+c.str+"\n"+l;for(c=P(e.buffer,s[o],i[o],e.position,p),l+=j.repeat(" ",t.indent)+$((e.line+1).toString(),u)+" | "+c.str+"\n",l+=j.repeat("-",t.indent+u+3+c.pos)+"^\n",a=1;a<=t.linesAfter&&!(o+a>=i.length);a++)c=P(e.buffer,s[o+a],i[o+a],e.position-(s[o]-s[o+a]),p),l+=j.repeat(" ",t.indent)+$((e.line+a+1).toString(),u)+" | "+c.str+"\n";return l.replace(/\n$/,"")}(r),new A(t,r)}function $e(e,t){throw Pe(e,t)}function ke(e,t){e.onWarning&&e.onWarning.call(null,Pe(e,t))}var Te={YAML:function(e,t,r){var n,s,i;null!==e.version&&$e(e,"duplication of %YAML directive"),1!==r.length&&$e(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&$e(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),i=parseInt(n[2],10),1!==s&&$e(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&ke(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,s;2!==r.length&&$e(e,"TAG directive accepts exactly two arguments"),n=r[0],s=r[1],fe.test(n)||$e(e,"ill-formed tag handle (first argument) of the TAG directive"),le.call(e.tagMap,n)&&$e(e,'there is a previously declared suffix for "'+n+'" tag handle'),de.test(s)||$e(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch(t){$e(e,"tag prefix is malformed: "+s)}e.tagMap[n]=s}};function Ce(e,t,r,n){var s,i,o,a;if(t<r){if(a=e.input.slice(t,r),n)for(s=0,i=a.length;s<i;s+=1)9===(o=a.charCodeAt(s))||32<=o&&o<=1114111||$e(e,"expected valid JSON character");else ue.test(a)&&$e(e,"the stream contains non-printable characters");e.result+=a}}function Me(e,t,r,n){var s,i,o,a;for(j.isObject(r)||$e(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,a=(s=Object.keys(r)).length;o<a;o+=1)i=s[o],le.call(t,i)||(t[i]=r[i],n[i]=!0)}function Fe(e,t,r,n,s,i,o,a,c){var l,u;if(Array.isArray(s))for(l=0,u=(s=Array.prototype.slice.call(s)).length;l<u;l+=1)Array.isArray(s[l])&&$e(e,"nested arrays are not supported inside keys"),"object"==typeof s&&"[object Object]"===me(s[l])&&(s[l]="[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(l=0,u=i.length;l<u;l+=1)Me(e,t,i[l],r);else Me(e,t,i,r);else e.json||le.call(r,s)||!le.call(t,s)||(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=c||e.position,$e(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 Ie(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):$e(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(;ge(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(!ye(s))break;for(Ie(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&&ke(e,"deficient indentation"),n}function Re(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))&&!ve(t)))}function De(e,t){1===t?e.result+=" ":t>1&&(e.result+=j.repeat("\n",t-1))}function qe(e,t){var r,n,s=e.tag,i=e.anchor,o=[],a=!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,$e(e,"tab characters must not be used in indentation")),45===n)&&ve(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,_e(e,!0,-1)&&e.lineIndent<=t)o.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,Be(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)$e(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=s,e.anchor=i,e.kind="sequence",e.result=o,!0)}function Ne(e){var t,r,n,s,i=!1,o=!1;if(33!==(s=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&$e(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)):$e(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==s&&!ve(s);)33===s&&(o?$e(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),fe.test(r)||$e(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),he.test(n)&&$e(e,"tag suffix cannot contain flow indicator characters")}n&&!de.test(n)&&$e(e,"tag name cannot contain such characters: "+n);try{n=decodeURIComponent(n)}catch(t){$e(e,"tag name is malformed: "+n)}return i?e.tag=n:le.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:$e(e,'undeclared tag handle "'+r+'"'),!0}function Le(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&$e(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!ve(r)&&!be(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&$e(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Be(e,t,r,n,s){var i,o,a,c,l,u,p,h,f,d=1,m=!1,y=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=o=a=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(;Ne(e)||Le(e);)_e(e,!0,-1)?(m=!0,a=i,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):a=!1;if(a&&(a=m||s),1!==d&&4!==r||(h=1===r||2===r?t:t+1,f=e.position-e.lineStart,1===d?a&&(qe(e,f)||function(e,t,r){var n,s,i,o,a,c,l,u=e.tag,p=e.anchor,h={},f=Object.create(null),d=null,m=null,y=null,g=!1,v=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=h),l=e.input.charCodeAt(e.position);0!==l;){if(g||-1===e.firstTabInLine||(e.position=e.firstTabInLine,$e(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),i=e.line,63!==l&&58!==l||!ve(n)){if(o=e.line,a=e.lineStart,c=e.position,!Be(e,r,2,!1,!0))break;if(e.line===i){for(l=e.input.charCodeAt(e.position);ge(l);)l=e.input.charCodeAt(++e.position);if(58===l)ve(l=e.input.charCodeAt(++e.position))||$e(e,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(Fe(e,h,f,d,m,null,o,a,c),d=m=y=null),v=!0,g=!1,s=!1,d=e.tag,m=e.result;else{if(!v)return e.tag=u,e.anchor=p,!0;$e(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!v)return e.tag=u,e.anchor=p,!0;$e(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(g&&(Fe(e,h,f,d,m,null,o,a,c),d=m=y=null),v=!0,g=!0,s=!0):g?(g=!1,s=!0):$e(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=n;if((e.line===i||e.lineIndent>t)&&(g&&(o=e.line,a=e.lineStart,c=e.position),Be(e,t,4,!0,s)&&(g?m=e.result:y=e.result),g||(Fe(e,h,f,d,m,y,o,a,c),d=m=y=null),_e(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)$e(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return g&&Fe(e,h,f,d,m,null,o,a,c),v&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=h),v}(e,f,h))||function(e,t){var r,n,s,i,o,a,c,l,u,p,h,f,d=!0,m=e.tag,y=e.anchor,g=Object.create(null);if(91===(f=e.input.charCodeAt(e.position)))o=93,l=!1,i=[];else{if(123!==f)return!1;o=125,l=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),f=e.input.charCodeAt(++e.position);0!==f;){if(_e(e,!0,t),(f=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=m,e.anchor=y,e.kind=l?"mapping":"sequence",e.result=i,!0;d?44===f&&$e(e,"expected the node content, but found ','"):$e(e,"missed comma between flow collection entries"),h=null,a=c=!1,63===f&&ve(e.input.charCodeAt(e.position+1))&&(a=c=!0,e.position++,_e(e,!0,t)),r=e.line,n=e.lineStart,s=e.position,Be(e,t,1,!1,!0),p=e.tag,u=e.result,_e(e,!0,t),f=e.input.charCodeAt(e.position),!c&&e.line!==r||58!==f||(a=!0,f=e.input.charCodeAt(++e.position),_e(e,!0,t),Be(e,t,1,!1,!0),h=e.result),l?Fe(e,i,g,p,u,h,r,n,s):a?i.push(Fe(e,null,g,p,u,h,r,n,s)):i.push(u),_e(e,!0,t),44===(f=e.input.charCodeAt(e.position))?(d=!0,f=e.input.charCodeAt(++e.position)):d=!1}$e(e,"unexpected end of the stream within a flow collection")}(e,h)?y=!0:(o&&function(e,t){var r,n,s,i,o,a=1,c=!1,l=!1,u=t,p=0,h=!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===a?a=43===i?3:2:$e(e,"repeat of a chomping mode identifier");else{if(!((s=48<=(o=i)&&o<=57?o-48:-1)>=0))break;0===s?$e(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?$e(e,"repeat of an indentation width identifier"):(u=t+s-1,l=!0)}if(ge(i)){do{i=e.input.charCodeAt(++e.position)}while(ge(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!ye(i)&&0!==i)}for(;0!==i;){for(Ie(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!l||e.lineIndent<u)&&32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position);if(!l&&e.lineIndent>u&&(u=e.lineIndent),ye(i))p++;else{if(e.lineIndent<u){3===a?e.result+=j.repeat("\n",c?1+p:p):1===a&&c&&(e.result+="\n");break}for(n?ge(i)?(h=!0,e.result+=j.repeat("\n",c?1+p:p)):h?(h=!1,e.result+=j.repeat("\n",p+1)):0===p?c&&(e.result+=" "):e.result+=j.repeat("\n",p):e.result+=j.repeat("\n",c?1+p:p),c=!0,l=!0,p=0,r=e.position;!ye(i)&&0!==i;)i=e.input.charCodeAt(++e.position);Ce(e,r,e.position,!1)}}return!0}(e,h)||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(Ce(e,n,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;n=e.position,e.position++,s=e.position}else ye(r)?(Ce(e,n,s,!0),De(e,_e(e,!1,t)),n=s=e.position):e.position===e.lineStart&&Re(e)?$e(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);$e(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var r,n,s,i,o,a,c;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return Ce(e,r,e.position,!0),e.position++,!0;if(92===a){if(Ce(e,r,e.position,!0),ye(a=e.input.charCodeAt(++e.position)))_e(e,!1,t);else if(a<256&&je[a])e.result+=Oe[a],e.position++;else if((o=120===(c=a)?2:117===c?4:85===c?8:0)>0){for(s=o,i=0;s>0;s--)(o=xe(a=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+o:$e(e,"expected hexadecimal character");e.result+=we(i),e.position++}else $e(e,"unknown escape sequence");r=n=e.position}else ye(a)?(Ce(e,r,n,!0),De(e,_e(e,!1,t)),r=n=e.position):e.position===e.lineStart&&Re(e)?$e(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}$e(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?y=!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&&!ve(n)&&!be(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&$e(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),le.call(e.anchorMap,r)||$e(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],_e(e,!0,-1),!0}(e)?(y=!0,null===e.tag&&null===e.anchor||$e(e,"alias node should not have any properties")):function(e,t,r){var n,s,i,o,a,c,l,u,p=e.kind,h=e.result;if(ve(u=e.input.charCodeAt(e.position))||be(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(ve(n=e.input.charCodeAt(e.position+1))||r&&be(n)))return!1;for(e.kind="scalar",e.result="",s=i=e.position,o=!1;0!==u;){if(58===u){if(ve(n=e.input.charCodeAt(e.position+1))||r&&be(n))break}else if(35===u){if(ve(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Re(e)||r&&be(u))break;if(ye(u)){if(a=e.line,c=e.lineStart,l=e.lineIndent,_e(e,!1,-1),e.lineIndent>=t){o=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=a,e.lineStart=c,e.lineIndent=l;break}}o&&(Ce(e,s,i,!1),De(e,e.line-a),s=i=e.position,o=!1),ge(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return Ce(e,s,i,!1),!!e.result||(e.kind=p,e.result=h,!1)}(e,h,1===r)&&(y=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(y=a&&qe(e,f))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&$e(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c<l;c+=1)if((p=e.implicitTypes[c]).resolve(e.result)){e.result=p.construct(e.result),e.tag=p.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(le.call(e.typeMap[e.kind||"fallback"],e.tag))p=e.typeMap[e.kind||"fallback"][e.tag];else for(p=null,c=0,l=(u=e.typeMap.multi[e.kind||"fallback"]).length;c<l;c+=1)if(e.tag.slice(0,u[c].tag.length)===u[c].tag){p=u[c];break}p||$e(e,"unknown tag !<"+e.tag+">"),null!==e.result&&p.kind!==e.kind&&$e(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+p.kind+'", not "'+e.kind+'"'),p.resolve(e.result,e.tag)?(e.result=p.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):$e(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}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&&!ve(s);)s=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&$e(e,"directive name must not be less than one character in length");0!==s;){for(;ge(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!ye(s));break}if(ye(s))break;for(t=e.position;0!==s&&!ve(s);)s=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==s&&Ie(e),le.call(Te,r)?Te[r](e,r,n):ke(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&&$e(e,"directives end mark is expected"),Be(e,e.lineIndent-1,4,!1,!0),_e(e,!0,-1),e.checkLineBreaks&&pe.test(e.input.slice(i,e.position))&&ke(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Re(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,_e(e,!0,-1)):e.position<e.length-1&&$e(e,"end of the stream or a document separator is expected")}function Ve(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 Ae(e,t),n=e.indexOf("\0");for(-1!==n&&(r.position=n,$e(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 ze=function(e,t,r){null!==t&&"object"==typeof t&&void 0===r&&(r=t,t=null);var n=Ve(e,r);if("function"!=typeof t)return n;for(var s=0,i=n.length;s<i;s+=1)t(n[s])},He=function(e,t){var r=Ve(e,t);if(0!==r.length){if(1===r.length)return r[0];throw new A("expected a single document in the stream, but found more")}},Je=Object.prototype.toString,Ge=Object.prototype.hasOwnProperty,We=65279,Ke={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"},Ye=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Xe=/^[-+]?[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 A("code point within a string may not be greater than 0xFFFFFFFF");r="U",n=8}return"\\"+r+j.repeat("0",n-t.length)+t}function Qe(e){this.schema=e.schema||ce,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=j.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var r,n,s,i,o,a,c;if(null===t)return{};for(r={},s=0,i=(n=Object.keys(t)).length;s<i;s+=1)o=n[s],a=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(c=e.compiledTypeMap.fallback[o])&&Ge.call(c.styleAliases,a)&&(a=c.styleAliases[a]),r[o]=a;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 et(e,t){for(var r,n=j.repeat(" ",t),s=0,i=-1,o="",a=e.length;s<a;)-1===(i=e.indexOf("\n",s))?(r=e.slice(s),s=a):(r=e.slice(s,i+1),s=i+1),r.length&&"\n"!==r&&(o+=n),o+=r;return o}function tt(e,t){return"\n"+j.repeat(" ",e.indent*t)}function rt(e){return 32===e||9===e}function nt(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==We||65536<=e&&e<=1114111}function st(e){return nt(e)&&e!==We&&13!==e&&10!==e}function it(e,t,r){var n=st(e),s=n&&!rt(e);return(r?n:n&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!s)||st(t)&&!rt(t)&&35===e||58===t&&s}function ot(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 at(e){return/^\n* /.test(e)}function ct(e,t,r,n,s){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Ye.indexOf(t)||Xe.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),a=n||e.flowLevel>-1&&r>=e.flowLevel;switch(function(e,t,r,n,s,i,o,a){var c,l,u=0,p=null,h=!1,f=!1,d=-1!==n,m=-1,y=nt(l=ot(e,0))&&l!==We&&!rt(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&function(e){return!rt(e)&&58!==e}(ot(e,e.length-1));if(t||o)for(c=0;c<e.length;u>=65536?c+=2:c++){if(!nt(u=ot(e,c)))return 5;y=y&&it(u,p,a),p=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(10===(u=ot(e,c)))h=!0,d&&(f=f||c-m-1>n&&" "!==e[m+1],m=c);else if(!nt(u))return 5;y=y&&it(u,p,a),p=u}f=f||d&&c-m-1>n&&" "!==e[m+1]}return h||f?r>9&&at(e)?5:o?2===i?5:2:f?4:3:!y||o||s(e)?2===i?5:2:1}(t,a,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"|"+lt(t,e.indent)+ut(et(t,i));case 4:return">"+lt(t,e.indent)+ut(et(function(e,t){for(var r,n,s,i=/(\n+)([^\n]*)/g,o=(s=-1!==(s=e.indexOf("\n"))?s:e.length,i.lastIndex=s,pt(e.slice(0,s),t)),a="\n"===e[0]||" "===e[0];n=i.exec(e);){var c=n[1],l=n[2];r=" "===l[0],o+=c+(a||r||""===l?"":"\n")+pt(l,t),a=r}return o}(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=ot(e,s),!(t=Ke[n])&&nt(n)?(r+=e[s],n>=65536&&(r+=e[s+1])):r+=t||Ze(n);return r}(t)+'"';default:throw new A("impossible error: invalid scalar style")}}()}function lt(e,t){var r=at(e)?String(t):"",n="\n"===e[e.length-1];return r+(!n||"\n"!==e[e.length-2]&&"\n"!==e?n?"":"-":"+")+"\n"}function ut(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function pt(e,t){if(""===e||" "===e[0])return e;for(var r,n,s=/ [^ ]/g,i=0,o=0,a=0,c="";r=s.exec(e);)(a=r.index)-i>t&&(n=o>i?o:a,c+="\n"+e.slice(i,n),i=n+1),o=a;return c+="\n",e.length-i>t&&o>i?c+=e.slice(i,o)+"\n"+e.slice(o+1):c+=e.slice(i),c.slice(1)}function ht(e,t,r,n){var s,i,o,a="",c=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&&""===a||(a+=tt(e,t)),e.dump&&10===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=c,e.dump=a||"[]"}function ft(e,t,r){var n,s,i,o,a,c;for(i=0,o=(s=r?e.explicitTypes:e.implicitTypes).length;i<o;i+=1)if(((a=s[i]).instanceOf||a.predicate)&&(!a.instanceOf||"object"==typeof t&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(c=e.styleMap[a.tag]||a.defaultStyle,"[object Function]"===Je.call(a.represent))n=a.represent(t,c);else{if(!Ge.call(a.represent,c))throw new A("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');n=a.represent[c](t,c)}e.dump=n}return!0}return!1}function dt(e,t,r,n,s,i,o){e.tag=null,e.dump=r,ft(e,r,!1)||ft(e,r,!0);var a,c=Je.call(e.dump),l=n;n&&(n=e.flowLevel<0||e.flowLevel>t);var u,p,h="[object Object]"===c||"[object Array]"===c;if(h&&(p=-1!==(u=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||p||2!==e.indent&&t>0)&&(s=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(h&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===c)n&&0!==Object.keys(e.dump).length?(function(e,t,r,n){var s,i,o,a,c,l,u="",p=e.tag,h=Object.keys(r);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new A("sortKeys must be a boolean or a function");for(s=0,i=h.length;s<i;s+=1)l="",n&&""===u||(l+=tt(e,t)),a=r[o=h[s]],e.replacer&&(a=e.replacer.call(r,o,a)),dt(e,t+1,o,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&10===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=tt(e,t)),dt(e,t+1,a,!0,c)&&(e.dump&&10===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=p,e.dump=u||"{}"}(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,r){var n,s,i,o,a,c="",l=e.tag,u=Object.keys(r);for(n=0,s=u.length;n<s;n+=1)a="",""!==c&&(a+=", "),e.condenseFlow&&(a+='"'),o=r[i=u[n]],e.replacer&&(o=e.replacer.call(r,i,o)),dt(e,t,i,!1,!1)&&(e.dump.length>1024&&(a+="? "),a+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),dt(e,t,o,!1,!1)&&(c+=a+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===c)n&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?ht(e,t-1,e.dump,s):ht(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(function(e,t,r){var n,s,i,o="",a=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=a,e.dump="["+o+"]"}(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else{if("[object String]"!==c){if("[object Undefined]"===c)return!1;if(e.skipInvalid)return!1;throw new A("unacceptable kind of an object to dump "+c)}"?"!==e.tag&&ct(e,e.dump,t,i,l)}null!==e.tag&&"?"!==e.tag&&(a=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),a="!"===e.tag[0]?"!"+a:"tag:yaml.org,2002:"===a.slice(0,18)?"!!"+a.slice(18):"!<"+a+">",e.dump=a+" "+e.dump)}return!0}function mt(e,t){var r,n,s=[],i=[];for(yt(e,s,i),r=0,n=i.length;r<n;r+=1)t.duplicates.push(s[i[r]]);t.usedDuplicates=new Array(n)}function yt(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)yt(e[s],t,r);else for(s=0,i=(n=Object.keys(e)).length;s<i;s+=1)yt(e[n[s]],t,r)}function gt(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 vt=C,bt=I,xt=q,Et=G,wt=W,jt=ce,Ot=He,St=ze,At=function(e,t){var r=new Qe(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":""},Pt=A,$t={binary:ee,float:J,map:D,null:N,pairs:ie,set:ae,timestamp:X,bool:L,int:V,merge:Z,omap:ne,seq:R,str:_},kt=gt("safeLoad","load"),Tt=gt("safeLoadAll","loadAll"),Ct=gt("safeDump","dump"),Mt={Type:vt,Schema:bt,FAILSAFE_SCHEMA:xt,JSON_SCHEMA:Et,CORE_SCHEMA:wt,DEFAULT_SCHEMA:jt,load:Ot,loadAll:St,dump:At,YAMLException:Pt,types:$t,safeLoad:kt,safeLoadAll:Tt,safeDump:Ct};function Ft(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 It(e,t,{loadSpec:r=!1}={}){const n={ok:e.ok,url:e.url||t,status:e.status,statusText:e.statusText,headers:Ft(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):Mt.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=E(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 It(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 Rt(t,r={}){const{requestInterceptor:n,responseInterceptor:s}=r,i=t.withCredentials?"include":"same-origin";return r=>t({url:r,loadSpec:!0,requestInterceptor:n,responseInterceptor:s,headers:{Accept:e},credentials:i}).then((e=>e.body))}const Dt=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},qt=e=>{const{fetch:t,http:r}=e;return t||r||_t};
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*/var Nt,Lt=(Nt=function(e,t){return Nt=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])},Nt(e,t)},function(e,t){function r(){this.constructor=e}Nt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Bt=Object.prototype.hasOwnProperty;function Ut(e,t){return Bt.call(e,t)}function Vt(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 zt(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Ht(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 Jt(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Gt(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Wt(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Wt(e[t]))return!0}else if("object"==typeof e)for(var n=Vt(e),s=n.length,i=0;i<s;i++)if(Wt(e[n[i]]))return!0;return!1}function Kt(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,a=e.call(this,Kt(t,{name:r,index:n,operation:s,tree:i}))||this;return a.name=r,a.index=n,a.operation=s,a.tree=i,Object.setPrototypeOf(a,o.prototype),a.message=Kt(t,{name:r,index:n,operation:s,tree:i}),a}return Lt(t,e),t}(Error),Xt=Yt,Zt=zt,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=zt(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:zt(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 Ht(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