UNPKG

ponicode

Version:

Ponicode is a quick and easy AI-powered solution for Javascript unit testing.

3 lines 7.44 MB
#!/usr/bin/env node /*! For license information please see main.js.LICENSE.txt */ (()=>{var __webpack_modules__={69085:()=>{"use strict";void 0!==typeof Symbol&&Symbol.asyncIterator||(Symbol.asyncIterator=Symbol.for("Symbol.asyncIterator"))},88420:(e,t,r)=>{"use strict";function n(e){return e.toLowerCase()}function i(e){if(e&&"object"==typeof e){const t=e;if("function"==typeof t.rawHeaders&&"function"==typeof t.clone&&"function"==typeof t.get&&"function"==typeof t.set&&"function"==typeof t.contains&&"function"==typeof t.remove&&"function"==typeof t.headersArray&&"function"==typeof t.headerValues&&"function"==typeof t.headerNames&&"function"==typeof t.toJson)return!0}return!1}r.r(t),r.d(t,{AccessTokenRefresher:()=>En,ApiKeyCredentials:()=>Tn,BaseRequestPolicy:()=>$t,BasicAuthenticationCredentials:()=>Cn,Constants:()=>_r,DefaultHttpClient:()=>Bt,ExpiringAccessTokenCache:()=>wn,HttpHeaders:()=>a,HttpPipelineLogLevel:()=>Ut,MapperType:()=>R,QueryCollectionFormat:()=>Nr,RequestPolicyOptions:()=>zt,RestError:()=>ye,RetryMode:()=>yr,Serializer:()=>C,ServiceClient:()=>_n,TopicCredentials:()=>kn,URLBuilder:()=>X,URLQuery:()=>K,WebResource:()=>M,XML_ATTRKEY:()=>c,XML_CHARKEY:()=>u,applyMixins:()=>x,bearerTokenAuthenticationPolicy:()=>Fr,createPipelineFromOptions:()=>gn,createSpanFunction:()=>Sn,delay:()=>hr,deserializationPolicy:()=>Xt,deserializeResponseBody:()=>tr,disableResponseDecompressionPolicy:()=>jr,encodeUri:()=>f,executePromisesSequentially:()=>y,exponentialRetryPolicy:()=>gr,flattenResponse:()=>xn,generateClientRequestIdPolicy:()=>Mr,generateUuid:()=>g,getDefaultProxySettings:()=>qr,getDefaultUserAgentValue:()=>Ar,isDuration:()=>w,isNode:()=>d,isTokenCredential:()=>Cr,isValidUuid:()=>h,keepAlivePolicy:()=>nr,logPolicy:()=>Sr,operationOptionsToRequestOptionsBase:()=>Vt,parseXML:()=>Kt,promiseToCallback:()=>v,promiseToServiceCallback:()=>b,proxyPolicy:()=>Jr,redirectPolicy:()=>sr,serializeObject:()=>j,signingPolicy:()=>Xr,stringifyXML:()=>Ht,stripRequest:()=>_,stripResponse:()=>m,systemErrorRetryPolicy:()=>Zr,throttlingRetryPolicy:()=>rn,tracingPolicy:()=>fn,userAgentPolicy:()=>Pr});class a{constructor(e){if(this._headersMap={},e)for(const t in e)this.set(t,e[t])}set(e,t){this._headersMap[n(e)]={name:e,value:t.toString()}}get(e){const t=this._headersMap[n(e)];return t?t.value:void 0}contains(e){return!!this._headersMap[n(e)]}remove(e){const t=this.contains(e);return delete this._headersMap[n(e)],t}rawHeaders(){return this.toJson({preserveCase:!0})}headersArray(){const e=[];for(const t in this._headersMap)e.push(this._headersMap[t]);return e}headerNames(){const e=[],t=this.headersArray();for(let r=0;r<t.length;++r)e.push(t[r].name);return e}headerValues(){const e=[],t=this.headersArray();for(let r=0;r<t.length;++r)e.push(t[r].value);return e}toJson(e={}){const t={};if(e.preserveCase)for(const e in this._headersMap){const r=this._headersMap[e];t[r.name]=r.value}else for(const e in this._headersMap){const r=this._headersMap[e];t[n(r.name)]=r.value}return t}toString(){return JSON.stringify(this.toJson({preserveCase:!0}))}clone(){const e={};for(const t in this._headersMap){const r=this._headersMap[t];e[r.name]=r.value}return new a(e)}}function o(e){return(e instanceof Buffer?e:Buffer.from(e.buffer)).toString("base64")}function s(e){return Buffer.from(e,"base64")}const c="$",u="_";var l=r(90656);const p=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i,d="undefined"!=typeof process&&!!process.version&&!!process.versions&&!!process.versions.node;function f(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/"/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function m(e){const t={};return t.body=e.bodyAsText,t.headers=e.headers,t.status=e.status,t}function _(e){const t=e.clone();return t.headers&&t.headers.remove("authorization"),t}function h(e){return p.test(e)}function g(){return(0,l.Z)()}function y(e,t){let r=Promise.resolve(t);return e.forEach((e=>{r=r.then(e)})),r}function v(e){if("function"!=typeof e.then)throw new Error("The provided input is not a Promise.");return t=>{e.then((e=>t(void 0,e))).catch((e=>{t(e)}))}}function b(e){if("function"!=typeof e.then)throw new Error("The provided input is not a Promise.");return t=>{e.then((e=>process.nextTick(t,void 0,e.parsedBody,e.request,e))).catch((e=>{process.nextTick(t,e)}))}}function x(e,t){const r=e;t.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((t=>{r.prototype[t]=e.prototype[t]}))}))}const S=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function w(e){return S.test(e)}function E(e,t,r){return e&&t?e.split(t).join(r||""):e}function D(e){return process.env[e]?process.env[e]:process.env[e.toLowerCase()]?process.env[e.toLowerCase()]:void 0}class C{constructor(e={},t){this.modelMappers=e,this.isXML=t}validateConstraints(e,t,r){const n=(e,n)=>{throw new Error(`"${r}" with value "${t}" should satisfy the constraint "${e}": ${n}.`)};if(e.constraints&&null!=t){const r=t,{ExclusiveMaximum:i,ExclusiveMinimum:a,InclusiveMaximum:o,InclusiveMinimum:s,MaxItems:c,MaxLength:u,MinItems:l,MinLength:p,MultipleOf:d,Pattern:f,UniqueItems:m}=e.constraints;null!=i&&r>=i&&n("ExclusiveMaximum",i),null!=a&&r<=a&&n("ExclusiveMinimum",a),null!=o&&r>o&&n("InclusiveMaximum",o),null!=s&&r<s&&n("InclusiveMinimum",s);const _=t;if(null!=c&&_.length>c&&n("MaxItems",c),null!=u&&_.length>u&&n("MaxLength",u),null!=l&&_.length<l&&n("MinItems",l),null!=p&&_.length<p&&n("MinLength",p),null!=d&&r%d!=0&&n("MultipleOf",d),f){const e="string"==typeof f?new RegExp(f):f;"string"==typeof t&&null!==t.match(e)||n("Pattern",f)}m&&_.some(((e,t,r)=>r.indexOf(e)!==t))&&n("UniqueItems",m)}}serialize(e,t,r,n={}){var i,a,s;const l={rootName:null!==(i=n.rootName)&&void 0!==i?i:"",includeRoot:null!==(a=n.includeRoot)&&void 0!==a&&a,xmlCharKey:null!==(s=n.xmlCharKey)&&void 0!==s?s:u};let p={};const d=e.type.name;r||(r=e.serializedName),null!==d.match(/^Sequence$/i)&&(p=[]),e.isConstant&&(t=e.defaultValue);const{required:f,nullable:m}=e;if(f&&m&&void 0===t)throw new Error(`${r} cannot be undefined.`);if(f&&!m&&null==t)throw new Error(`${r} cannot be null or undefined.`);if(!f&&!1===m&&null===t)throw new Error(`${r} cannot be null.`);return null==t?p=t:(this.validateConstraints(e,t,r),null!==d.match(/^any$/i)?p=t:null!==d.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i)?p=function(e,t,r){if(null!=r)if(null!==e.match(/^Number$/i)){if("number"!=typeof r)throw new Error(`${t} with value ${r} must be of type number.`)}else if(null!==e.match(/^String$/i)){if("string"!=typeof r.valueOf())throw new Error(`${t} with value "${r}" must be of type string.`)}else if(null!==e.match(/^Uuid$/i)){if("string"!=typeof r.valueOf()||!h(r))throw new Error(`${t} with value "${r}" must be of type string and a valid uuid.`)}else if(null!==e.match(/^Boolean$/i)){if("boolean"!=typeof r)throw new Error(`${t} with value ${r} must be of type boolean.`)}else if(null!==e.match(/^Stream$/i)){const e=typeof r;if(!("string"===e||"function"===e||r instanceof ArrayBuffer||ArrayBuffer.isView(r)||("function"==typeof Blob||"object"==typeof Blob)&&r instanceof Blob))throw new Error(`${t} must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.`)}return r}(d,r,t):null!==d.match(/^Enum$/i)?p=function(e,t,r){if(!t)throw new Error(`Please provide a set of allowedValues to validate ${e} as an Enum Type.`);if(!t.some((e=>"string"==typeof e.valueOf()?e.toLowerCase()===r.toLowerCase():e===r)))throw new Error(`${r} is not a valid value for ${e}. The valid values are: ${JSON.stringify(t)}.`);return r}(r,e.type.allowedValues,t):null!==d.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/i)?p=function(e,t,r){if(null!=t)if(null!==e.match(/^Date$/i)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(`${r} must be an instanceof Date or a string in ISO8601 format.`);t=t instanceof Date?t.toISOString().substring(0,10):new Date(t).toISOString().substring(0,10)}else if(null!==e.match(/^DateTime$/i)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(`${r} must be an instanceof Date or a string in ISO8601 format.`);t=t instanceof Date?t.toISOString():new Date(t).toISOString()}else if(null!==e.match(/^DateTimeRfc1123$/i)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(`${r} must be an instanceof Date or a string in RFC-1123 format.`);t=t instanceof Date?t.toUTCString():new Date(t).toUTCString()}else if(null!==e.match(/^UnixTime$/i)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(`${r} must be an instanceof Date or a string in RFC-1123/ISO8601 format for it to be serialized in UnixTime/Epoch format.`);t=function(e){if(e)return"string"==typeof e.valueOf()&&(e=new Date(e)),Math.floor(e.getTime()/1e3)}(t)}else if(null!==e.match(/^TimeSpan$/i)&&!w(t))throw new Error(`${r} must be a string in ISO 8601 format. Instead was "${t}".`);return t}(d,t,r):null!==d.match(/^ByteArray$/i)?p=function(e,t){let r="";if(null!=t){if(!(t instanceof Uint8Array))throw new Error(`${e} must be of type Uint8Array.`);r=o(t)}return r}(r,t):null!==d.match(/^Base64Url$/i)?p=function(e,t){let r="";if(null!=t){if(!(t instanceof Uint8Array))throw new Error(`${e} must be of type Uint8Array.`);r=function(e){if(e){if(!(e instanceof Uint8Array))throw new Error("Please provide an input of type Uint8Array for converting to Base64Url.");return function(e,t){let r=e.length;for(;r-1>=0&&"="===e[r-1];)--r;return e.substr(0,r)}(o(e)).replace(/\+/g,"-").replace(/\//g,"_")}}(t)||""}return r}(r,t):null!==d.match(/^Sequence$/i)?p=function(e,t,r,n,i,a){if(!Array.isArray(r))throw new Error(`${n} must be of type Array.`);const o=t.type.element;if(!o||"object"!=typeof o)throw new Error(`element" metadata for an Array must be defined in the mapper and it must of type "object" in ${n}.`);const s=[];for(let t=0;t<r.length;t++){const u=e.serialize(o,r[t],n,a);if(i&&o.xmlNamespace){const e=o.xmlNamespacePrefix?`xmlns:${o.xmlNamespacePrefix}`:"xmlns";"Composite"===o.type.name?(s[t]=Object.assign({},u),s[t][c]={[e]:o.xmlNamespace}):(s[t]={},s[t][a.xmlCharKey]=u,s[t][c]={[e]:o.xmlNamespace})}else s[t]=u}return s}(this,e,t,r,Boolean(this.isXML),l):null!==d.match(/^Dictionary$/i)?p=function(e,t,r,n,i,a){if("object"!=typeof r)throw new Error(`${n} must be of type object.`);const o=t.type.value;if(!o||"object"!=typeof o)throw new Error(`"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in ${n}.`);const s={};for(const t of Object.keys(r)){const c=e.serialize(o,r[t],n,a);s[t]=P(o,c,i,a)}if(i&&t.xmlNamespace){const e=t.xmlNamespacePrefix?`xmlns:${t.xmlNamespacePrefix}`:"xmlns",r=s;return r[c]={[e]:t.xmlNamespace},r}return s}(this,e,t,r,Boolean(this.isXML),l):null!==d.match(/^Composite$/i)&&(p=function(e,t,r,n,i,a){if(I(e,t)&&(t=N(e,t,r,"clientName")),null!=r){const o={},s=A(e,t,n);for(const u of Object.keys(s)){const l=s[u];if(l.readOnly)continue;let p,d=o;if(e.isXML)p=l.xmlIsWrapped?l.xmlName:l.xmlElementName||l.xmlName;else{const e=T(l.serializedName);p=e.pop();for(const t of e)null!=d[t]||null==r[u]&&void 0===l.defaultValue||(d[t]={}),d=d[t]}if(null!=d){if(i&&t.xmlNamespace){const e=t.xmlNamespacePrefix?`xmlns:${t.xmlNamespacePrefix}`:"xmlns";d[c]=Object.assign(Object.assign({},d[c]),{[e]:t.xmlNamespace})}const o=""!==l.serializedName?n+"."+l.serializedName:n;let s=r[u];const f=I(e,t);f&&f.clientName===u&&null==s&&(s=t.serializedName);const m=e.serialize(l,s,o,a);if(void 0!==m&&null!=p){const e=P(l,m,i,a);i&&l.xmlIsAttribute?(d[c]=d[c]||{},d[c][p]=m):i&&l.xmlIsWrapped?d[p]={[l.xmlElementName]:e}:d[p]=e}}}const u=function(e,t,r){const n=t.type.additionalProperties;if(!n&&t.type.className){const n=k(e,t,r);return null==n?void 0:n.type.additionalProperties}return n}(e,t,n);if(u){const t=Object.keys(s);for(const i in r)t.every((e=>e!==i))&&(o[i]=e.serialize(u,r[i],n+'["'+i+'"]',a))}return o}return r}(this,e,t,r,Boolean(this.isXML),l))),p}deserialize(e,t,r,n={}){var i,a,o;const l={rootName:null!==(i=n.rootName)&&void 0!==i?i:"",includeRoot:null!==(a=n.includeRoot)&&void 0!==a&&a,xmlCharKey:null!==(o=n.xmlCharKey)&&void 0!==o?o:u};if(null==t)return this.isXML&&"Sequence"===e.type.name&&!e.xmlIsWrapped&&(t=[]),void 0!==e.defaultValue&&(t=e.defaultValue),t;let p;const d=e.type.name;if(r||(r=e.serializedName),null!==d.match(/^Composite$/i))p=function(e,t,r,n,i){var a;I(e,t)&&(t=N(e,t,r,"serializedName"));const o=A(e,t,n);let s={};const u=[];for(const l of Object.keys(o)){const p=o[l],d=T(o[l].serializedName);u.push(d[0]);const{serializedName:f,xmlName:m,xmlElementName:_}=p;let h=n;""!==f&&void 0!==f&&(h=n+"."+f);const g=p.headerCollectionPrefix;if(g){const t={};for(const n of Object.keys(r))n.startsWith(g)&&(t[n.substring(g.length)]=e.deserialize(p.type.value,r[n],h,i)),u.push(n);s[l]=t}else if(e.isXML)if(p.xmlIsAttribute&&r[c])s[l]=e.deserialize(p,r[c][m],h,i);else{const t=_||m||f;if(p.xmlIsWrapped){const t=r[m],n=null!==(a=null==t?void 0:t[_])&&void 0!==a?a:[];s[l]=e.deserialize(p,n,h,i)}else{const n=r[t];s[l]=e.deserialize(p,n,h,i)}}else{let n,a=r;for(const e of d){if(!a)break;a=a[e]}n=a;const c=t.type.polymorphicDiscriminator;let u;if(c&&l===c.clientName&&null==n&&(n=t.serializedName),Array.isArray(r[l])&&""===o[l].serializedName){n=r[l];const t=e.deserialize(p,n,h,i);for(const[e,r]of Object.entries(s))Object.prototype.hasOwnProperty.call(t,e)||(t[e]=r);s=t}else void 0===n&&void 0===p.defaultValue||(u=e.deserialize(p,n,h,i),s[l]=u)}}const l=t.type.additionalProperties;if(l){const t=e=>{for(const t in o)if(T(o[t].serializedName)[0]===e)return!1;return!0};for(const a in r)t(a)&&(s[a]=e.deserialize(l,r[a],n+'["'+a+'"]',i))}else if(r)for(const e of Object.keys(r))void 0!==s[e]||u.includes(e)||O(e,i)||(s[e]=r[e]);return s}(this,e,t,r,l);else{if(this.isXML){const e=l.xmlCharKey,r=t;null!=r[c]&&null!=r[e]&&(t=r[e])}null!==d.match(/^Number$/i)?(p=parseFloat(t),isNaN(p)&&(p=t)):null!==d.match(/^Boolean$/i)?p="true"===t||"false"!==t&&t:null!==d.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i)?p=t:null!==d.match(/^(Date|DateTime|DateTimeRfc1123)$/i)?p=new Date(t):null!==d.match(/^UnixTime$/i)?p=function(e){if(e)return new Date(1e3*e)}(t):null!==d.match(/^ByteArray$/i)?p=s(t):null!==d.match(/^Base64Url$/i)?p=function(e){if(e){if(e&&"string"!=typeof e.valueOf())throw new Error("Please provide an input of type string for converting to Uint8Array");return s(e=e.replace(/-/g,"+").replace(/_/g,"/"))}}(t):null!==d.match(/^Sequence$/i)?p=function(e,t,r,n,i){const a=t.type.element;if(!a||"object"!=typeof a)throw new Error(`element" metadata for an Array must be defined in the mapper and it must of type "object" in ${n}`);if(r){Array.isArray(r)||(r=[r]);const t=[];for(let o=0;o<r.length;o++)t[o]=e.deserialize(a,r[o],`${n}[${o}]`,i);return t}return r}(this,e,t,r,l):null!==d.match(/^Dictionary$/i)&&(p=function(e,t,r,n,i){const a=t.type.value;if(!a||"object"!=typeof a)throw new Error(`"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in ${n}`);if(r){const t={};for(const o of Object.keys(r))t[o]=e.deserialize(a,r[o],n,i);return t}return r}(this,e,t,r,l))}return e.isConstant&&(p=e.defaultValue),p}}function T(e){const t=[];let r="";if(e){const n=e.split(".");for(const e of n)"\\"===e.charAt(e.length-1)?r+=e.substr(0,e.length-1)+".":(r+=e,t.push(r),r="")}return t}function k(e,t,r){const n=t.type.className;if(!n)throw new Error(`Class name for model "${r}" is not provided in the mapper "${JSON.stringify(t,void 0,2)}".`);return e.modelMappers[n]}function A(e,t,r){let n=t.type.modelProperties;if(!n){const i=k(e,t,r);if(!i)throw new Error(`mapper() cannot be null or undefined for model "${t.type.className}".`);if(n=null==i?void 0:i.type.modelProperties,!n)throw new Error(`modelProperties cannot be null or undefined in the mapper "${JSON.stringify(i)}" of type "${t.type.className}" for object "${r}".`)}return n}function P(e,t,r,n){if(!r||!e.xmlNamespace)return t;const i={[e.xmlNamespacePrefix?`xmlns:${e.xmlNamespacePrefix}`:"xmlns"]:e.xmlNamespace};if(["Composite"].includes(e.type.name)){if(t[c])return t;{const e=Object.assign({},t);return e[c]=i,e}}const a={};return a[n.xmlCharKey]=t,a[c]=i,a}function O(e,t){return[c,t.xmlCharKey].includes(e)}function N(e,t,r,n){const i=I(e,t);if(i){const a=i[n];if(null!=a){const n=r[a];if(null!=n){const r=t.type.uberParent||t.type.className,i=n===r?n:r+"."+n,a=e.modelMappers.discriminators[i];a&&(t=a)}}}return t}function I(e,t){return t.type.polymorphicDiscriminator||F(e,t.type.uberParent)||F(e,t.type.className)}function F(e,t){return t&&e.modelMappers[t]&&e.modelMappers[t].type.polymorphicDiscriminator}function j(e){const t=e;if(null!=e){if(e instanceof Uint8Array)return o(e);if(e instanceof Date)return e.toISOString();if(Array.isArray(e)){const t=[];for(let r=0;r<e.length;r++)t.push(j(e[r]));return t}if("object"==typeof e){const r={};for(const n in e)r[n]=j(t[n]);return r}return e}}const R=function(e){const t={};for(const e of["Base64Url","Boolean","ByteArray","Composite","Date","DateTime","DateTimeRfc1123","Dictionary","Enum","Number","Object","Sequence","String","Stream","TimeSpan","UnixTime"])t[e]=e;return t}();class M{constructor(e,t,r,n,o,s,c,u,l,p,d,f,m,_,h){this.streamResponseBody=s,this.streamResponseStatusCodes=h,this.url=e||"",this.method=t||"GET",this.headers=i(o)?o:new a(o),this.body=r,this.query=n,this.formData=void 0,this.withCredentials=c||!1,this.abortSignal=u,this.timeout=l||0,this.onUploadProgress=p,this.onDownloadProgress=d,this.proxySettings=f,this.keepAlive=m,this.decompressResponse=_,this.requestId=this.headers.get("x-ms-client-request-id")||g()}validateRequestProperties(){if(!this.method)throw new Error("WebResource.method is required.");if(!this.url)throw new Error("WebResource.url is required.")}prepare(e){if(!e)throw new Error("options object is required");if(void 0===e.method||null===e.method||"string"!=typeof e.method.valueOf())throw new Error("options.method must be a string.");if(e.url&&e.pathTemplate)throw new Error("options.url and options.pathTemplate are mutually exclusive. Please provide exactly one of them.");if(!(void 0!==e.pathTemplate&&null!==e.pathTemplate&&"string"==typeof e.pathTemplate.valueOf()||void 0!==e.url&&null!==e.url&&"string"==typeof e.url.valueOf()))throw new Error("Please provide exactly one of options.pathTemplate or options.url.");if(e.url){if("string"!=typeof e.url)throw new Error('options.url must be of type "string".');this.url=e.url}if(e.method){const t=["GET","PUT","HEAD","DELETE","OPTIONS","POST","PATCH","TRACE"];if(-1===t.indexOf(e.method.toUpperCase()))throw new Error('The provided method "'+e.method+'" is invalid. Supported HTTP methods are: '+JSON.stringify(t))}if(this.method=e.method.toUpperCase(),e.pathTemplate){const{pathTemplate:t,pathParameters:r}=e;if("string"!=typeof t)throw new Error('options.pathTemplate must be of type "string".');e.baseUrl||(e.baseUrl="https://management.azure.com");const n=e.baseUrl;let i=n+(n.endsWith("/")?"":"/")+(t.startsWith("/")?t.slice(1):t);const a=i.match(/({[\w-]*\s*[\w-]*})/gi);if(a&&a.length){if(!r)throw new Error(`pathTemplate: ${t} has been provided. Hence, options.pathParameters must also be provided.`);a.forEach((function(e){const n=e.slice(1,-1),a=r[n];if(null==a||"string"!=typeof a&&"object"!=typeof a){const e=JSON.stringify(r,void 0,2);throw new Error(`pathTemplate: ${t} contains the path parameter ${n} however, it is not present in parameters: ${e}.The value of the path parameter can either be a "string" of the form { ${n}: "some sample value" } or it can be an "object" of the form { "${n}": { value: "some sample value", skipUrlEncoding: true } }.`)}if("string"==typeof a.valueOf()&&(i=i.replace(e,encodeURIComponent(a))),"object"==typeof a.valueOf()){if(!a.value)throw new Error(`options.pathParameters[${n}] is of type "object" but it does not contain a "value" property.`);i=a.skipUrlEncoding?i.replace(e,a.value):i.replace(e,encodeURIComponent(a.value))}}))}this.url=i}if(e.queryParameters){const t=e.queryParameters;if("object"!=typeof t)throw new Error('options.queryParameters must be of type object. It should be a JSON object of "query-parameter-name" as the key and the "query-parameter-value" as the value. The "query-parameter-value" may be fo type "string" or an "object" of the form { value: "query-parameter-value", skipUrlEncoding: true }.');this.url&&-1===this.url.indexOf("?")&&(this.url+="?");const r=[];this.query={};for(const e in t){const n=t[e];if(n)if("string"==typeof n)r.push(e+"="+encodeURIComponent(n)),this.query[e]=encodeURIComponent(n);else if("object"==typeof n){if(!n.value)throw new Error(`options.queryParameters[${e}] is of type "object" but it does not contain a "value" property.`);n.skipUrlEncoding?(r.push(e+"="+n.value),this.query[e]=n.value):(r.push(e+"="+encodeURIComponent(n.value)),this.query[e]=encodeURIComponent(n.value))}}this.url+=r.join("&")}if(e.headers){const t=e.headers;for(const r of Object.keys(e.headers))this.headers.set(r,t[r])}return this.headers.get("accept-language")||this.headers.set("accept-language","en-US"),this.headers.get("x-ms-client-request-id")||e.disableClientRequestId||this.headers.set("x-ms-client-request-id",this.requestId),this.headers.get("Content-Type")||this.headers.set("Content-Type","application/json; charset=utf-8"),this.body=e.body,void 0!==e.body&&null!==e.body&&(e.bodyIsStream?(this.headers.get("Transfer-Encoding")||this.headers.set("Transfer-Encoding","chunked"),"application/octet-stream"!==this.headers.get("Content-Type")&&this.headers.set("Content-Type","application/octet-stream")):(e.serializationMapper&&(this.body=new C(e.mappers).serialize(e.serializationMapper,e.body,"requestBody")),e.disableJsonStringifyOnBody||(this.body=JSON.stringify(e.body)))),e.spanOptions&&(this.spanOptions=e.spanOptions),e.tracingContext&&(this.tracingContext=e.tracingContext),this.abortSignal=e.abortSignal,this.onDownloadProgress=e.onDownloadProgress,this.onUploadProgress=e.onUploadProgress,this}clone(){const e=new M(this.url,this.method,this.body,this.query,this.headers&&this.headers.clone(),this.streamResponseBody,this.withCredentials,this.abortSignal,this.timeout,this.onUploadProgress,this.onDownloadProgress,this.proxySettings,this.keepAlive,this.decompressResponse,this.streamResponseStatusCodes);return this.formData&&(e.formData=this.formData),this.operationSpec&&(e.operationSpec=this.operationSpec),this.shouldDeserialize&&(e.shouldDeserialize=this.shouldDeserialize),this.operationResponseGetter&&(e.operationResponseGetter=this.operationResponseGetter),e}}var L=r(13685),B=r(95687),U=r(95595),V=r(5163),$=new WeakMap,z=new WeakMap,q=function(){function e(){this.onabort=null,$.set(this,[]),z.set(this,!1)}return Object.defineProperty(e.prototype,"aborted",{get:function(){if(!z.has(this))throw new TypeError("Expected `this` to be an instance of AbortSignal.");return z.get(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"none",{get:function(){return new e},enumerable:!1,configurable:!0}),e.prototype.addEventListener=function(e,t){if(!$.has(this))throw new TypeError("Expected `this` to be an instance of AbortSignal.");$.get(this).push(t)},e.prototype.removeEventListener=function(e,t){if(!$.has(this))throw new TypeError("Expected `this` to be an instance of AbortSignal.");var r=$.get(this),n=r.indexOf(t);n>-1&&r.splice(n,1)},e.prototype.dispatchEvent=function(e){throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes.")},e}();function J(e){if(!e.aborted){e.onabort&&e.onabort.call(e);var t=$.get(e);t&&t.slice().forEach((function(t){t.call(e,{type:"abort"})})),z.set(e,!0)}}var W=function(e){function t(t){var r=e.call(this,t)||this;return r.name="AbortError",r}return(0,V.__extends)(t,e),t}(Error),G=function(){function e(e){var t=this;if(this._signal=new q,e){Array.isArray(e)||(e=arguments);for(var r=0,n=e;r<n.length;r++){var i=n[r];i.aborted?this.abort():i.addEventListener("abort",(function(){t.abort()}))}}}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},enumerable:!1,configurable:!0}),e.prototype.abort=function(){J(this._signal)},e.timeout=function(e){var t=new q,r=setTimeout(J,e,t);return"function"==typeof r.unref&&r.unref(),t},e}(),H=r(1681);class K{constructor(){this._rawQuery={}}any(){return Object.keys(this._rawQuery).length>0}keys(){return Object.keys(this._rawQuery)}set(e,t){const r=t;if(e)if(null!=r){const t=Array.isArray(r)?r:r.toString();this._rawQuery[e]=t}else delete this._rawQuery[e]}get(e){return e?this._rawQuery[e]:void 0}toString(){let e="";for(const t in this._rawQuery){e&&(e+="&");const r=this._rawQuery[t];if(Array.isArray(r)){const n=[];for(const e of r)n.push(`${t}=${e}`);e+=n.join("&")}else e+=`${t}=${r}`}return e}static parse(e){const t=new K;if(e){e.startsWith("?")&&(e=e.substring(1));let r="ParameterName",n="",i="";for(let a=0;a<e.length;++a){const o=e[a];switch(r){case"ParameterName":switch(o){case"=":r="ParameterValue";break;case"&":n="",i="";break;default:n+=o}break;case"ParameterValue":"&"===o?(t.set(n,i),n="",i="",r="ParameterName"):i+=o;break;default:throw new Error("Unrecognized URLQuery parse state: "+r)}}"ParameterValue"===r&&t.set(n,i)}return t}}class X{setScheme(e){e?this.set(e,"SCHEME"):this._scheme=void 0}getScheme(){return this._scheme}setHost(e){e?this.set(e,"SCHEME_OR_HOST"):this._host=void 0}getHost(){return this._host}setPort(e){null==e||""===e?this._port=void 0:this.set(e.toString(),"PORT")}getPort(){return this._port}setPath(e){if(e){const t=e.indexOf("://");if(-1!==t){const r=e.lastIndexOf("/",t);this.set(-1===r?e:e.substr(r+1),"SCHEME")}else this.set(e,"PATH")}else this._path=void 0}appendPath(e){if(e){let t=this.getPath();t&&(t.endsWith("/")||(t+="/"),e.startsWith("/")&&(e=e.substring(1)),e=t+e),this.set(e,"PATH")}}getPath(){return this._path}setQuery(e){this._query=e?K.parse(e):void 0}setQueryParameter(e,t){e&&(this._query||(this._query=new K),this._query.set(e,t))}getQueryParameterValue(e){return this._query?this._query.get(e):void 0}getQuery(){return this._query?this._query.toString():void 0}set(e,t){const r=new Z(e,t);for(;r.next();){const e=r.current();let t;if(e)switch(e.type){case"SCHEME":this._scheme=e.text||void 0;break;case"HOST":this._host=e.text||void 0;break;case"PORT":this._port=e.text||void 0;break;case"PATH":t=e.text||void 0,this._path&&"/"!==this._path&&"/"===t||(this._path=t);break;case"QUERY":this._query=K.parse(e.text);break;default:throw new Error(`Unrecognized URLTokenType: ${e.type}`)}}}toString(){let e="";return this._scheme&&(e+=`${this._scheme}://`),this._host&&(e+=this._host),this._port&&(e+=`:${this._port}`),this._path&&(this._path.startsWith("/")||(e+="/"),e+=this._path),this._query&&this._query.any()&&(e+=`?${this._query.toString()}`),e}replaceAll(e,t){e&&(this.setScheme(E(this.getScheme(),e,t)),this.setHost(E(this.getHost(),e,t)),this.setPort(E(this.getPort(),e,t)),this.setPath(E(this.getPath(),e,t)),this.setQuery(E(this.getQuery(),e,t)))}static parse(e){const t=new X;return t.set(e,"SCHEME_OR_HOST"),t}}class Y{constructor(e,t){this.text=e,this.type=t}static scheme(e){return new Y(e,"SCHEME")}static host(e){return new Y(e,"HOST")}static port(e){return new Y(e,"PORT")}static path(e){return new Y(e,"PATH")}static query(e){return new Y(e,"QUERY")}}class Z{constructor(e,t){this._text=e,this._textLength=e?e.length:0,this._currentState=null!=t?t:"SCHEME_OR_HOST",this._currentIndex=0}current(){return this._currentToken}next(){if(Q(this))switch(this._currentState){case"SCHEME":!function(e){const t=function(e){return ne(e,(e=>function(e){const t=e.charCodeAt(0);return 48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122}(e)))}(e);e._currentToken=Y.scheme(t),Q(e)?e._currentState="HOST":e._currentState="DONE"}(this);break;case"SCHEME_OR_HOST":!function(e){const t=ie(e,":","/","?");Q(e)?":"===ee(e)?"://"===re(e,3)?(e._currentToken=Y.scheme(t),e._currentState="HOST"):(e._currentToken=Y.host(t),e._currentState="PORT"):(e._currentToken=Y.host(t),"/"===ee(e)?e._currentState="PATH":e._currentState="QUERY"):(e._currentToken=Y.host(t),e._currentState="DONE")}(this);break;case"HOST":!function(e){"://"===re(e,3)&&te(e,3);const t=ie(e,":","/","?");e._currentToken=Y.host(t),Q(e)?":"===ee(e)?e._currentState="PORT":"/"===ee(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}(this);break;case"PORT":!function(e){":"===ee(e)&&te(e);const t=ie(e,"/","?");e._currentToken=Y.port(t),Q(e)?"/"===ee(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}(this);break;case"PATH":!function(e){const t=ie(e,"?");e._currentToken=Y.path(t),Q(e)?e._currentState="QUERY":e._currentState="DONE"}(this);break;case"QUERY":!function(e){"?"===ee(e)&&te(e);const t=function(e){let t="";return e._currentIndex<e._textLength&&(t=e._text.substring(e._currentIndex),e._currentIndex=e._textLength),t}(e);e._currentToken=Y.query(t),e._currentState="DONE"}(this);break;default:throw new Error(`Unrecognized URLTokenizerState: ${this._currentState}`)}else this._currentToken=void 0;return!!this._currentToken}}function Q(e){return e._currentIndex<e._textLength}function ee(e){return e._text[e._currentIndex]}function te(e,t){Q(e)&&(t||(t=1),e._currentIndex+=t)}function re(e,t){let r=e._currentIndex+t;return e._textLength<r&&(r=e._textLength),e._text.substring(e._currentIndex,r)}function ne(e,t){let r="";for(;Q(e);){const n=ee(e);if(!t(n))break;r+=n,te(e)}return r}function ie(e,...t){return ne(e,(e=>-1===t.indexOf(e)))}function ae(e){return"https"===(X.parse(e).getScheme()||"").toLowerCase()}function oe(e,t,r){return e&&t?H.httpsOverHttps(r):e&&!t?H.httpsOverHttp(r):!e&&t?H.httpOverHttps(r):H.httpOverHttp(r)}var se=r(12781),ce=r(81658),ue=r.n(ce);const le="REDACTED",pe=["x-ms-client-request-id","x-ms-return-client-request-id","x-ms-useragent","x-ms-correlation-request-id","x-ms-request-id","client-request-id","ms-cv","return-client-request-id","traceparent","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Origin","Accept","Accept-Encoding","Cache-Control","Connection","Content-Length","Content-Type","Date","ETag","Expires","If-Match","If-Modified-Since","If-None-Match","If-Unmodified-Since","Last-Modified","Pragma","Request-Id","Retry-After","Server","Transfer-Encoding","User-Agent"],de=["api-version"];class fe{constructor({allowedHeaderNames:e=[],allowedQueryParameters:t=[]}={}){e=Array.isArray(e)?pe.concat(e):pe,t=Array.isArray(t)?de.concat(t):de,this.allowedHeaderNames=new Set(e.map((e=>e.toLowerCase()))),this.allowedQueryParameters=new Set(t.map((e=>e.toLowerCase())))}sanitize(e){const t=new Set;return JSON.stringify(e,((e,r)=>{if(r instanceof Error)return Object.assign(Object.assign({},r),{name:r.name,message:r.message});if("_headersMap"===e)return this.sanitizeHeaders(r);if("url"===e)return this.sanitizeUrl(r);if("query"===e)return this.sanitizeQuery(r);if("body"!==e&&"response"!==e&&"operationSpec"!==e){if(Array.isArray(r)||!("object"!=typeof(n=r)||null===n||Array.isArray(n)||n instanceof RegExp||n instanceof Date)){if(t.has(r))return"[Circular]";t.add(r)}var n;return r}}),2)}sanitizeHeaders(e){return this.sanitizeObject(e,this.allowedHeaderNames,((e,t)=>e[t].value))}sanitizeQuery(e){return this.sanitizeObject(e,this.allowedQueryParameters,((e,t)=>e[t]))}sanitizeObject(e,t,r){if("object"!=typeof e||null===e)return e;const n={};for(const i of Object.keys(e))t.has(i.toLowerCase())?n[i]=r(e,i):n[i]=le;return n}sanitizeUrl(e){if("string"!=typeof e||null===e)return e;const t=X.parse(e),r=t.getQuery();if(!r)return e;const n=K.parse(r);for(const e of n.keys())this.allowedQueryParameters.has(e.toLowerCase())||n.set(e,le);return t.setQuery(n.toString()),t.toString()}}var me=r(73837),_e=r.n(me);const he=me.inspect.custom,ge=new fe;class ye extends Error{constructor(e,t,r,n,i){super(e),this.name="RestError",this.code=t,this.statusCode=r,this.request=n,this.response=i,Object.setPrototypeOf(this,ye.prototype)}[he](){return`RestError: ${this.message} \n ${ge.sanitize(this)}`}}ye.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR",ye.PARSE_ERROR="PARSE_ERROR";var ve=r(22037);const be="undefined"!=typeof process&&process.env&&process.env.DEBUG||void 0;let xe,Se=[],we=[];const Ee=[];be&&Ce(be);const De=Object.assign((e=>ke(e)),{enable:Ce,enabled:Te,disable:function(){const e=xe||"";return Ce(""),e},log:function(e,...t){process.stderr.write(`${_e().format(e,...t)}${ve.EOL}`)}});function Ce(e){xe=e,Se=[],we=[];const t=/\*/g,r=e.split(",").map((e=>e.trim().replace(t,".*?")));for(const e of r)e.startsWith("-")?we.push(new RegExp(`^${e.substr(1)}$`)):Se.push(new RegExp(`^${e}$`));for(const e of Ee)e.enabled=Te(e.namespace)}function Te(e){if(e.endsWith("*"))return!0;for(const t of we)if(t.test(e))return!1;for(const t of Se)if(t.test(e))return!0;return!1}function ke(e){const t=Object.assign((function(...r){t.enabled&&(r.length>0&&(r[0]=`${e} ${r[0]}`),t.log(...r))}),{enabled:Te(e),destroy:Ae,log:De.log,namespace:e,extend:Pe});return Ee.push(t),t}function Ae(){const e=Ee.indexOf(this);return e>=0&&(Ee.splice(e,1),!0)}function Pe(e){const t=ke(`${this.namespace}:${e}`);return t.log=this.log,t}const Oe=De,Ne=new Set,Ie="undefined"!=typeof process&&process.env&&process.env.AZURE_LOG_LEVEL||void 0;let Fe;const je=Oe("azure");je.log=(...e)=>{Oe.log(...e)};const Re=["verbose","info","warning","error"];Ie&&(Ve(Ie)?function(e){if(e&&!Ve(e))throw new Error(`Unknown log level '${e}'. Acceptable values: ${Re.join(",")}`);Fe=e;const t=[];for(const e of Ne)Ue(e)&&t.push(e.namespace);Oe.enable(t.join(","))}(Ie):console.error(`AZURE_LOG_LEVEL set to unknown log level '${Ie}'; logging is not enabled. Acceptable values: ${Re.join(", ")}.`));const Me={verbose:400,info:300,warning:200,error:100};function Le(e,t){t.log=(...t)=>{e.log(...t)}}function Be(e,t){const r=Object.assign(e.extend(t),{level:t});if(Le(e,r),Ue(r)){const e=Oe.disable();Oe.enable(e+","+r.namespace)}return Ne.add(r),r}function Ue(e){return!!(Fe&&Me[e.level]<=Me[Fe])}function Ve(e){return Re.includes(e)}const $e=function(e){const t=je.extend("core-http");return Le(je,t),{error:Be(t,"error"),warning:Be(t,"warning"),info:Be(t,"info"),verbose:Be(t,"verbose")}}();var ze=r(57310),qe=r(78382),Je=r(59796);const We=se.Readable,Ge=Symbol("buffer"),He=Symbol("type");class Ke{constructor(){this[He]="";const e=arguments[0],t=arguments[1],r=[];let n=0;if(e){const t=e,i=Number(t.length);for(let e=0;e<i;e++){const i=t[e];let a;a=i instanceof Buffer?i:ArrayBuffer.isView(i)?Buffer.from(i.buffer,i.byteOffset,i.byteLength):i instanceof ArrayBuffer?Buffer.from(i):i instanceof Ke?i[Ge]:Buffer.from("string"==typeof i?i:String(i)),n+=a.length,r.push(a)}}this[Ge]=Buffer.concat(r);let i=t&&void 0!==t.type&&String(t.type).toLowerCase();i&&!/[^\u0020-\u007E]/.test(i)&&(this[He]=i)}get size(){return this[Ge].length}get type(){return this[He]}text(){return Promise.resolve(this[Ge].toString())}arrayBuffer(){const e=this[Ge],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new We;return e._read=function(){},e.push(this[Ge]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,i;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),i=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const a=Math.max(i-n,0),o=this[Ge].slice(n,n+a),s=new Ke([],{type:arguments[2]});return s[Ge]=o,s}}function Xe(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let Ye;Object.defineProperties(Ke.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(Ke.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),Xe.prototype=Object.create(Error.prototype),Xe.prototype.constructor=Xe,Xe.prototype.name="FetchError";try{Ye=require("encoding").convert}catch(e){}const Ze=Symbol("Body internals"),Qe=se.PassThrough;function et(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.size;let i=void 0===n?0:n;var a=r.timeout;let o=void 0===a?0:a;null==e?e=null:rt(e)?e=Buffer.from(e.toString()):nt(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof se||(e=Buffer.from(String(e)))),this[Ze]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=o,e instanceof se&&e.on("error",(function(e){const r="AbortError"===e.name?e:new Xe(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[Ze].error=r}))}function tt(){var e=this;if(this[Ze].disturbed)return et.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[Ze].disturbed=!0,this[Ze].error)return et.Promise.reject(this[Ze].error);let t=this.body;if(null===t)return et.Promise.resolve(Buffer.alloc(0));if(nt(t)&&(t=t.stream()),Buffer.isBuffer(t))return et.Promise.resolve(t);if(!(t instanceof se))return et.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new et.Promise((function(a,o){let s;e.timeout&&(s=setTimeout((function(){i=!0,o(new Xe(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(i=!0,o(t)):o(new Xe(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!i&&null!==t){if(e.size&&n+t.length>e.size)return i=!0,void o(new Xe(`content size at ${e.url} over limit: ${e.size}`,"max-size"));n+=t.length,r.push(t)}})),t.on("end",(function(){if(!i){clearTimeout(s);try{a(Buffer.concat(r,n))}catch(t){o(new Xe(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function rt(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function nt(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function it(e){let t,r,n=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof se&&"function"!=typeof n.getBoundary&&(t=new Qe,r=new Qe,n.pipe(t),n.pipe(r),e[Ze].body=t,n=r),n}function at(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":rt(e)?"application/x-www-form-urlencoded;charset=UTF-8":nt(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof se?null:"text/plain;charset=UTF-8"}function ot(e){const t=e.body;return null===t?0:nt(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}et.prototype={get body(){return this[Ze].body},get bodyUsed(){return this[Ze].disturbed},arrayBuffer(){return tt.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return tt.call(this).then((function(t){return Object.assign(new Ke([],{type:e.toLowerCase()}),{[Ge]:t})}))},json(){var e=this;return tt.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return et.Promise.reject(new Xe(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return tt.call(this).then((function(e){return e.toString()}))},buffer(){return tt.call(this)},textConverted(){var e=this;return tt.call(this).then((function(t){return function(e,t){if("function"!=typeof Ye)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let n,i,a="utf-8";return r&&(n=/charset=([^;]*)/i.exec(r)),i=e.slice(0,1024).toString(),!n&&i&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(i)),!n&&i&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(i),n||(n=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(i),n&&n.pop()),n&&(n=/charset=(.*)/i.exec(n.pop()))),!n&&i&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(i)),n&&(a=n.pop(),"gb2312"!==a&&"gbk"!==a||(a="gb18030")),Ye(e,"UTF-8",a).toString()}(t,e.headers)}))}},Object.defineProperties(et.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),et.mixIn=function(e){for(const t of Object.getOwnPropertyNames(et.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(et.prototype,t);Object.defineProperty(e,t,r)}},et.Promise=global.Promise;const st=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,ct=/[^\t\x20-\x7e\x80-\xff]/;function ut(e){if(e=`${e}`,st.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function lt(e){if(e=`${e}`,ct.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function pt(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const dt=Symbol("map");class ft{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[dt]=Object.create(null),e instanceof ft){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const r=e[t];this.append(t,r)}}}}get(e){ut(e=`${e}`);const t=pt(this[dt],e);return void 0===t?null:this[dt][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=mt(this),n=0;for(;n<r.length;){var i=r[n];const a=i[0],o=i[1];e.call(t,o,a,this),r=mt(this),n++}}set(e,t){t=`${t}`,ut(e=`${e}`),lt(t);const r=pt(this[dt],e);this[dt][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,ut(e=`${e}`),lt(t);const r=pt(this[dt],e);void 0!==r?this[dt][r].push(t):this[dt][e]=[t]}has(e){return ut(e=`${e}`),void 0!==pt(this[dt],e)}delete(e){ut(e=`${e}`);const t=pt(this[dt],e);void 0!==t&&delete this[dt][t]}raw(){return this[dt]}keys(){return ht(this,"key")}values(){return ht(this,"value")}[Symbol.iterator](){return ht(this,"key+value")}}function mt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(e[dt]).sort();return r.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[dt][t].join(", ")}:function(t){return[t.toLowerCase(),e[dt][t].join(", ")]})}ft.prototype.entries=ft.prototype[Symbol.iterator],Object.defineProperty(ft.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(ft.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const _t=Symbol("internal");function ht(e,t){const r=Object.create(gt);return r[_t]={target:e,kind:t,index:0},r}const gt=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==gt)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[_t];const t=e.target,r=e.kind,n=e.index,i=mt(t,r);return n>=i.length?{value:void 0,done:!0}:(this[_t].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function yt(e){const t=Object.assign({__proto__:null},e[dt]),r=pt(e[dt],"Host");return void 0!==r&&(t[r]=t[r][0]),t}Object.defineProperty(gt,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const vt=Symbol("Response internals"),bt=L.STATUS_CODES;class xt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};et.call(this,e,t);const r=t.status||200,n=new ft(t.headers);if(null!=e&&!n.has("Content-Type")){const t=at(e);t&&n.append("Content-Type",t)}this[vt]={url:t.url,status:r,statusText:t.statusText||bt[r],headers:n,counter:t.counter}}get url(){return this[vt].url||""}get status(){return this[vt].status}get ok(){return this[vt].status>=200&&this[vt].status<300}get redirected(){return this[vt].counter>0}get statusText(){return this[vt].statusText}get headers(){return this[vt].headers}clone(){return new xt(it(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}et.mixIn(xt.prototype),Object.defineProperties(xt.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(xt.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const St=Symbol("Request internals"),wt=ze.URL||qe.URL,Et=ze.parse,Dt=ze.format;function Ct(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(e)&&(e=new wt(e).toString()),Et(e)}const Tt="destroy"in se.Readable.prototype;function kt(e){return"object"==typeof e&&"object"==typeof e[St]}class At{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kt(e)?t=Ct(e.url):(t=e&&e.href?Ct(e.href):Ct(`${e}`),e={});let n=r.method||e.method||"GET";if(n=n.toUpperCase(),(null!=r.body||kt(e)&&null!==e.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:kt(e)&&null!==e.body?it(e):null;et.call(this,i,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const a=new ft(r.headers||e.headers||{});if(null!=i&&!a.has("Content-Type")){const e=at(i);e&&a.append("Content-Type",e)}let o=kt(e)?e.signal:null;if("signal"in r&&(o=r.signal),null!=o&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(o))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[St]={method:n,redirect:r.redirect||e.redirect||"follow",headers:a,parsedURL:t,signal:o},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[St].method}get url(){return Dt(this[St].parsedURL)}get headers(){return this[St].headers}get redirect(){return this[St].redirect}get signal(){return this[St].signal}clone(){return new At(this)}}function Pt(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}et.mixIn(At.prototype),Object.defineProperty(At.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(At.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),Pt.prototype=Object.create(Error.prototype),Pt.prototype.constructor=Pt,Pt.prototype.name="AbortError";const Ot=ze.URL||qe.URL,Nt=se.PassThrough;function It(e,t){if(!It.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return et.Promise=It.Promise,new It.Promise((function(r,n){const i=new At(e,t),a=function(e){const t=e[St].parsedURL,r=new ft(e[St].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof se.Readable&&!Tt)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(n="0"),null!=e.body){const t=ot(e);"number"==typeof t&&(n=String(t))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:yt(r),agent:i})}(i),o=("https:"===a.protocol?B:L).request,s=i.signal;let c=null;const u=function(){let e=new Pt("The user aborted a request.");n(e),i.body&&i.body instanceof se.Readable&&i.body.destroy(e),c&&c.body&&c.body.emit("error",e)};if(s&&s.aborted)return void u();const l=function(){u(),f()},p=o(a);let d;function f(){p.abort(),s&&s.removeEventListener("abort",l),clearTimeout(d)}s&&s.addEventListener("abort",l),i.timeout&&p.once("socket",(function(e){d=setTimeout((function(){n(new Xe(`network timeout at: ${i.url}`,"request-timeout")),f()}),i.timeout)})),p.on("error",(function(e){n(new Xe(`request to ${