UNPKG

printify-node-api

Version:

A small API implementation to communicate with your printify shops

2 lines 672 kB
/*! For license information please see index.js.LICENSE.txt */ (()=>{var e={9078:(e,t,n)=>{"use strict";var a=n(159),i=n(983);function o(e){if(!(this instanceof o))return new o(e);this.headers=e.headers,this.negotiator=new a(e)}function r(e){return-1===e.indexOf("/")?i.lookup(e):e}function s(e){return"string"==typeof e}e.exports=o,o.prototype.type=o.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=new Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||0===t.length)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var a=t.map(r),i=this.negotiator.mediaTypes(a.filter(s))[0];return!!i&&t[a.indexOf(i)]},o.prototype.encoding=o.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=new Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return t&&0!==t.length?this.negotiator.encodings(t)[0]||!1:this.negotiator.encodings()},o.prototype.charset=o.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=new Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return t&&0!==t.length?this.negotiator.charsets(t)[0]||!1:this.negotiator.charsets()},o.prototype.lang=o.prototype.langs=o.prototype.language=o.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=new Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return t&&0!==t.length?this.negotiator.languages(t)[0]||!1:this.negotiator.languages()}},2521:e=>{"use strict";function t(e,n,a){for(var i=0;i<e.length;i++){var o=e[i];a>0&&Array.isArray(o)?t(o,n,a-1):n.push(o)}return n}function n(e,t){for(var a=0;a<e.length;a++){var i=e[a];Array.isArray(i)?n(i,t):t.push(i)}return t}e.exports=function(e,a){return null==a?n(e,[]):t(e,[],a)}},9118:(e,t,n)=>{e.exports={parallel:n(9162),serial:n(1357),serialOrdered:n(9087)}},7651:e=>{function t(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}e.exports=function(e){Object.keys(e.jobs).forEach(t.bind(e)),e.jobs={}}},5912:(e,t,n)=>{var a=n(9265);e.exports=function(e){var t=!1;return a((function(){t=!0})),function(n,i){t?e(n,i):a((function(){e(n,i)}))}}},9265:e=>{e.exports=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)}},7594:(e,t,n)=>{var a=n(5912),i=n(7651);e.exports=function(e,t,n,o){var r=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[r]=function(e,t,n,i){return 2==e.length?e(n,a(i)):e(n,t,a(i))}(t,r,e[r],(function(e,t){r in n.jobs&&(delete n.jobs[r],e?i(n):n.results[r]=t,o(e,n.results))}))}},4528:e=>{e.exports=function(e,t){var n=!Array.isArray(e),a={index:0,keyedList:n||t?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};return t&&a.keyedList.sort(n?t:function(n,a){return t(e[n],e[a])}),a}},5353:(e,t,n)=>{var a=n(7651),i=n(5912);e.exports=function(e){Object.keys(this.jobs).length&&(this.index=this.size,a(this),i(e)(null,this.results))}},9162:(e,t,n)=>{var a=n(7594),i=n(4528),o=n(5353);e.exports=function(e,t,n){for(var r=i(e);r.index<(r.keyedList||e).length;)a(e,t,r,(function(e,t){e?n(e,t):0!==Object.keys(r.jobs).length||n(null,r.results)})),r.index++;return o.bind(r,n)}},1357:(e,t,n)=>{var a=n(9087);e.exports=function(e,t,n){return a(e,t,null,n)}},9087:(e,t,n)=>{var a=n(7594),i=n(4528),o=n(5353);function r(e,t){return e<t?-1:e>t?1:0}e.exports=function(e,t,n,r){var s=i(e,n);return a(e,t,s,(function n(i,o){i?r(i,o):(s.index++,s.index<(s.keyedList||e).length?a(e,t,s,n):r(null,s.results))})),o.bind(s,r)},e.exports.ascending=r,e.exports.descending=function(e,t){return-1*r(e,t)}},9045:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,n){if("object"!==t(e)||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var i=a.call(e,"string");if("object"!==t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===t(o)?o:String(o)),i)}var o}var a=function(){function e(t,n,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t,this.endpoint=n,this.shopId=a}var t,a;return t=e,(a=[{key:"create",value:function(e){return this.client.post("shops/".concat(this.shopId,"/").concat(this.endpoint,".json"),e)}},{key:"getAll",value:function(){return this.client.get("shops/".concat(this.shopId,"/").concat(this.endpoint,".json"))}},{key:"getById",value:function(e){return this.client.get("shops/".concat(this.shopId,"/").concat(this.endpoint,"/").concat(e,".json"))}},{key:"update",value:function(e,t){return this.client.put("shops/".concat(this.shopId,"/").concat(this.endpoint,"/").concat(e,".json"),t)}},{key:"delete",value:function(e){return this.client.delete("shops/".concat(this.shopId,"/").concat(this.endpoint,"/").concat(e,".json"))}}])&&n(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.exports=a},7150:(e,t,n)=>{function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==a(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==a(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===a(o)?o:String(o)),i)}var o}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}var s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}(l,e);var t,n,s,c,p=(s=l,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=r(s);if(c){var n=r(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function l(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),p.call(this,e,"orders",t)}return t=l,(n=[{key:"sendToProduction",value:function(e){return this.client.post("shops/".concat(this.shopId,"/orders/").concat(e,"/send_to_production.json"))}},{key:"calculateShipping",value:function(e){return this.client.post("shops/".concat(this.shopId,"/orders/shipping.json"),e)}},{key:"cancel",value:function(e){return this.client.post("shops/".concat(this.shopId,"/orders/").concat(e,"/cancel.json"))}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),l}(n(9045));e.exports=s},2079:(e,t,n)=>{function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==a(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==a(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===a(o)?o:String(o)),i)}var o}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function r(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}var c=n(2361).EventEmitter,p=n(6113).createHmac,l=n(9268).raw,u=n(3306),d=n(4176),f=n(7150),m=n(182),h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}(v,e);var t,n,a,c,h=(a=v,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=s(a);if(c){var n=s(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return r(this,e)});function v(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{version:"v1"};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,v);var a=v.prototype.controlledInstances.findIndex((function(t){return t.shopId===e}));if(-1!==a)return r(t,v.prototype.controlledInstances[a]);t=h.call(this),n.version||(n.version="v1"),t.instanceNonce=Math.random(),t.shopId=e,t.client=u.create({baseURL:"https://api.printify.com/".concat(n.version),headers:{Authorization:"Bearer ".concat(n.authKey)}}),t.products=new d(t.client,e),t.orders=new f(t.client,e),t.webhooks=new m(t.client,e);return t.registerWebhookEndpoint=function(e,a,i){var o;e.use(a,l({type:"application/json"})),e.post(a,(o=i,function(e,a,i){var r=e.headers["x-pfy-signature"],s=e.body,c=p("sha256",o,{encoding:"utf-8"});c.update(s,"utf-8");var l,u="sha256="+c.digest("hex");if(console.log(r.toString("hex")),console.log(u.toString("hex")),u!==r)return a.status(401).end();l=JSON.parse(s.toString("utf-8")),"debug"===n.mode&&console.debug("Emit event ".concat(l.type)),t.emit(l.type,l),a.status(200).end()}))},r(t)}return t=v,n=[{key:"getInstance",value:function(e,t){var n=v.prototype.controlledInstances.findIndex((function(t){return t.shopId===e}));if(-1===n){var a=new v(e,t);return v.prototype.controlledInstances.push(a),a}return v.prototype.controlledInstances[n]}}],null&&i(t.prototype,null),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),v}(c);h.prototype.controlledInstances=[],e.exports=h},4176:(e,t,n)=>{function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==a(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==a(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===a(o)?o:String(o)),i)}var o}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}var s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}(l,e);var t,n,s,c,p=(s=l,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=r(s);if(c){var n=r(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function l(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),p.call(this,e,"products",t)}return t=l,(n=[{key:"publish",value:function(e,t,n){var a=this;this.client.post("shops/".concat(this.shopId,"/").concat(this.endpoint,"/").concat(e,"/publish.json"),t).then((function(e){return e.json()})).then((function(t){return 200===res.status?a.client("shops/".concat(a.shopId,"/").concat(a.endpoint,"/").concat(e,"/publishing_succeeded.json"),{external:{id:e,handle:n}}):a.client("shops/".concat(a.shopId,"/").concat(a.endpoint,"/").concat(e,"/publishing_failed.json"),{reason:"Server responded with status ".concat(res.status)})})).catch((function(t){return a.client("shops/".concat(a.shopId,"/").concat(a.endpoint,"/").concat(e,"/publishing_failed.json"),{reason:"".concat(t.message)})}))}},{key:"unpublish",value:function(e){return this.client("shops/".concat(this.shopId,"/products/").concat(e,"/unpublish.json"))}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),l}(n(9045));e.exports=s},182:(e,t,n)=>{function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(c,e);var t,n,r,s=(n=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=o(n);if(r){var i=o(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function c(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),s.call(this,e,"webhooks",t)}return t=c,Object.defineProperty(t,"prototype",{writable:!1}),t}(n(9045));e.exports=r},5579:(e,t,n)=>{var a=n(2079);e.exports=a},46:(e,t,n)=>{"use strict";var a=n(412)("body-parser"),i=Object.create(null);function o(e){return function(){return function(e){var t=i[e];if(void 0!==t)return t;switch(e){case"json":t=n(6035);break;case"raw":t=n(187);break;case"text":t=n(6560);break;case"urlencoded":t=n(4861)}return i[e]=t}(e)}}t=e.exports=a.function((function(e){var n=Object.create(e||null,{type:{configurable:!0,enumerable:!0,value:void 0,writable:!0}}),a=t.urlencoded(n),i=t.json(n);return function(e,t,n){i(e,t,(function(i){if(i)return n(i);a(e,t,n)}))}}),"bodyParser: use individual json/urlencoded middlewares"),Object.defineProperty(t,"json",{configurable:!0,enumerable:!0,get:o("json")}),Object.defineProperty(t,"raw",{configurable:!0,enumerable:!0,get:o("raw")}),Object.defineProperty(t,"text",{configurable:!0,enumerable:!0,get:o("text")}),Object.defineProperty(t,"urlencoded",{configurable:!0,enumerable:!0,get:o("urlencoded")})},3211:(e,t,n)=>{"use strict";var a=n(9009),i=n(6149),o=n(1045),r=n(4914),s=n(338),c=n(8170),p=n(9796);e.exports=function(e,t,n,l,u,d){var f,m,h=d;e._body=!0;var v=null!==h.encoding?h.encoding:null,x=h.verify;try{m=function(e,t,n){var i,o=(e.headers["content-encoding"]||"identity").toLowerCase(),r=e.headers["content-length"];if(t('content-encoding "%s"',o),!1===n&&"identity"!==o)throw a(415,"content encoding unsupported",{encoding:o,type:"encoding.unsupported"});switch(o){case"deflate":i=p.createInflate(),t("inflate body"),e.pipe(i);break;case"gzip":i=p.createGunzip(),t("gunzip body"),e.pipe(i);break;case"identity":(i=e).length=r;break;default:throw a(415,'unsupported content encoding "'+o+'"',{encoding:o,type:"encoding.unsupported"})}return i}(e,u,h.inflate),f=m.length,m.length=void 0}catch(e){return n(e)}if(h.length=f,h.encoding=x?null:v,null===h.encoding&&null!==v&&!r.encodingExists(v))return n(a(415,'unsupported charset "'+v.toUpperCase()+'"',{charset:v.toLowerCase(),type:"charset.unsupported"}));u("read body"),o(m,h,(function(o,p){var d;if(o)return d="encoding.unsupported"===o.type?a(415,'unsupported charset "'+v.toUpperCase()+'"',{charset:v.toLowerCase(),type:"charset.unsupported"}):a(400,o),m!==e&&(c(e),i(m,!0)),void function(e,t){s.isFinished(e)?t():(s(e,t),e.resume())}(e,(function(){n(a(400,d))}));if(x)try{u("verify body"),x(e,t,p,v)}catch(e){return void n(a(403,e,{body:p,type:e.type||"entity.verify.failed"}))}var f=p;try{u("parse body"),f="string"!=typeof p&&null!==v?r.decode(p,v):p,e.body=l(f)}catch(e){return void n(a(400,e,{body:f,type:e.type||"entity.parse.failed"}))}n()}))}},6035:(e,t,n)=>{"use strict";var a=n(9830),i=n(7811),o=n(9009),r=n(5158)("body-parser:json"),s=n(3211),c=n(273);e.exports=function(e){var t=e||{},n="number"!=typeof t.limit?a.parse(t.limit||"100kb"):t.limit,u=!1!==t.inflate,d=t.reviver,f=!1!==t.strict,m=t.type||"application/json",h=t.verify||!1;if(!1!==h&&"function"!=typeof h)throw new TypeError("option verify must be function");var v="function"!=typeof m?function(e){return function(t){return Boolean(c(t,e))}}(m):m;function x(e){if(0===e.length)return{};if(f){var t=(n=e,(a=p.exec(n))?a[1]:void 0);if("{"!==t&&"["!==t)throw r("strict violation"),function(e,t){var n=e.indexOf(t),a=-1!==n?e.substring(0,n)+"#":"";try{throw JSON.parse(a),new SyntaxError("strict violation")}catch(e){return l(e,{message:e.message.replace("#",t),stack:e.stack})}}(e,t)}var n,a;try{return r("parse json"),JSON.parse(e,d)}catch(e){throw l(e,{message:e.message,stack:e.stack})}}return function(e,t,a){if(e._body)return r("body already parsed"),void a();if(e.body=e.body||{},!c.hasBody(e))return r("skip empty body"),void a();if(r("content-type %j",e.headers["content-type"]),!v(e))return r("skip parsing"),void a();var p=function(e){try{return(i.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||"utf-8";if("utf-"!==p.slice(0,4))return r("invalid charset"),void a(o(415,'unsupported charset "'+p.toUpperCase()+'"',{charset:p,type:"charset.unsupported"}));s(e,t,a,x,r,{encoding:p,inflate:u,limit:n,verify:h})}};var p=/^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/;function l(e,t){for(var n=Object.getOwnPropertyNames(e),a=0;a<n.length;a++){var i=n[a];"stack"!==i&&"message"!==i&&delete e[i]}return e.stack=t.stack.replace(e.message,t.message),e.message=t.message,e}},187:(e,t,n)=>{"use strict";var a=n(9830),i=n(5158)("body-parser:raw"),o=n(3211),r=n(273);e.exports=function(e){var t=e||{},n=!1!==t.inflate,s="number"!=typeof t.limit?a.parse(t.limit||"100kb"):t.limit,c=t.type||"application/octet-stream",p=t.verify||!1;if(!1!==p&&"function"!=typeof p)throw new TypeError("option verify must be function");var l="function"!=typeof c?function(e){return function(t){return Boolean(r(t,e))}}(c):c;function u(e){return e}return function(e,t,a){return e._body?(i("body already parsed"),void a()):(e.body=e.body||{},r.hasBody(e)?(i("content-type %j",e.headers["content-type"]),l(e)?void o(e,t,a,u,i,{encoding:null,inflate:n,limit:s,verify:p}):(i("skip parsing"),void a())):(i("skip empty body"),void a()))}}},6560:(e,t,n)=>{"use strict";var a=n(9830),i=n(7811),o=n(5158)("body-parser:text"),r=n(3211),s=n(273);e.exports=function(e){var t=e||{},n=t.defaultCharset||"utf-8",c=!1!==t.inflate,p="number"!=typeof t.limit?a.parse(t.limit||"100kb"):t.limit,l=t.type||"text/plain",u=t.verify||!1;if(!1!==u&&"function"!=typeof u)throw new TypeError("option verify must be function");var d="function"!=typeof l?function(e){return function(t){return Boolean(s(t,e))}}(l):l;function f(e){return e}return function(e,t,a){if(e._body)return o("body already parsed"),void a();if(e.body=e.body||{},!s.hasBody(e))return o("skip empty body"),void a();if(o("content-type %j",e.headers["content-type"]),!d(e))return o("skip parsing"),void a();var l=function(e){try{return(i.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||n;r(e,t,a,f,o,{encoding:l,inflate:c,limit:p,verify:u})}}},4861:(e,t,n)=>{"use strict";var a=n(9830),i=n(7811),o=n(9009),r=n(5158)("body-parser:urlencoded"),s=n(412)("body-parser"),c=n(3211),p=n(273);e.exports=function(e){var t=e||{};void 0===t.extended&&s("undefined extended: provide extended option");var n=!1!==t.extended,l=!1!==t.inflate,f="number"!=typeof t.limit?a.parse(t.limit||"100kb"):t.limit,m=t.type||"application/x-www-form-urlencoded",h=t.verify||!1;if(!1!==h&&"function"!=typeof h)throw new TypeError("option verify must be function");var v=n?function(e){var t=void 0!==e.parameterLimit?e.parameterLimit:1e3,n=d("qs");if(isNaN(t)||t<1)throw new TypeError("option parameterLimit must be a positive number");return isFinite(t)&&(t|=0),function(e){var a=u(e,t);if(void 0===a)throw r("too many parameters"),o(413,"too many parameters",{type:"parameters.too.many"});var i=Math.max(100,a);return r("parse extended urlencoding"),n(e,{allowPrototypes:!0,arrayLimit:i,depth:1/0,parameterLimit:t})}}(t):function(e){var t=void 0!==e.parameterLimit?e.parameterLimit:1e3,n=d("querystring");if(isNaN(t)||t<1)throw new TypeError("option parameterLimit must be a positive number");return isFinite(t)&&(t|=0),function(e){if(void 0===u(e,t))throw r("too many parameters"),o(413,"too many parameters",{type:"parameters.too.many"});return r("parse urlencoding"),n(e,void 0,void 0,{maxKeys:t})}}(t),x="function"!=typeof m?function(e){return function(t){return Boolean(p(t,e))}}(m):m;function b(e){return e.length?v(e):{}}return function(e,t,n){if(e._body)return r("body already parsed"),void n();if(e.body=e.body||{},!p.hasBody(e))return r("skip empty body"),void n();if(r("content-type %j",e.headers["content-type"]),!x(e))return r("skip parsing"),void n();var a=function(e){try{return(i.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||"utf-8";if("utf-8"!==a)return r("invalid charset"),void n(o(415,'unsupported charset "'+a.toUpperCase()+'"',{charset:a,type:"charset.unsupported"}));c(e,t,n,b,r,{debug:r,encoding:a,inflate:l,limit:f,verify:h})}};var l=Object.create(null);function u(e,t){for(var n=0,a=0;-1!==(a=e.indexOf("&",a));)if(a++,++n===t)return;return n}function d(e){var t=l[e];if(void 0!==t)return t.parse;switch(e){case"qs":t=n(129);break;case"querystring":t=n(3477)}return l[e]=t,t.parse}},9830:e=>{"use strict";e.exports=function(e,t){return"string"==typeof e?r(e):"number"==typeof e?o(e,t):null},e.exports.format=o,e.exports.parse=r;var t=/\B(?=(\d{3})+(?!\d))/g,n=/(?:\.0*|(\.[^0]+)0+)$/,a={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},i=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function o(e,i){if(!Number.isFinite(e))return null;var o=Math.abs(e),r=i&&i.thousandsSeparator||"",s=i&&i.unitSeparator||"",c=i&&void 0!==i.decimalPlaces?i.decimalPlaces:2,p=Boolean(i&&i.fixedDecimals),l=i&&i.unit||"";l&&a[l.toLowerCase()]||(l=o>=a.pb?"PB":o>=a.tb?"TB":o>=a.gb?"GB":o>=a.mb?"MB":o>=a.kb?"KB":"B");var u=(e/a[l.toLowerCase()]).toFixed(c);return p||(u=u.replace(n,"$1")),r&&(u=u.split(".").map((function(e,n){return 0===n?e.replace(t,r):e})).join(".")),u+s+l}function r(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,n=i.exec(e),o="b";return n?(t=parseFloat(n[1]),o=n[4].toLowerCase()):(t=parseInt(e,10),o="b"),isNaN(t)?null:Math.floor(a[o]*t)}},1924:(e,t,n)=>{"use strict";var a=n(210),i=n(5559),o=i(a("String.prototype.indexOf"));e.exports=function(e,t){var n=a(e,!!t);return"function"==typeof n&&o(e,".prototype.")>-1?i(n):n}},5559:(e,t,n)=>{"use strict";var a=n(8612),i=n(210),o=i("%Function.prototype.apply%"),r=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||a.call(r,o),c=i("%Object.getOwnPropertyDescriptor%",!0),p=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(p)try{p({},"a",{value:1})}catch(e){p=null}e.exports=function(e){var t=s(a,r,arguments);return c&&p&&c(t,"length").configurable&&p(t,"length",{value:1+l(0,e.length-(arguments.length-1))}),t};var u=function(){return s(a,o,arguments)};p?p(e.exports,"apply",{value:u}):e.exports.apply=u},9779:(e,t,n)=>{var a=n(3837),i=n(2781).Stream,o=n(3463);function r(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2097152,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}e.exports=r,a.inherits(r,i),r.create=function(e){var t=new this;for(var n in e=e||{})t[n]=e[n];return t},r.isStreamLike=function(e){return"function"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Buffer.isBuffer(e)},r.prototype.append=function(e){if(r.isStreamLike(e)){if(!(e instanceof o)){var t=o.create(e,{maxDataSize:1/0,pauseStream:this.pauseStreams});e.on("data",this._checkDataSize.bind(this)),e=t}this._handleErrors(e),this.pauseStreams&&e.pause()}return this._streams.push(e),this},r.prototype.pipe=function(e,t){return i.prototype.pipe.call(this,e,t),this.resume(),e},r.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop)this._pendingNext=!0;else{this._insideLoop=!0;try{do{this._pendingNext=!1,this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=!1}}},r.prototype._realGetNext=function(){var e=this._streams.shift();void 0!==e?"function"==typeof e?e(function(e){r.isStreamLike(e)&&(e.on("data",this._checkDataSize.bind(this)),this._handleErrors(e)),this._pipeNext(e)}.bind(this)):this._pipeNext(e):this.end()},r.prototype._pipeNext=function(e){if(this._currentStream=e,r.isStreamLike(e))return e.on("end",this._getNext.bind(this)),void e.pipe(this,{end:!1});var t=e;this.write(t),this._getNext()},r.prototype._handleErrors=function(e){var t=this;e.on("error",(function(e){t._emitError(e)}))},r.prototype.write=function(e){this.emit("data",e)},r.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.pause&&this._currentStream.pause(),this.emit("pause"))},r.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&"function"==typeof this._currentStream.resume&&this._currentStream.resume(),this.emit("resume")},r.prototype.end=function(){this._reset(),this.emit("end")},r.prototype.destroy=function(){this._reset(),this.emit("close")},r.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null},r.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(e))}},r.prototype._updateDataSize=function(){this.dataSize=0;var e=this;this._streams.forEach((function(t){t.dataSize&&(e.dataSize+=t.dataSize)})),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)},r.prototype._emitError=function(e){this._reset(),this.emit("error",e)}},7389:(e,t,n)=>{"use strict";e.exports=function(e,t){var n=t||{},i=n.type||"attachment",o=function(e,t){if(void 0!==e){var n={};if("string"!=typeof e)throw new TypeError("filename must be a string");if(void 0===t&&(t=!0),"string"!=typeof t&&"boolean"!=typeof t)throw new TypeError("fallback must be a string or boolean");if("string"==typeof t&&c.test(t))throw new TypeError("fallback must be ISO-8859-1 string");var i=a(e),o=d.test(i),s="string"!=typeof t?t&&x(i):a(t),p="string"==typeof s&&s!==i;return(p||!o||r.test(i))&&(n["filename*"]=i),(o||p)&&(n.filename=p?s:i),n}}(e,n.fallback);return function(e){var t=e.parameters,n=e.type;if(!n||"string"!=typeof n||!f.test(n))throw new TypeError("invalid type");var a=String(n).toLowerCase();if(t&&"object"==typeof t)for(var i,o=Object.keys(t).sort(),r=0;r<o.length;r++){var s="*"===(i=o[r]).substr(-1)?w(t[i]):y(t[i]);a+="; "+i+"="+s}return a}(new k(i,o))},e.exports.parse=function(e){if(!e||"string"!=typeof e)throw new TypeError("argument string is required");var t=h.exec(e);if(!t)throw new TypeError("invalid type format");var n,a,i=t[0].length,o=t[1].toLowerCase(),r=[],s={};for(i=u.lastIndex=";"===t[0].substr(-1)?i-1:i;t=u.exec(e);){if(t.index!==i)throw new TypeError("invalid parameter format");if(i+=t[0].length,n=t[1].toLowerCase(),a=t[2],-1!==r.indexOf(n))throw new TypeError("invalid duplicate parameter");r.push(n),n.indexOf("*")+1!==n.length?"string"!=typeof s[n]&&('"'===a[0]&&(a=a.substr(1,a.length-2).replace(p,"$1")),s[n]=a):(n=n.slice(0,-1),a=v(a),s[n]=a)}if(-1!==i&&i!==e.length)throw new TypeError("invalid parameter format");return new k(o,s)};var a=n(1017).basename,i=n(9509).Buffer,o=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,r=/%[0-9A-Fa-f]{2}/,s=/%([0-9A-Fa-f]{2})/g,c=/[^\x20-\x7e\xa0-\xff]/g,p=/\\([\u0000-\u007f])/g,l=/([\\"])/g,u=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,d=/^[\x20-\x7e\x80-\xff]+$/,f=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,m=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,h=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function v(e){var t=m.exec(e);if(!t)throw new TypeError("invalid extended field value");var n,a=t[1].toLowerCase(),o=t[2].replace(s,b);switch(a){case"iso-8859-1":n=x(o);break;case"utf-8":n=i.from(o,"binary").toString("utf8");break;default:throw new TypeError("unsupported charset in extended field")}return n}function x(e){return String(e).replace(c,"?")}function b(e,t){return String.fromCharCode(parseInt(t,16))}function g(e){return"%"+String(e).charCodeAt(0).toString(16).toUpperCase()}function y(e){return'"'+String(e).replace(l,"\\$1")+'"'}function w(e){var t=String(e);return"UTF-8''"+encodeURIComponent(t).replace(o,g)}function k(e,t){this.type=e,this.parameters=t}},7811:(e,t)=>{"use strict";var n=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,a=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,i=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,o=/\\([\u000b\u0020-\u00ff])/g,r=/([\\"])/g,s=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function c(e){var t=String(e);if(i.test(t))return t;if(t.length>0&&!a.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(r,"\\$1")+'"'}function p(e){this.parameters=Object.create(null),this.type=e}t.format=function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,n=e.type;if(!n||!s.test(n))throw new TypeError("invalid type");var a=n;if(t&&"object"==typeof t)for(var o,r=Object.keys(t).sort(),p=0;p<r.length;p++){if(o=r[p],!i.test(o))throw new TypeError("invalid parameter name");a+="; "+o+"="+c(t[o])}return a},t.parse=function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;if("function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]),"string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var a=t.indexOf(";"),i=-1!==a?t.slice(0,a).trim():t.trim();if(!s.test(i))throw new TypeError("invalid media type");var r=new p(i.toLowerCase());if(-1!==a){var c,l,u;for(n.lastIndex=a;l=n.exec(t);){if(l.index!==a)throw new TypeError("invalid parameter format");a+=l[0].length,c=l[1].toLowerCase(),34===(u=l[2]).charCodeAt(0)&&-1!==(u=u.slice(1,-1)).indexOf("\\")&&(u=u.replace(o,"$1")),r.parameters[c]=u}if(a!==t.length)throw new TypeError("invalid parameter format")}return r}},1365:(e,t,n)=>{var a=n(6113);function i(e){return a.createHash("sha1").update(e).digest("hex")}t.sign=function(e,t){if("string"!=typeof e)throw new TypeError("Cookie value must be provided as a string.");if("string"!=typeof t)throw new TypeError("Secret string must be provided.");return e+"."+a.createHmac("sha256",t).update(e).digest("base64").replace(/\=+$/,"")},t.unsign=function(e,n){if("string"!=typeof e)throw new TypeError("Signed cookie string must be provided.");if("string"!=typeof n)throw new TypeError("Secret string must be provided.");var a=e.slice(0,e.lastIndexOf("."));return i(t.sign(a,n))==i(e)&&a}},6489:(e,t)=>{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},a=(t||{}).decode||i,o=0;o<e.length;){var s=e.indexOf("=",o);if(-1===s)break;var c=e.indexOf(";",o);if(-1===c)c=e.length;else if(c<s){o=e.lastIndexOf(";",s-1)+1;continue}var p=e.slice(o,s).trim();if(void 0===n[p]){var l=e.slice(s+1,c).trim();34===l.charCodeAt(0)&&(l=l.slice(1,-1)),n[p]=r(l,a)}o=c+1}return n},t.serialize=function(e,t,i){var r=i||{},s=r.encode||o;if("function"!=typeof s)throw new TypeError("option encode is invalid");if(!a.test(e))throw new TypeError("argument name is invalid");var c=s(t);if(c&&!a.test(c))throw new TypeError("argument val is invalid");var p=e+"="+c;if(null!=r.maxAge){var l=r.maxAge-0;if(isNaN(l)||!isFinite(l))throw new TypeError("option maxAge is invalid");p+="; Max-Age="+Math.floor(l)}if(r.domain){if(!a.test(r.domain))throw new TypeError("option domain is invalid");p+="; Domain="+r.domain}if(r.path){if(!a.test(r.path))throw new TypeError("option path is invalid");p+="; Path="+r.path}if(r.expires){var u=r.expires;if(!function(e){return"[object Date]"===n.call(e)||e instanceof Date}(u)||isNaN(u.valueOf()))throw new TypeError("option expires is invalid");p+="; Expires="+u.toUTCString()}if(r.httpOnly&&(p+="; HttpOnly"),r.secure&&(p+="; Secure"),r.priority)switch("string"==typeof r.priority?r.priority.toLowerCase():r.priority){case"low":p+="; Priority=Low";break;case"medium":p+="; Priority=Medium";break;case"high":p+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}if(r.sameSite)switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:p+="; SameSite=Strict";break;case"lax":p+="; SameSite=Lax";break;case"strict":p+="; SameSite=Strict";break;case"none":p+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return p};var n=Object.prototype.toString,a=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function i(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function o(e){return encodeURIComponent(e)}function r(e,t){try{return t(e)}catch(t){return e}}},1227:(e,t,n)=>{function a(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=n(1658)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var a="color: "+this.color;e.splice(1,0,a,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))})),e.splice(o,0,a)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=a,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(a())},1658:(e,t,n)=>{var a;function i(e){function n(){if(n.enabled){var e=n,i=+new Date,o=i-(a||i);e.diff=o,e.prev=a,e.curr=i,a=i;for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];r[0]=t.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var c=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(n,a){if("%%"===n)return n;c++;var i=t.formatters[a];if("function"==typeof i){var o=r[c];n=i.call(e,o),r.splice(c,1),c--}return n})),t.formatArgs.call(e,r),(n.log||t.log||console.log.bind(console)).apply(e,r)}}return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=function(e){var n,a=0;for(n in e)a=(a<<5)-a+e.charCodeAt(n),a|=0;return t.colors[Math.abs(a)%t.colors.length]}(e),"function"==typeof t.init&&t.init(n),n}(t=e.exports=i.debug=i.default=i).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e),t.names=[],t.skips=[];for(var n=("string"==typeof e?e:"").split(/[\s,]+/),a=n.length,i=0;i<a;i++)n[i]&&("-"===(e=n[i].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){var n,a;for(n=0,a=t.skips.length;n<a;n++)if(t.skips[n].test(e))return!1;for(n=0,a=t.names.length;n<a;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(7824),t.names=[],t.skips=[],t.formatters={}},5158:(e,t,n)=>{"undefined"!=typeof process&&"renderer"===process.type?e.exports=n(1227):e.exports=n(39)},39:(e,t,n)=>{var a=n(6224),i=n(3837);(t=e.exports=n(1658)).init=function(e){e.inspectOpts={};for(var n=Object.keys(t.inspectOpts),a=0;a<n.length;a++)e.inspectOpts[n[a]]=t.inspectOpts[n[a]]},t.log=function(){return r.write(i.format.apply(i,arguments)+"\n")},t.formatArgs=function(e){var n=this.namespace;if(this.useColors){var a=this.color,i=" [3"+a+";1m"+n+" ";e[0]=i+e[0].split("\n").join("\n"+i),e.push("[3"+a+"m+"+t.humanize(this.diff)+"")}else e[0]=(new Date).toUTCString()+" "+n+" "+e[0]},t.save=function(e){null==e?delete process.env.DEBUG:process.env.DEBUG=e},t.load=s,t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):a.isatty(o)},t.colors=[6,2,3,4,5,1],t.inspectOpts=Object.keys(process.env).filter((function(e){return/^debug_/i.test(e)})).reduce((function(e,t){var n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()})),a=process.env[t];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[n]=a,e}),{});var o=parseInt(process.env.DEBUG_FD,10)||2;1!==o&&2!==o&&i.deprecate((function(){}),"except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();var r=1===o?process.stdout:2===o?process.stderr:function(e){var t;switch(process.binding("tty_wrap").guessHandleType(e)){case"TTY":(t=new a.WriteStream(e))._type="tty",t._handle&&t._handle.unref&&t._handle.unref();break;case"FILE":(t=new(n(7147).SyncWriteStream)(e,{autoClose:!1}))._type="fs";break;case"PIPE":case"TCP":(t=new(n(1808).Socket)({fd:e,readable:!1,writable:!0})).readable=!1,t.read=null,t._type="pipe",t._handle&&t._handle.unref&&t._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return t.fd=e,t._isStdio=!0,t}(o);function s(){return process.env.DEBUG}t.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((function(e){return e.trim()})).join(" ")},t.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)},t.enable(s())},3463:(e,t,n)=>{var a=n(2781).Stream,i=n(3837);function o(){this.source=null,this.dataSize=0,this.maxDataSize=1048576,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}e.exports=o,i.inherits(o,a),o.create=function(e,t){var n=new this;for(var a in t=t||{})n[a]=t[a];n.source=e;var i=e.emit;return e.emit=function(){return n._handleEmit(arguments),i.apply(e,arguments)},e.on("error",(function(){})),n.pauseStream&&e.pause(),n},Object.defineProperty(o.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}}),o.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)},o.prototype.resume=function(){this._released||this.release(),this.source.resume()},o.prototype.pause=function(){this.source.pause()},o.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(e){this.emit.apply(this,e)}.bind(this)),this._bufferedEvents=[]},o.prototype.pipe=function(){var e=a.prototype.pipe.apply(this,arguments);return this.resume(),e},o.prototype._handleEmit=function(e){this._released?this.emit.apply(this,e):("data"===e[0]&&(this.dataSize+=e[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(e))},o.prototype._checkIfMaxDataSizeExceeded=function(){if(!(this._maxDataSizeExceeded||this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var e="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(e))}}},412:(e,t,n)=>{var a=n(1017).relative;e.exports=function(e){if(!e)throw new TypeError("argument namespace is required");var t=c(f()[1])[0];function n(e){s.call(n,e)}return n._file=t,n._ignored=function(e){return!!process.noDeprecation||o(process.env.NO_DEPRECATION||"",e)}(e),n._namespace=e,n._traced=function(e){return!!process.traceDeprecation||o(process.env.TRACE_DEPRECATION||"",e)}(e),n._warned=Object.create(null),n.function=h,n.property=v,n};var i=process.cwd();function o(e,t){for(var n=e.split(/[ ,]+/),a=String(t).toLowerCase(),i=0;i<n.length;i++){var o=n[i];if(o&&("*"===o||o.toLowerCase()===a))return!0}return!1}function r(e){var t=this.name+": "+this.namespace;this.message&&(t+=" deprecated "+this.message);for(var n=0;n<e.length;n++)t+="\n at "+e[n].toString();return t}function s(e,t){var n,a,i=(a="deprecation",("function"!=typeof(n=process).listenerCount?n.listeners(a).length:n.listenerCount(a))>0);if(i||!this._ignored){var o,r,s,d,m=0,h=!1,v=f(),b=this._file;for(t?(d=t,(s=c(v[1])).name=d.name,b=s[0]):s=d=c(v[m=2]);m<v.length;m++)if((r=(o=c(v[m]))[0])===b)h=!0;else if(r===this._file)b=this._file;else if(h)break;var g=o?d.join(":")+"__"+o.join(":"):void 0;if(void 0===g||!(g in this._warned)){this._warned[g]=!0;var y=e;if(y||(y=s!==d&&s.name?p(s):p(d)),i){var w=x(this._namespace,y,v.slice(m));process.emit("deprecation",w)}else{var k=(process.stderr.isTTY?u:l).call(this,y,o,v.slice(m));process.stderr.write(k+"\n","utf8")}}}}function c(e){var t=e.getFileName()||"<anonymous>",n=e.getLineNumber(),a=e.getColumnNumber();e.isEval()&&(t=e.getEvalOrigin()+", "+t);var i=[t,n,a];return i.callSite=e,i.name=e.getFunctionName(),i}function p(e){var t=e.callSite,n=e.name;n||(n="<anonymous@"+d(e)+">");var a=t.getThis(),i=a&&t.getTypeName();return"Object"===i&&(i=void 0),"Function"===i&&(i=a.name||i),i&&t.getMethodName()?i+"."+n:n}function l(e,t,n){var a=(new Date).toUTCString()+" "+this._namespace+" deprecated "+e;if(this._traced){for(var i=0;i<n.length;i++)a+="\n at "+n[i].toString();return a}return t&&(a+=" at "+d(t)),a}function u(e,t,n){var a=""+this._namespace+" deprecated "+e+"";if(this._traced){for(var i=0;i<n.length;i++)a+="\n at "+n[i].toString()+"";return a}return t&&(a+=" "+d(t)+""),a}function d(e){return a(i,e[0])+":"+e[1]+":"+e[2]}function f(){var e=Error.stackTraceLimit,t={},n=Error.prepareStackTrace;Error.prepareStackTrace=m,Error.stackTraceLimit=Math.max(10,e),Error.captureStackTrace(t);var a=t.stack.slice(1);return Error.prepareStackTrace=n,Error.stackTraceLimit=e,a}function m(e,t){return t}function h(e,t){if("function"!=typeof e)throw new TypeError("argument fn must be a function");var n=function(e){for(var t="",n=0;n<e;n++)t+=", arg"+n;return t.substr(2)}(e.length),a=c(f()[1]);return a.name=e.name,new Function("fn","log","deprecate","message","site",'"use strict"\nreturn function ('+n+") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(e,s,this,t,a)}function v(e,t,n){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("argument obj must be object");var a=Object.getOwnPropertyDescriptor(e,t);if(!a)throw new TypeError("must call property on owner object");if(!a.configurable)throw new TypeError("property must be configurable");var i=this,o=c(f()[1]);o.name=t,"value"in a&&(a=function(e,t,n){var a=Object.getOwnPropertyDescriptor(e,t),i=a.value;return a.get=function(){return i},a.writable&&(a.set=function(e){return i=e}),delete a.value,delete a.writable,Object.defineProperty(e,t,a),a}(e,t));var r=a.get,p=a.set;"function"==typeof r&&(a.get=function(){return s.call(i,n,o),r.apply(this,arguments)}),"function"==typeof p&&(a.set=function(){return s.call(i,n,o),p.apply(this,arguments)}),Object.defineProperty(e,t,a)}function x(e,t,n){var a,i=new Error;return Object.defineProperty(i,"constructor",{value:x}),Object.defineProperty(i,"message",{configurable:!0,enumerable:!1,value:t,writable:!0}),Object.defineProperty(i,"name",{enumerable:!1,configurable:!0,value:"DeprecationError",writable:!0}),Object.defineProperty(i,"namespace",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(i,"stack",{configurable:!0,enumerable:!1,get:function(){return void 0!==a?a:a=r.call(this,n)},set:function(e){a=e}}),i}},6149:(e,t,n)=>{"use strict";var a=n(2361).EventEmitter,i=n(7147).ReadStream,o=n(2781),r=n(9796);function s(){}function c(){this._binding.clear()}function p(){"number"==typeof this.fd&&this.close()}e.exports=function(e,t){return!function(e){return e instanceof i}(e)?function(e){return e instanceof r.Gzip||e instanceof r.Gunzip||e instanceof r.Deflate||e instanceof r.DeflateRaw||e instanceof r.Inflate||e instanceof r.InflateRaw||e instanceof r.Unzip}(e)?function(e){"function"==typeof e.destroy?e._binding?(e.destroy(),e._processing?(e._needDrain=!0,e.once("drain",c)):e._binding.clear()):e._destroy&&e._destroy!==o.Transform.prototype._destroy?e.destroy():e._destroy&&"function"==typeof e.close?(e.destroyed=!0,e.close()):e.destroy():"function"==typeof e.close&&function(e){if(!0===e._hadError){var t=null===e._binding?"_binding":"_handle";e[t]={close:function(){this[t]=null}}}e.close()}(e)}(e):function(e){return e instanceof o&&"function"==typeof e.destroy}(e)&&e.destroy():function(e){e.destroy(),"function"==typeof e.close&&e.on("open",p)}(e),e instanceof a&&t&&(e.removeAllListeners("error"),e.addListener("error",s)),e}},4331:e=>{"use strict";function t(e,t){return function(n){for(var a=new Array(arguments.length),i="error"===e?n:null,o=0;o<a.length;o++)a[o]=arguments[o];t(i,this,e,a)}}e.exports=function(e,n){if(!Array.isArray(e))throw new TypeError("arg must be an array of [ee, events...] arrays");for(var a=[],i=0;i<e.length;i++){var o=e[i];if(!Array.isArray(o)||o.length<2)throw new TypeError("each array member must be [ee, events...]");for(var r=o[0],s=1;s<o.length;s++){var c=o[s],p=t(c,l);r.on(c,p),a.push({ee:r,event:c,fn:p})}}function l(){u(),n.apply(null,arguments)}function u(){for(var e,t=0;t<a.length;t++)(e=a[t]).ee.removeListener(e.event,e.fn)}function d(e){n=e}return d.cancel=u,d}},517:e=>{"use strict";e.exports=function(e){return String(e).replace(n,a).replace(t,encodeURI)};var t=/(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g,n=/(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g,a="$1�$2"},5573:e=>{"use strict";var t=/["'&<>]/;e.exports=function(e){var n,a=""+e,i=t.exec(a);if(!i)return a;var o="",r=0,s=0;for(r=i.index;r<a.length;r++){switch(a.charCodeAt(r)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 39:n="&#39;"