@atomicservice/ascf-toolkit 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _regenerator(){var p,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function r(e,t,n,r){var i,a,o,s,u,c,l,h,f,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(i=e,a=n,l=r||[],h=!1,f={p:c=0,n:0,v:p,a:d,f:d.bind(p,4),d:function(e,t){return o=e,s=0,u=p,f.n=t,g}},function(e,t,n){if(1<c)throw TypeError("Generator is already running");for(h&&1===t&&d(t,n),s=t,u=n;(_=s<2?p:u)||!h;){o||(s?s<3?(1<s&&(f.n=-1),d(s,u)):f.n=u:f.v=u);try{if(c=2,o){if(_=o[e=s?e:"next"]){if(!(_=_.call(o,u)))throw TypeError("iterator result is not an object");if(!_.done)return _;u=_.value,s<2&&(s=0)}else 1===s&&(_=o.return)&&_.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),s=1);o=p}else if((_=(h=f.n<0)?u:i.call(a,f))!==g)break}catch(e){o=p,s=1,u=e}finally{c=1}}return{value:_,done:h}}),!0),t;function d(e,t){for(s=e,u=t,_=0;!h&&c&&!n&&_<l.length;_++){var n,r=l[_],i=f.p,a=r[2];3<e?(n=a===t)&&(u=r[(s=r[4])?5:s=3],r[4]=r[5]=p):r[0]<=i&&((n=e<2&&i<r[1])?(s=0,f.v=t,f.n=r[1]):i<a&&(n=e<3||r[0]>t||a<t)&&(r[4]=e,r[5]=t,f.n=a,s=0))}if(n||1<e)return g;throw h=!0,t}}var g={};function m(){}function i(){}function a(){}var _=Object.getPrototypeOf,e=[][t]?_(_([][t]())):(_regeneratorDefine2(_={},t,function(){return this}),_),o=a.prototype=m.prototype=Object.create(e);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,n,"GeneratorFunction")),e.prototype=Object.create(o),e}return _regeneratorDefine2(o,"constructor",i.prototype=a),_regeneratorDefine2(a,"constructor",i),_regeneratorDefine2(a,n,i.displayName="GeneratorFunction"),_regeneratorDefine2(o),_regeneratorDefine2(o,n,"Generator"),_regeneratorDefine2(o,t,function(){return this}),_regeneratorDefine2(o,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:s}})()}function _regeneratorDefine2(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(_regeneratorDefine2=function(e,t,n,r){function i(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function _asyncToGenerator(s){return function(){var e=this,o=arguments;return new Promise(function(t,n){var r=s.apply(e,o);function i(e){asyncGeneratorStep(r,t,n,i,a,"next",e)}function a(e){asyncGeneratorStep(r,t,n,i,a,"throw",e)}i(void 0)})}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _callSuper(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}function _possibleConstructorReturn(e,t){if(t&&("object"==_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(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&&_setPrototypeOf(e,t)}function _wrapNativeSuper(e){var n="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(t,e)})(e)}function _construct(e,t,n){var r;return _isNativeReflectConstruct()?Reflect.construct.apply(null,arguments):((r=[null]).push.apply(r,t),t=new(e.bind.apply(e,r)),n&&_setPrototypeOf(t,n.prototype),t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var n,r,i,a,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return i=!(r=!0),{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){i=!0,n=e},f:function(){try{r||null==o.return||o.return()}finally{if(i)throw n}}};if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return o&&(e=o),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _typeof(e){return(_typeof="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})(e)}var Lt=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},Pe=Lt(function(c,e){function t(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}}function r(t,n,r,i){if(n&&"object"==_typeof(n)||"function"==typeof n){var a,o=_createForOfIteratorHelper(y(n));try{for(o.s();!(a=o.n()).done;)(()=>{var e=a.value;j.call(t,e)||e===r||s(t,e,{get:function(){return n[e]},enumerable:!(i=_(n,e))||i.enumerable})})()}catch(e){o.e(e)}finally{o.f()}}return t}function n(e,t,n){return n=null!=e?h(B(e)):{},r(!t&&e&&e.__esModule?n:s(n,"default",{value:e,enumerable:!0}),e)}var i,h=Object.create,s=Object.defineProperty,_=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,B=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,b=t(function(e){_inherits(i,_wrapNativeSuper(Error));var t=_createClass(i),n=(_inherits(r,t),_createClass(r));function r(e){return _classCallCheck(this,r),e=_callSuper(this,r,[1,"commander.invalidArgument",e]),Error.captureStackTrace(_assertThisInitialized(e),e.constructor),e.name=e.constructor.name,e}function i(e,t,n){return _classCallCheck(this,i),n=_callSuper(this,i,[n]),Error.captureStackTrace(_assertThisInitialized(n),n.constructor),n.name=n.constructor.name,n.code=t,n.exitCode=e,n.nestedError=void 0,n}e.CommanderError=t,e.InvalidArgumentError=n}),w=t(function(e){var r=b().InvalidArgumentError,t=_createClass(function e(t,n){switch(_classCallCheck(this,e),this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t}3<this._name.length&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))},[{key:"name",value:function(){return this._name}},{key:"_concatValue",value:function(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}},{key:"default",value:function(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}},{key:"argParser",value:function(e){return this.parseArg=e,this}},{key:"choices",value:function(e){var n=this;return this.argChoices=e.slice(),this.parseArg=function(e,t){if(n.argChoices.includes(e))return n.variadic?n._concatValue(e,t):e;throw new r("Allowed choices are ".concat(n.argChoices.join(", "),"."))},this}},{key:"argRequired",value:function(){return this.required=!0,this}},{key:"argOptional",value:function(){return this.required=!1,this}}]);e.Argument=t,e.humanReadableArgName=function(e){var t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}}),k=t(function(e){var n=w().humanReadableArgName,t=_createClass(function e(){_classCallCheck(this,e),this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1},[{key:"visibleCommands",value:function(e){var t,n,r=e.commands.filter(function(e){return!e._hidden});return e._hasImplicitHelpCommand()&&(n=(t=_slicedToArray(e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),3))[1],t=t[2],(n=e.createCommand(n).helpOption(!1)).description(e._helpCommandDescription),t&&n.arguments(t),r.push(n)),this.sortSubcommands&&r.sort(function(e,t){return e.name().localeCompare(t.name())}),r}},{key:"visibleOptions",value:function(e){var n,t=e.options.filter(function(e){return!e.hidden}),r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);return(r||i)&&(r=r?i?e.createOption(e._helpFlags,e._helpDescription):e.createOption(e._helpShortFlag,e._helpDescription):e.createOption(e._helpLongFlag,e._helpDescription),t.push(r)),this.sortOptions&&(n=function(e){return e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"")},t.sort(function(e,t){return n(e).localeCompare(n(t))})),t}},{key:"visibleArguments",value:function(t){return t._argsDescription&&t._args.forEach(function(e){e.description=e.description||t._argsDescription[e.name()]||""}),t._args.find(function(e){return e.description})?t._args:[]}},{key:"subcommandTerm",value:function(e){var t=e._args.map(function(e){return n(e)}).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}},{key:"optionTerm",value:function(e){return e.flags}},{key:"argumentTerm",value:function(e){return e.name()}},{key:"longestSubcommandTermLength",value:function(e,n){return n.visibleCommands(e).reduce(function(e,t){return Math.max(e,n.subcommandTerm(t).length)},0)}},{key:"longestOptionTermLength",value:function(e,n){return n.visibleOptions(e).reduce(function(e,t){return Math.max(e,n.optionTerm(t).length)},0)}},{key:"longestArgumentTermLength",value:function(e,n){return n.visibleArguments(e).reduce(function(e,t){return Math.max(e,n.argumentTerm(t).length)},0)}},{key:"commandUsage",value:function(e){for(var t=e._name,n=(e._aliases[0]&&(t=t+"|"+e._aliases[0]),""),r=e.parent;r;r=r.parent)n=r.name()+" "+n;return n+t+" "+e.usage()}},{key:"commandDescription",value:function(e){return e.description()}},{key:"subcommandDescription",value:function(e){return e.summary()||e.description()}},{key:"optionDescription",value:function(e){var t=[];return e.argChoices&&t.push("choices: ".concat(e.argChoices.map(function(e){return JSON.stringify(e)}).join(", "))),void 0!==e.defaultValue&&(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push("default: ".concat(e.defaultValueDescription||JSON.stringify(e.defaultValue))),void 0!==e.presetArg&&e.optional&&t.push("preset: ".concat(JSON.stringify(e.presetArg))),void 0!==e.envVar&&t.push("env: ".concat(e.envVar)),0<t.length?"".concat(e.description," (").concat(t.join(", "),")"):e.description}},{key:"argumentDescription",value:function(e){var t=[];return e.argChoices&&t.push("choices: ".concat(e.argChoices.map(function(e){return JSON.stringify(e)}).join(", "))),void 0!==e.defaultValue&&t.push("default: ".concat(e.defaultValueDescription||JSON.stringify(e.defaultValue))),0<t.length?(t="(".concat(t.join(", "),")"),e.description?"".concat(e.description," ").concat(t):t):e.description}},{key:"formatHelp",value:function(e,n){var r=n.padWidth(e,n),i=n.helpWidth||80;function t(e,t){return t?(t="".concat(e.padEnd(r+2)).concat(t),n.wrap(t,i-2,r+2)):e}function a(e){return e.join("\n").replace(/^/gm," ".repeat(2))}var o=["Usage: ".concat(n.commandUsage(e)),""],s=n.commandDescription(e),s=(0<s.length&&(o=o.concat([s,""])),n.visibleArguments(e).map(function(e){return t(n.argumentTerm(e),n.argumentDescription(e))})),s=(0<s.length&&(o=o.concat(["Arguments:",a(s),""])),n.visibleOptions(e).map(function(e){return t(n.optionTerm(e),n.optionDescription(e))})),s=(0<s.length&&(o=o.concat(["Options:",a(s),""])),n.visibleCommands(e).map(function(e){return t(n.subcommandTerm(e),n.subcommandDescription(e))}));return(o=0<s.length?o.concat(["Commands:",a(s),""]):o).join("\n")}},{key:"padWidth",value:function(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}},{key:"wrap",value:function(e,t,n){var r,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:40;return e.match(/[\n]\s+/)||(t=t-n)<i?e:(i=e.slice(0,n),e=e.slice(n),r=" ".repeat(n),n=new RegExp(".{1,"+(t-1)+"}([\\s​]|$)|[^\\s​]+?([\\s​]|$)","g"),i+(e.match(n)||[]).map(function(e,t){return"\n"===e.slice(-1)&&(e=e.slice(0,e.length-1)),(0<t?r:"")+e.trimRight()}).join("\n"))}}]);e.Help=t}),S=t(function(e){var r=b().InvalidArgumentError,t=_createClass(function e(t,n){_classCallCheck(this,e),this.flags=t,this.description=n||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;n=i(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0},[{key:"default",value:function(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}},{key:"preset",value:function(e){return this.presetArg=e,this}},{key:"conflicts",value:function(e){return this.conflictsWith=this.conflictsWith.concat(e),this}},{key:"implies",value:function(e){return this.implied=Object.assign(this.implied||{},e),this}},{key:"env",value:function(e){return this.envVar=e,this}},{key:"argParser",value:function(e){return this.parseArg=e,this}},{key:"makeOptionMandatory",value:function(){return this.mandatory=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"hideHelp",value:function(){return this.hidden=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"_concatValue",value:function(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}},{key:"choices",value:function(e){var n=this;return this.argChoices=e.slice(),this.parseArg=function(e,t){if(n.argChoices.includes(e))return n.variadic?n._concatValue(e,t):e;throw new r("Allowed choices are ".concat(n.argChoices.join(", "),"."))},this}},{key:"name",value:function(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}},{key:"attributeName",value:function(){return this.name().replace(/^no-/,"").split("-").reduce(function(e,t){return e+t[0].toUpperCase()+t.slice(1)})}},{key:"is",value:function(e){return this.short===e||this.long===e}},{key:"isBoolean",value:function(){return!this.required&&!this.optional&&!this.negate}}]),n=_createClass(function e(t){var n=this;_classCallCheck(this,e),this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(function(e){(e.negate?n.negativeOptions:n.positiveOptions).set(e.attributeName(),e)}),this.negativeOptions.forEach(function(e,t){n.positiveOptions.has(t)&&n.dualOptions.add(t)})},[{key:"valueFromOption",value:function(e,t){var n=t.attributeName();return!this.dualOptions.has(n)||(n=this.negativeOptions.get(n).presetArg,t.negate===((void 0!==n&&n)===e))}}]);function i(e){var t,e=e.split(/[ |,]+/);return 1<e.length&&!/^[[<]/.test(e[1])&&(t=e.shift()),e=e.shift(),!t&&/^-[^-]$/.test(e)&&(t=e,e=void 0),{shortFlag:t,longFlag:e}}e.Option=t,e.splitOptionFlags=i,e.DualOptions=n}),H=t(function(e){e.suggestSimilar=function(r,e){if(!e||0===e.length)return"";e=Array.from(new Set(e));var t=r.startsWith("--"),i=(t&&(r=r.slice(2),e=e.map(function(e){return e.slice(2)})),[]),a=3;return e.forEach(function(e){var t,n;e.length<=1||(t=((e,t)=>{if(3<Math.abs(e.length-t.length))return Math.max(e.length,t.length);for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(var a=1;a<=t.length;a++)for(var o=1;o<=e.length;o++){var s=1,s=e[o-1]===t[a-1]?0:1;n[o][a]=Math.min(n[o-1][a]+1,n[o][a-1]+1,n[o-1][a-1]+s),1<o&&1<a&&e[o-1]===t[a-2]&&e[o-2]===t[a-1]&&(n[o][a]=Math.min(n[o][a],n[o-2][a-2]+1))}return n[e.length][t.length]})(r,e),.4<((n=Math.max(r.length,e.length))-t)/n&&(t<a?(a=t,i=[e]):t===a&&i.push(e)))}),i.sort(function(e,t){return e.localeCompare(t)}),1<(i=t?i.map(function(e){return"--".concat(e)}):i).length?"\n(Did you mean one of ".concat(i.join(", "),"?)"):1===i.length?"\n(Did you mean ".concat(i[0],"?)"):""}}),U=t(function(e){var n,t=require("events").EventEmitter,l=require("child_process"),h=require("path"),f=require("fs"),d=require("process"),r=w(),i=r.Argument,a=r.humanReadableArgName,p=b().CommanderError,o=k().Help,r=S(),s=r.Option,u=r.splitOptionFlags,c=r.DualOptions,g=H().suggestSimilar,r=(_inherits(m,t),_createClass(m,[{key:"copyInheritedSettings",value:function(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}},{key:"command",value:function(e,t,n){"object"==_typeof(t)&&null!==t&&(n=t,t=null);var n=n||{},e=_slicedToArray(e.match(/([^ ]+) *(.*)/),3),r=e[1],e=e[2],r=this.createCommand(r);return t&&(r.description(t),r._executableHandler=!0),n.isDefault&&(this._defaultCommandName=r._name),r._hidden=!(!n.noHelp&&!n.hidden),r._executableFile=n.executableFile||null,e&&r.arguments(e),this.commands.push(r),r.parent=this,r.copyInheritedSettings(this),t?this:r}},{key:"createCommand",value:function(e){return new m(e)}},{key:"createHelp",value:function(){return Object.assign(new o,this.configureHelp())}},{key:"configureHelp",value:function(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}},{key:"configureOutput",value:function(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}},{key:"showHelpAfterError",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this._showHelpAfterError=e="string"!=typeof e?!!e:e,this}},{key:"showSuggestionAfterError",value:function(){return this._showSuggestionAfterError=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"addCommand",value:function(e,t){if(e._name)return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this;throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()")}},{key:"createArgument",value:function(e,t){return new i(e,t)}},{key:"argument",value:function(e,t,n,r){e=this.createArgument(e,t);return"function"==typeof n?e.default(r).argParser(n):e.default(n),this.addArgument(e),this}},{key:"arguments",value:function(e){var t=this;return e.split(/ +/).forEach(function(e){t.argument(e)}),this}},{key:"addArgument",value:function(e){var t=this._args.slice(-1)[0];if(t&&t.variadic)throw new Error("only the last argument can be variadic '".concat(t.name(),"'"));if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error("a default value for a required argument is never used: '".concat(e.name(),"'"));return this._args.push(e),this}},{key:"addHelpCommand",value:function(e,t){return!1===e?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,"string"==typeof e&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}},{key:"_hasImplicitHelpCommand",value:function(){return void 0===this._addImplicitHelpCommand?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}},{key:"hook",value:function(e,t){var n=["preSubcommand","preAction","postAction"];if(n.includes(e))return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this;throw new Error("Unexpected value for event passed to hook : '".concat(e,"'.\nExpecting one of '").concat(n.join("', '"),"'"))}},{key:"exitOverride",value:function(e){return this._exitCallback=e||function(e){if("commander.executeSubCommandAsync"!==e.code)throw e},this}},{key:"_exit",value:function(e,t,n){this._exitCallback&&this._exitCallback(new p(e,t,n)),d.exit(e)}},{key:"action",value:function(n){var r=this;return this._actionHandler=function(e){var t=r._args.length,e=e.slice(0,t);return r._storeOptionsAsProperties?e[t]=r:e[t]=r.opts(),e.push(r),n.apply(r,e)},this}},{key:"createOption",value:function(e,t){return new s(e,t)}},{key:"addOption",value:function(i){function n(e,t,n){null==e&&void 0!==i.presetArg&&(e=i.presetArg);var r=a.getOptionValue(o);if(null!==e&&i.parseArg)try{e=i.parseArg(e,r)}catch(e){throw"commander.invalidArgument"===e.code&&(t="".concat(t," ").concat(e.message),a.error(t,{exitCode:e.exitCode,code:e.code})),e}else null!==e&&i.variadic&&(e=i._concatValue(e,r));null==e&&(e=!i.negate&&(!(!i.isBoolean()&&!i.optional)||"")),a.setOptionValueWithSource(o,e,n)}var e,a=this,t=i.name(),o=i.attributeName();i.negate?(e=i.long.replace(/^--no-/,"--"),this._findOption(e)||this.setOptionValueWithSource(o,void 0===i.defaultValue||i.defaultValue,"default")):void 0!==i.defaultValue&&this.setOptionValueWithSource(o,i.defaultValue,"default"),this.options.push(i);return this.on("option:"+t,function(e){var t="error: option '".concat(i.flags,"' argument '").concat(e,"' is invalid.");n(e,t,"cli")}),i.envVar&&this.on("optionEnv:"+t,function(e){var t="error: option '".concat(i.flags,"' value '").concat(e,"' from env '").concat(i.envVar,"' is invalid.");n(e,t,"env")}),this}},{key:"_optionEx",value:function(e,t,n,r,i){if("object"==_typeof(t)&&t instanceof s)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");var a,t=this.createOption(t,n);return t.makeOptionMandatory(!!e.mandatory),"function"==typeof r?t.default(i).argParser(r):r instanceof RegExp?(a=r,r=function(e,t){e=a.exec(e);return e?e[0]:t},t.default(i).argParser(r)):t.default(r),this.addOption(t)}},{key:"option",value:function(e,t,n,r){return this._optionEx({},e,t,n,r)}},{key:"requiredOption",value:function(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}},{key:"combineFlagAndOptionalValue",value:function(){return this._combineFlagAndOptionalValue=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"allowUnknownOption",value:function(){return this._allowUnknownOption=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"allowExcessArguments",value:function(){return this._allowExcessArguments=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"enablePositionalOptions",value:function(){return this._enablePositionalOptions=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"passThroughOptions",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}},{key:"storeOptionsAsProperties",value:function(){if(this._storeOptionsAsProperties=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}},{key:"getOptionValue",value:function(e){return(this._storeOptionsAsProperties?this:this._optionValues)[e]}},{key:"setOptionValue",value:function(e,t){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this}},{key:"setOptionValueWithSource",value:function(e,t,n){return this.setOptionValue(e,t),this._optionValueSources[e]=n,this}},{key:"getOptionValueSource",value:function(e){return this._optionValueSources[e]}},{key:"_prepareUserArgs",value:function(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");var n;switch(t=t||{},void 0===e&&(e=d.argv,d.versions)&&d.versions.electron&&(t.from="electron"),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":n=d.defaultApp?(this._scriptPath=e[1],e.slice(2)):e.slice(1);break;case"user":n=e.slice(0);break;default:throw new Error("unexpected parse option { from: '".concat(t.from,"' }"))}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}},{key:"parse",value:function(e,t){e=this._prepareUserArgs(e,t);return this._parseCommand([],e),this}},{key:"parseAsync",value:(n=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=this._prepareUserArgs(t,n),e.n=1,this._parseCommand([],r);case 1:return e.a(2,this)}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"_executeSubCommand",value:function(n,e){e=e.slice();var r=[".js",".ts",".tsx",".mjs",".cjs"];function t(e,t){var n=h.resolve(e,t);return f.existsSync(n)?n:!r.includes(h.extname(t))&&(e=r.find(function(e){return f.existsSync("".concat(n).concat(e))}))?"".concat(n).concat(e):void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();var i,a,o,s=n._executableFile||"".concat(this._name,"-").concat(n._name),u=this._executableDir||"";if(this._scriptPath){try{i=f.realpathSync(this._scriptPath)}catch(e){i=this._scriptPath}u=h.resolve(h.dirname(i),u)}u&&((i=t(u,s))||n._executableFile||!this._scriptPath||(a=h.basename(this._scriptPath,h.extname(this._scriptPath)))!==this._name&&(i=t(u,"".concat(a,"-").concat(n._name))),s=i||s),a=r.includes(h.extname(s)),(o="win32"!==d.platform?a?(e.unshift(s),e=y(d.execArgv).concat(e),l.spawn(d.argv[0],e,{stdio:"inherit"})):l.spawn(s,e,{stdio:"inherit"}):(e.unshift(s),e=y(d.execArgv).concat(e),l.spawn(d.execPath,e,{stdio:"inherit"}))).killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(function(e){d.on(e,function(){!1===o.killed&&null===o.exitCode&&o.kill(e)})});var c=this._exitCallback;c?o.on("close",function(){c(new p(d.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):o.on("close",d.exit.bind(d)),o.on("error",function(e){var t;if("ENOENT"===e.code)throw t=u?"searched for local subcommand relative to directory '".concat(u,"'"):"no directory for search for local subcommand, use .executableDir() to supply a custom directory",t="'".concat(s,"' does not exist\n - if '").concat(n._name,"' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ").concat(t),new Error(t);if("EACCES"===e.code)throw new Error("'".concat(s,"' not executable"));c?((t=new p(1,"commander.executeSubCommandAsync","(error)")).nestedError=e,c(t)):d.exit(1)}),this.runningCommand=o}},{key:"_dispatchSubcommand",value:function(e,t,n){var r=this,i=this._findCommand(e);return i||this.help({error:!0}),e=this._chainOrCallSubCommandHook(void 0,i,"preSubcommand"),this._chainOrCall(e,function(){if(!i._executableHandler)return i._parseCommand(t,n);r._executeSubCommand(i,t.concat(n))})}},{key:"_checkNumberOfArguments",value:function(){var n=this;this._args.forEach(function(e,t){e.required&&null==n.args[t]&&n.missingArgument(e.name())}),!(0<this._args.length&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}},{key:"_processArguments",value:function(){function r(t,n,r){var e=n;if(null!==n&&t.parseArg)try{e=t.parseArg(n,r)}catch(e){throw"commander.invalidArgument"===e.code&&(r="error: command-argument value '".concat(n,"' is invalid for argument '").concat(t.name(),"'. ").concat(e.message),i.error(r,{exitCode:e.exitCode,code:e.code})),e}return e}var i=this,a=(this._checkNumberOfArguments(),[]);this._args.forEach(function(n,e){var t=n.defaultValue;n.variadic?e<i.args.length?(t=i.args.slice(e),n.parseArg&&(t=t.reduce(function(e,t){return r(n,t,e)},n.defaultValue))):void 0===t&&(t=[]):e<i.args.length&&(t=i.args[e],n.parseArg)&&(t=r(n,t,n.defaultValue)),a[e]=t}),this.processedArgs=a}},{key:"_chainOrCall",value:function(e,t){return e&&e.then&&"function"==typeof e.then?e.then(function(){return t()}):t()}},{key:"_chainOrCallHooks",value:function(e,n){var t=this,r=e,i=[];return v(this).reverse().filter(function(e){return void 0!==e._lifeCycleHooks[n]}).forEach(function(t){t._lifeCycleHooks[n].forEach(function(e){i.push({hookedCommand:t,callback:e})})}),"postAction"===n&&i.reverse(),i.forEach(function(e){r=t._chainOrCall(r,function(){return e.callback(e.hookedCommand,t)})}),r}},{key:"_chainOrCallSubCommandHook",value:function(e,t,n){var r=this,i=e;return void 0!==this._lifeCycleHooks[n]&&this._lifeCycleHooks[n].forEach(function(e){i=r._chainOrCall(i,function(){return e(r,t)})}),i}},{key:"_parseCommand",value:function(e,t){var n=this,r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return 1===e.length&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return _(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),_(this,r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();function i(){0<r.unknown.length&&n.unknownOption(r.unknown[0])}var a,o="command:".concat(this.name());if(this._actionHandler)return i(),this._processArguments(),a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,function(){return n._actionHandler(n.processedArgs)}),this.parent&&(a=this._chainOrCall(a,function(){n.parent.emit(o,e,t)})),a=this._chainOrCallHooks(a,"postAction");if(this.parent&&this.parent.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}},{key:"_findCommand",value:function(t){if(t)return this.commands.find(function(e){return e._name===t||e._aliases.includes(t)})}},{key:"_findOption",value:function(t){return this.options.find(function(e){return e.is(t)})}},{key:"_checkForMissingMandatoryOptions",value:function(){for(var e=this;e;e=e.parent)(t=>{t.options.forEach(function(e){e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)})})(e)}},{key:"_checkForConflictingLocalOptions",value:function(){var n=this,r=this.options.filter(function(e){e=e.attributeName();return void 0!==n.getOptionValue(e)&&"default"!==n.getOptionValueSource(e)});r.filter(function(e){return 0<e.conflictsWith.length}).forEach(function(t){var e=r.find(function(e){return t.conflictsWith.includes(e.attributeName())});e&&n._conflictingOption(t,e)})}},{key:"_checkForConflictingOptions",value:function(){for(var e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}},{key:"parseOptions",value:function(e){var t=[],n=[],r=t,i=e.slice();function a(e){return 1<e.length&&"-"===e[0]}for(var o=null;i.length;){var s=i.shift();if("--"===s){r===n&&r.push(s),r.push.apply(r,_toConsumableArray(i));break}if(o&&!a(s))this.emit("option:".concat(o.name()),s);else{if(o=null,a(s)){var u,c=this._findOption(s);if(c){c.required?(void 0===(u=i.shift())&&this.optionMissingArgument(c),this.emit("option:".concat(c.name()),u)):c.optional?(u=null,0<i.length&&!a(i[0])&&(u=i.shift()),this.emit("option:".concat(c.name()),u)):this.emit("option:".concat(c.name())),o=c.variadic?c:null;continue}}if(2<s.length&&"-"===s[0]&&"-"!==s[1]){c=this._findOption("-".concat(s[1]));if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit("option:".concat(c.name()),s.slice(2)):(this.emit("option:".concat(c.name())),i.unshift("-".concat(s.slice(2))));continue}}if(/^--[^=]+=/.test(s)){var l=s.indexOf("="),h=this._findOption(s.slice(0,l));if(h&&(h.required||h.optional)){this.emit("option:".concat(h.name()),s.slice(l+1));continue}}if(a(s)&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===n.length){if(this._findCommand(s)){t.push(s),0<i.length&&n.push.apply(n,_toConsumableArray(i));break}if(s===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(s),0<i.length&&t.push.apply(t,_toConsumableArray(i));break}if(this._defaultCommandName){n.push(s),0<i.length&&n.push.apply(n,_toConsumableArray(i));break}}if(this._passThroughOptions){r.push(s),0<i.length&&r.push.apply(r,_toConsumableArray(i));break}r.push(s)}}return{operands:t,unknown:n}}},{key:"opts",value:function(){if(this._storeOptionsAsProperties){for(var e={},t=this.options.length,n=0;n<t;n++){var r=this.options[n].attributeName();e[r]=r===this._versionOptionName?this._version:this[r]}return e}return this._optionValues}},{key:"optsWithGlobals",value:function(){return v(this).reduce(function(e,t){return Object.assign(e,t.opts())},{})}},{key:"error",value:function(e,t){this._outputConfiguration.outputError("".concat(e,"\n"),this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr("".concat(this._showHelpAfterError,"\n")):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));var t=t||{},n=t.exitCode||1;this._exit(n,t.code||"commander.error",e)}},{key:"_parseOptionsEnv",value:function(){var n=this;this.options.forEach(function(e){var t;e.envVar&&e.envVar in d.env&&(t=e.attributeName(),void 0!==n.getOptionValue(t)&&!["default","config","env"].includes(n.getOptionValueSource(t))||(e.required||e.optional?n.emit("optionEnv:".concat(e.name()),d.env[e.envVar]):n.emit("optionEnv:".concat(e.name()))))})}},{key:"_parseOptionsImplied",value:function(){function n(e){return void 0!==r.getOptionValue(e)&&!["default","implied"].includes(r.getOptionValueSource(e))}var r=this,t=new c(this.options);this.options.filter(function(e){return void 0!==e.implied&&n(e.attributeName())&&t.valueFromOption(r.getOptionValue(e.attributeName()),e)}).forEach(function(t){Object.keys(t.implied).filter(function(e){return!n(e)}).forEach(function(e){r.setOptionValueWithSource(e,t.implied[e],"implied")})})}},{key:"missingArgument",value:function(e){e="error: missing required argument '".concat(e,"'");this.error(e,{code:"commander.missingArgument"})}},{key:"optionMissingArgument",value:function(e){e="error: option '".concat(e.flags,"' argument missing");this.error(e,{code:"commander.optionMissingArgument"})}},{key:"missingMandatoryOptionValue",value:function(e){e="error: required option '".concat(e.flags,"' not specified");this.error(e,{code:"commander.missingMandatoryOptionValue"})}},{key:"_conflictingOption",value:function(e,t){function n(e){t=(e=e).attributeName(),r=a.getOptionValue(t),i=a.options.find(function(e){return e.negate&&t===e.attributeName()}),n=a.options.find(function(e){return!e.negate&&t===e.attributeName()});var t,n,r=i&&(void 0===i.presetArg&&!1===r||void 0!==i.presetArg&&r===i.presetArg)?i:n||e,i=r.attributeName();return"env"===a.getOptionValueSource(i)?"environment variable '".concat(r.envVar,"'"):"option '".concat(r.flags,"'")}var a=this,e="error: ".concat(n(e)," cannot be used with ").concat(n(t));this.error(e,{code:"commander.conflictingOption"})}},{key:"unknownOption",value:function(e){if(!this._allowUnknownOption){var t="";if(e.startsWith("--")&&this._showSuggestionAfterError){var n=[],r=this;do{var i=r.createHelp().visibleOptions(r).filter(function(e){return e.long}).map(function(e){return e.long}),n=n.concat(i),r=r.parent}while(r&&!r._enablePositionalOptions);t=g(e,n)}e="error: unknown option '".concat(e,"'").concat(t);this.error(e,{code:"commander.unknownOption"})}}},{key:"_excessArguments",value:function(e){var t,n;this._allowExcessArguments||(t=1===(n=this._args.length)?"":"s",n="error: too many arguments".concat(this.parent?" for '".concat(this.name(),"'"):"",". Expected ").concat(n," argument").concat(t," but got ").concat(e.length,"."),this.error(n,{code:"commander.excessArguments"}))}},{key:"unknownCommand",value:function(){var t,e=this.args[0],n="",e=(this._showSuggestionAfterError&&(t=[],this.createHelp().visibleCommands(this).forEach(function(e){t.push(e.name()),e.alias()&&t.push(e.alias())}),n=g(e,t)),"error: unknown command '".concat(e,"'").concat(n));this.error(e,{code:"commander.unknownCommand"})}},{key:"version",value:function(e,t,n){var r=this;if(void 0===e)return this._version;this._version=e;t=this.createOption(t=t||"-V, --version",n=n||"output the version number");return this._versionOptionName=t.attributeName(),this.options.push(t),this.on("option:"+t.name(),function(){r._outputConfiguration.writeOut("".concat(e,"\n")),r._exit(0,"commander.version",e)}),this}},{key:"description",value:function(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}},{key:"summary",value:function(e){return void 0===e?this._summary:(this._summary=e,this)}},{key:"alias",value:function(e){if(void 0===e)return this._aliases[0];var t=this;if(e===(t=0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler?this.commands[this.commands.length-1]:t)._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}},{key:"aliases",value:function(e){var t=this;return void 0===e?this._aliases:(e.forEach(function(e){return t.alias(e)}),this)}},{key:"usage",value:function(e){var t;return void 0===e?this._usage||(t=this._args.map(function(e){return a(e)}),[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?t:[]).join(" ")):(this._usage=e,this)}},{key:"name",value:function(e){return void 0===e?this._name:(this._name=e,this)}},{key:"nameFromFilename",value:function(e){return this._name=h.basename(e,h.extname(e)),this}},{key:"executableDir",value:function(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}},{key:"helpInformation",value:function(e){var t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}},{key:"_getHelpContext",value:function(e){var t=this,n={error:!!(e=e||{}).error},r=n.error?function(e){return t._outputConfiguration.writeErr(e)}:function(e){return t._outputConfiguration.writeOut(e)};return n.write=e.write||r,n.command=this,n}},{key:"outputHelp",value:function(e){"function"==typeof e&&(t=e,e=void 0);var t,n=this._getHelpContext(e),e=(v(this).reverse().forEach(function(e){return e.emit("beforeAllHelp",n)}),this.emit("beforeHelp",n),this.helpInformation(n));if(t&&"string"!=typeof(e=t(e))&&!Buffer.isBuffer(e))throw new Error("outputHelp callback must return a string or a Buffer");n.write(e),this.emit(this._helpLongFlag),this.emit("afterHelp",n),v(this).forEach(function(e){return e.emit("afterAllHelp",n)})}},{key:"helpOption",value:function(e,t){return"boolean"==typeof e?this._hasHelpOption=e:(this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription,e=u(this._helpFlags),this._helpShortFlag=e.shortFlag,this._helpLongFlag=e.longFlag),this}},{key:"help",value:function(e){this.outputHelp(e);var t=d.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}},{key:"addHelpText",value:function(e,n){var t=["beforeAll","before","after","afterAll"];if(t.includes(e))return e="".concat(e,"Help"),this.on(e,function(e){var t="function"==typeof n?n({error:e.error,command:e.command}):n;t&&e.write("".concat(t,"\n"))}),this;throw new Error("Unexpected value for position to addHelpText.\nExpecting one of '".concat(t.join("', '"),"'"))}}]));function m(e){var t;return _classCallCheck(this,m),(t=_callSuper(this,m)).commands=[],t.options=[],t.parent=null,t._allowUnknownOption=!1,t._allowExcessArguments=!0,t._args=[],t.args=[],t.rawArgs=[],t.processedArgs=[],t._scriptPath=null,t._name=e||"",t._optionValues={},t._optionValueSources={},t._storeOptionsAsProperties=!1,t._actionHandler=null,t._executableHandler=!1,t._executableFile=null,t._executableDir=null,t._defaultCommandName=null,t._exitCallback=null,t._aliases=[],t._combineFlagAndOptionalValue=!0,t._description="",t._summary="",t._argsDescription=void 0,t._enablePositionalOptions=!1,t._passThroughOptions=!1,t._lifeCycleHooks={},t._showHelpAfterError=!1,t._showSuggestionAfterError=!0,t._outputConfiguration={writeOut:function(e){return d.stdout.write(e)},writeErr:function(e){return d.stderr.write(e)},getOutHelpWidth:function(){return d.stdout.isTTY?d.stdout.columns:void 0},getErrHelpWidth:function(){return d.stderr.isTTY?d.stderr.columns:void 0},outputError:function(e,t){return t(e)}},t._hidden=!1,t._hasHelpOption=!0,t._helpFlags="-h, --help",t._helpDescription="display help for command",t._helpShortFlag="-h",t._helpLongFlag="--help",t._addImplicitHelpCommand=void 0,t._helpCommandName="help",t._helpCommandnameAndArgs="help [command]",t._helpCommandDescription="display help for command",t._helpConfiguration={},t}function _(t,e){t._hasHelpOption&&e.find(function(e){return e===t._helpLongFlag||e===t._helpShortFlag})&&(t.outputHelp(),t._exit(0,"commander.helpDisplayed","(outputHelp)"))}function y(e){return e.map(function(e){var t,n,r,i;return e.startsWith("--inspect")&&(n="127.0.0.1",r="9229",null!==(i=e.match(/^(--inspect(-brk)?)$/))?t=i[1]:null!==(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):null!==(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=i[1],n=i[3],r=i[4]),t)&&"0"!==r?"".concat(t,"=").concat(n,":").concat(parseInt(r)+1):e})}function v(e){for(var t=[],n=e;n;n=n.parent)t.push(n);return t}e.Command=r}),M=t(function(e,t){var n=w().Argument,r=U().Command,i=b(),a=i.CommanderError,i=i.InvalidArgumentError,o=k().Help,s=S().Option;((e=t.exports=new r).program=e).Argument=n,e.Command=r,e.CommanderError=a,e.Help=o,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i,e.Option=s}),I=t(function(e,t){"u"<("undefined"==typeof process?"undefined":_typeof(process))||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?t.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,a,o=arguments.length;switch(o){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,n)});case 4:return process.nextTick(function(){e.call(null,t,n,r)});default:for(i=new Array(o-1),a=0;a<i.length;)i[a++]=arguments[a];return process.nextTick(function(){e.apply(null,i)})}}}:t.exports=process}),q=t(function(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}}),T=t(function(e,t){t.exports=require("stream")}),F=t(function(e,t){var n=require("buffer"),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");e=r(e);return void 0!==t?"string"==typeof n?e.fill(t,n):e.fill(t):e.fill(0),e},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}),P=t(function(e){function t(e){return Object.prototype.toString.call(e)}e.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},e.isBoolean=function(e){return"boolean"==typeof e},e.isNull=function(e){return null===e},e.isNullOrUndefined=function(e){return null==e},e.isNumber=function(e){return"number"==typeof e},e.isString=function(e){return"string"==typeof e},e.isSymbol=function(e){return"symbol"==_typeof(e)},e.isUndefined=function(e){return void 0===e},e.isRegExp=function(e){return"[object RegExp]"===t(e)},e.isObject=function(e){return"object"==_typeof(e)&&null!==e},e.isDate=function(e){return"[object Date]"===t(e)},e.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},e.isFunction=function(e){return"function"==typeof e},e.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==_typeof(e)||"u"<_typeof(e)},e.isBuffer=require("buffer").Buffer.isBuffer}),G=t(function(e,t){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){var n;t&&(e.super_=t,(n=function(){}).prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e)}}),R=t(function(e,t){try{if("function"!=typeof(n=require("util")).inherits)throw"";t.exports=n.inherits}catch(e){t.exports=G()}var n}),W=t(function(e,t){var o=F().Buffer,n=require("util");function r(){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}t.exports=(r.prototype.push=function(e){e={data:e,next:null};0<this.length?this.tail.next=e:this.head=e,this.tail=e,++this.length},r.prototype.unshift=function(e){e={data:e,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},r.prototype.shift=function(){var e;if(0!==this.length)return e=this.head.data,1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return o.alloc(0);for(var t,n,r=o.allocUnsafe(e>>>0),i=this.head,a=0;i;)t=i.data,n=a,t.copy(r,n),a+=i.data.length,i=i.next;return r},r),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})}),z=t(function(e,t){var a=I();function o(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(o,this,e)):a.nextTick(o,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,a.nextTick(o,n,e)):a.nextTick(o,n,e):t&&t(e)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}),V=t(function(e,t){t.exports=require("util").deprecate}),f=t(function(e,t){var d=I();function h(a){var o=this;this.next=null,this.entry=null,this.finish=function(){var e=o,t=a,n=void 0,r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}}t.exports=u;var a,f=!process.browser&&-1<["v0.10","v0.9."].indexOf(process.version.slice(0,5))?setImmediate:d.nextTick,t=(u.WritableState=s,Object.create(P())),n=(t.inherits=R(),{deprecate:V()}),r=T(),p=F().Buffer,g=(("undefined"==typeof global?"undefined":_typeof(global))<"u"?global:("undefined"==typeof window?"undefined":_typeof(window))<"u"?window:("undefined"==typeof self?"undefined":_typeof(self))<"u"?self:{}).Uint8Array||function(){};var i,o=z();function m(){}function s(e,l){a=a||N(),e=e||{};var t=l instanceof a,n=(this.objectMode=!!e.objectMode,t&&(this.objectMode=this.objectMode||!!e.writableObjectMode),e.highWaterMark),r=e.writableHighWaterMark,i=this.objectMode?16:16384,n=(this.highWaterMark=n||0===n?n:t&&(r||0===r)?r:i,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,(this.destroyed=!1)===e.decodeStrings);this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){e=e,n=(t=l)._writableState,r=n.sync,i=n.writecb;var t,n,r,i,a=n;{var o,s,u,c;(a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0,e)?(a=t,s=r,u=e,c=i,--(o=n).pendingcb,s?(d.nextTick(c,u),d.nextTick(w,a,o),a._writableState.errorEmitted=!0,a.emit("error",u)):(c(u),a._writableState.errorEmitted=!0,a.emit("error",u),w(a,o))):((e=b(n))||n.corked||n.bufferProcessing||!n.bufferedRequest||v(t,n),r?f(y,t,n,e,i):y(t,n,e,i))}},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new h(this)}t.inherits(u,r),s.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(s.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function u(e){if(a=a||N(),!(i.call(u,this)||this instanceof a))return new u(e);this._writableState=new s(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final)&&(this._final=e.final),r.call(this)}function _(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function y(e,t,n,r){var i;n||(n=e,0===(i=t).length&&i.needDrain&&(i.needDrain=!1,n.emit("drain"))),t.pendingcb--,r(),w(e,t)}function v(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),r=t.corkedRequestsFree;r.entry=n;for(var a=0,o=!0;n;)(i[a]=n).isBuf||(o=!1),n=n.next,a+=1;i.allBuffers=o,_(e,t,!0,t.length,i,"",r.finish),t.pendingcb++,t.lastBufferedRequest=null,r.next?(t.corkedRequestsFree=r.next,r.next=null):t.corkedRequestsFree=new h(t),t.bufferedRequestCount=0}else{for(;n;){var s=n.chunk,u=n.encoding,c=n.callback;if(_(e,t,!1,t.objectMode?1:s.length,s,u,c),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function b(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function c(t,n){t._final(function(e){n.pendingcb--,e&&t.emit("error",e),n.prefinished=!0,t.emit("prefinish"),w(t,n)})}function w(e,t){var n,r,i=b(t);return i&&(n=e,(r=t).prefinished||r.finalCalled||("function"==typeof n._final?(r.pendingcb++,r.finalCalled=!0,d.nextTick(c,n,r)):(r.prefinished=!0,n.emit("prefinish"))),0===t.pendingcb)&&(t.finished=!0,e.emit("finish")),i}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function(e){return!!i.call(this,e)||this===u&&e&&e._writableState instanceof s}})):i=function(e){return e instanceof this},u.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},u.prototype.write=function(e,t,n){var r,i,a,o,s,u,c,l=this._writableState,h=!1,f=!l.objectMode&&(f=e,p.isBuffer(f)||f instanceof g);return f&&!p.isBuffer(e)&&(c=e,e=p.from(c)),"function"==typeof t&&(n=t,t=null),t=f?"buffer":t||l.defaultEncoding,"function"!=typeof n&&(n=m),l.ended?(c=this,s=n,u=new Error("write after end"),c.emit("error",u),d.nextTick(s,u)):(f||(s=this,u=l,i=n,o=!(a=!0),null===(r=e)?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||u.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(s.emit("error",o),d.nextTick(i,o),a=!1),a))&&(l.pendingcb++,h=((e,t,n,r,i,a)=>{n||(s=((e,t,n)=>t=e.objectMode||!1===e.decodeStrings||"string"!=typeof t?t:p.from(t,n))(t,r,i),r!==s&&(n=!0,i="buffer",r=s));var o,s=t.objectMode?1:r.length,u=(t.length+=s,t.length<t.highWaterMark);return u||(t.needDrain=!0),t.writing||t.corked?(o=t.lastBufferedRequest,t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},o?o.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1):_(e,t,!1,s,r,i,a),u})(this,l,f,e,t,n)),h},u.prototype.cork=function(){this._writableState.corked++},u.prototype.uncork=function(){var e=this._writableState;!e.corked||(e.corked--,e.writing)||e.corked||e.bufferProcessing||!e.bufferedRequest||v(this,e)},u.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase()))return this._writableState.defaultEncoding=e,this;throw new TypeError("Unknown encoding: "+e)},Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),u.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},u.prototype._writev=null,u.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,t=e=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||(e=this,t=n,(n=r).ending=!0,w(e,n),t&&(n.finished?d.nextTick(t):e.once("finish",t)),n.ended=!0,e.writable=!1)},Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),u.prototype.destroy=o.destroy,u.prototype._undestroy=o.undestroy,u.prototype._destroy=function(e,t){this.end(),t(e)}}),N=t(function(e,t){var n,r,i,a=I(),o=Object.keys||function(e){var t,n=[];for(t in e)n.push(t);return n},t=(t.exports=c,Object.create(P())),s=(t.inherits=R(),d()),u=f();for(t.inherits(c,s),n=o(u.prototype),i=0;i<n.length;i++)r=n[i],c.prototype[r]||(c.prototype[r]=u.prototype[r]);function c(e){if(!(this instanceof c))return new c(e);s.call(this,e),u.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||a.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),c.prototype._destroy=function(e,t){this.push(null),this.end(),a.nextTick(t,e)}}),L=t(function(e){var n=F().Buffer,r=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t=(e=>{if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}})(e);if("string"==typeof t||n.isEncoding!==r&&r(e))return t||e;throw new Error("Unknown encoding: "+e)}function t(e){var t;switch(this.encoding=i(e),this.encoding){case"utf16le":this.text=s,this.end=u,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=c,this.end=l,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t,n=this.lastTotal-this.lastNeed,r=(t=this,128!=(192&(r=e)[0])?(t.lastNeed=0,"�"):1<t.lastNeed&&1<r.length?128!=(192&r[1])?(t.lastNeed=1,"�"):2<t.lastNeed&&2<r.length&&128!=(192&r[2])?(t.lastNeed=2,"�"):void 0:void 0);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,n,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,n,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2!=0)return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1);t=e.toString("utf16le",t);if(t){var n=t.charCodeAt(t.length-1);if(55296<=n&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],t.slice(0,-1)}return t}function u(e){var t,e=e&&e.length?this.write(e):"";return this.lastNeed?(t=this.lastTotal-this.lastNeed,e+this.lastChar.toString("utf16le",0,t)):e}function c(e,t){var n=(e.length-t)%3;return 0==n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){e=e&&e.length?this.write(e):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}(e.StringDecoder=t).prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},t.prototype.end=function(e){e=e&&e.length?this.write(e):"";return this.lastNeed?e+"�":e},t.prototype.text=function(e,t){var n=((e,t,n)=>{var r,i=t.length-1;return i<n?0:0<=(r=a(t[i]))?(0<r&&(e.lastNeed=r-1),r):--i<n||-2===r?0:0<=(r=a(t[i]))?(0<r&&(e.lastNeed=r-2),r):!(--i<n||-2===r)&&0<=(r=a(t[i]))?(0<r&&(2===r?r=0:e.lastNeed=r-3),r):0})(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;n=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},t.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}}),d=t(function(e,t){function g(e,t){return e.listeners(t).length}var a,m=I(),_=(t.exports=c,q()),n=(c.ReadableState=i,require("events").EventEmitter,T()),h=F().Buffer,f=(("undefined"==typeof global?"undefined":_typeof(global))<"u"?global:("undefined"==typeof window?"undefined":_typeof(window))<"u"?window:("undefined"==typeof self?"undefined":_typeof(self))<"u"?self:{}).Uint8Array||function(){};var o,t=Object.create(P()),r=(t.inherits=R(),require("util")),y=void 0,y=r&&r.debuglog?r.debuglog("stream"):function(){},s=W(),r=z(),u=(t.inherits(c,n),["error","close","destroy","pause","resume"]);function i(e,t){e=e||{};var t=t instanceof(a=a||N()),n=(this.objectMode=!!e.objectMode,t&&(this.objectMode=this.objectMode||!!e.readableObjectMode),e.highWaterMark),r=e.readableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:t&&(r||0===r)?r:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new s,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o=o||L().StringDecoder,this.decoder=new o(e.encoding),this.encoding=e.encoding)}function c(e){if(a=a||N(),!(this instanceof c))return new c(e);this._readableState=new i(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy)&&(this._destroy=e.destroy),n.call(this)}function l(e,t,n,r,i){var a,o,s,u,c,l=e._readableState;return null===t?(l.reading=!1,o=e,(u=l).ended||(u.decoder&&(s=u.decoder.end())&&s.length&&(u.buffer.push(s),u.length+=u.objectMode?1:s.length),u.ended=!0,b(o))):(i||(s=l,a=c=(e=>h.isBuffer(e)||e instanceof f)(u=t)||"string"==typeof u||void 0===u||s.objectMode?c:new TypeError("Invalid non-string/buffer chunk")),a?e.emit("error",a):l.objectMode||t&&0<t.length?("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===h.prototype||(o=t,t=h.from(o)),r?l.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):d(e,l,t,!0):l.ended?e.emit("error",new Error("stream.push() after EOF")):(l.reading=!1,!l.decoder||n||(t=l.decoder.write(t),l.objectMode)||0!==t.length?d(e,l,t,!1):k(e,l))):r||(l.reading=!1)),!(i=l).ended&&(i.needReadable||i.length<i.highWaterMark||0===i.length)}function d(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&b(e)),k(e,t)}Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),c.prototype.destroy=r.destroy,c.prototype._undestroy=r.undestroy,c.prototype._destroy=function(e,t){this.push(null),t(e)},c.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=h.from(e,t),t=""),n=!0),l(this,e,t,!1,n)},c.prototype.unshift=function(e){return l(this,e,null,!0,!1)},c.prototype.isPaused=function(){return!1===this._readableState.flowing},c.prototype.setEncoding=function(e){return o=o||L().StringDecoder,this._readableState.decoder=new o(e),this._readableState.encoding=e,this};var p=8388608;function v(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?(t.flowing&&t.length?t.buffer.head.data:t).length:(e>t.highWaterMark&&(t.highWaterMark=(p<=(n=e)?n=p:(n--,n=(n=(n=(n=(n|=n>>>1)|n>>>2)|n>>>4)|n>>>8)|n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var n}function b(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?m.nextTick(w,e):w(e))}function w(e){y("emit readable"),e.emit("readable"),A(e)}function k(e,t){t.readingMore||(t.readingMore=!0,m.nextTick(S,e,t))}function S(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(y("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function E(e){y("readable nexttick read 0"),e.read(0)}function C(e,t){t.reading||(y("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(y("flow",t.flowing);t.flowing&&null!==e.read(););}function x(e,t){var n,r,i;return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):(e=e,r=t.buffer,t=t.decoder,e<r.head.data.length?(i=r.head.data.slice(0,e),r.head.data=r.head.data.slice(e)):i=e===r.head.data.length?r.shift():(t?(e,t)=>{var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(i+=o===a.length?a:a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n).data=a.slice(o);break}++r}return t.length-=r,i}:(e,t)=>{var n=h.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r).data=a.slice(o);break}++i}return t.length-=i,n})(e,r),n=i),n)}function O(e){var t=e._readableState;if(0<t.length)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,m.nextTick(D,t,e))}function D(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function B(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}c.prototype.read=function(e){y("read",e),e=parseInt(e,10);var t,n=this._readableState,r=e;return 0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&(n.length>=n.highWaterMark||n.ended)?(y("read: emitReadable",n.length,n.ended),(0===n.length&&n.ended?O:b)(this),null):0===(e=v(e,n))&&n.ended?(0===n.length&&O(this),null):(t=n.needReadable,y("need readable",t),(0===n.length||n.length-e<n.highWaterMark)&&y("length less than watermark",t=!0),n.ended||n.reading?y("reading or ended",t=!1):t&&(y("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=v(r,n))),null===(t=0<e?x(e,n):null)?(n.needReadable=!0,e=0):n.length-=e,0===n.length&&(n.ended||(n.needReadable=!0),r!==e)&&n.ended&&O(this),null!==t&&this.emit("data",t),t)},c.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(n,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=n;break;case 1:i.pipes=[i.pipes,n];break;default:i.pipes.push(n)}i.pipesCount+=1,y("pipe count=%d opts=%j",i.pipesCount,e);e=(!e||!1!==e.end)&&n!==process.stdout&&n!==process.stderr?o:p;function a(e,t){y("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,y("cleanup"),n.removeListener("close",f),n.removeListener("finish",d),n.removeListener("drain",s),n.removeListener("error",h),n.removeListener("unpipe",a),r.removeListener("end",o),r.removeListener("end",p),r.removeListener("data",l),u=!0,!i.awaitDrain||n._writableState&&!n._writableState.needDrain||s())}function o(){y("onend"),n.end()}i.endEmitted?m.nextTick(e):r.once("end",e),n.on("unpipe",a);t=r;var t,s=function(){var e=t._readableState;y("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&g(t,"data")&&(e.flowing=!0,A(t))},u=(n.on("drain",s),!1);var c=!1;function l(e){y("ondata"),(c=!1)!==n.write(e)||c||((1===i.pipesCount&&i.pipes===n||1<i.pipesCount&&-1!==B(i.pipes,n))&&!u&&(y("false write response, pause",i.awaitDrain),i.awaitDrain++,c=!0),r.pause())}function h(e){y("onerror",e),p(),n.removeListener("error",h),0===g(n,"error")&&n.emit("error",e)}function f(){n.removeListener("finish",d),p()}function d(){y("onfinish"),n.removeListener("close",f),p()}function p(){y("unpipe"),r.unpipe(n)}return r.on("data",l),((e,t,n)=>{if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?_(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)})(n,"error",h),n.once("close",f),n.once("finish",d),n.emit("pipe",r),i.flowing||(y("pipe resume"),r.resume()),n},c.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0!==t.pipesCount)if(1===t.pipesCount)e&&e!==t.pipes||(e=e||t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n));else if(e){var r=B(t.pipes,e);-1!==r&&(t.pipes.splice(r,1),--t.pipesCount,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n))}else{var i=t.pipes,a=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<a;o++)i[o].emit("unpipe",this,{hasUnpiped:!1})}return this},c.prototype.addListener=c.prototype.on=function(e,t){t=n.prototype.on.call(this,e,t);return"data"===e?!1!==this._readableState.flowing&&this.resume():"readable"!==e||(e=this._readableState).endEmitted||e.readableListening||(e.readableListening=e.needReadable=!0,e.emittedReadable=!1,e.reading?e.length&&b(this):m.nextTick(E,this)),t},c.prototype.resume=function(){var e,t=this._readableState;return t.flowing||(y("resume"),t.flowing=!0,e=this,(t=t).resumeScheduled||(t.resumeScheduled=!0,m.nextTick(C,e,t))),this},c.prototype.pause=function(){return y("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(y("pause"),this._readableState.flowing=!1,this.emit("pause")),this},c.prototype.wrap=function(t){var e,n=this,r=this._readableState,i=!1;for(e in t.on("end",function(){var e;y("wrapped end"),r.decoder&&!r.ended&&(e=r.decoder.end())&&e.length&&n.push(e),n.push(null)}),t.on("data",function(e){y("wrapped data"),r.decoder&&(e=r.decoder.write(e)),r.objectMode&&null==e||!(r.objectMode||e&&e.length)||n.push(e)||(i=!0,t.pause())}),t)void 0===this[e]&&"function"==typeof t[e]&&(this[e]=(e=>function(){return t[e].apply(t,arguments)})(e));for(var a=0;a<u.length;a++)t.on(u[a],this.emit.bind(this,u[a]));return this._read=function(e){y("wrapped _read",e),i&&(i=!1,t.resume())},this},Object.defineProperty(c.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),c._fromList=x}),a=t(function(e,t){t.exports=n;var r=N(),t=Object.create(P());function n(e){if(!(this instanceof n))return new n(e);r.call(this,e),this._transformState={afterTransform:function(e,t){var n=this._transformState,r=(n.transforming=!1,n.writecb);if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,(n.writecb=null)!=t&&this.push(t),r(e),(n=this._readableState).reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush)&&(this._flush=e.flush),this.on("prefinish",i)}function i(){var n=this;"function"==typeof this._flush?this._flush(function(e,t){a(n,e,t)}):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");e.push(null)}t.inherits=R(),t.inherits(n,r),n.prototype.push=function(e,t){return this._transformState.needTransform=!1,r.prototype.push.call(this,e,t)},n.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},n.prototype._write=function(e,t,n){var r=this._transformState;r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming&&(n=this._readableState,r.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)},n.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},n.prototype._destroy=function(e,t){var n=this;r.prototype._destroy.call(this,e,function(e){t(e),n.emit("close")})}}),K=t(function(e,t){t.exports=r;var n=a(),t=Object.create(P());function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}t.inherits=R(),t.inherits(r,n),r.prototype._transform=function(e,t,n){n(null,e)}}),o=t(function(e,t){var n=require("stream");"disable"===process.env.READABLE_STREAM&&n?(t.exports=n,(e=t.exports=n.Readable).Readable=n.Readable,e.Writable=n.Writable,e.Duplex=n.Duplex,e.Transform=n.Transform,e.PassThrough=n.PassThrough,e.Stream=n):((e=t.exports=d()).Stream=n||e,(e.Readable=e).Writable=f(),e.Duplex=N(),e.Transform=a(),e.PassThrough=K())}),p=t(function(t){if(t.base64=!0,t.array=!0,t.string=!0,t.arraybuffer=("undefined"==typeof ArrayBuffer?"undefined":_typeof(ArrayBuffer))<"u"&&("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u",t.nodebuffer=("undefined"==typeof Buffer?"undefined":_typeof(Buffer))<"u",t.uint8array=("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u","u"<("undefined"==typeof ArrayBuffer?"undefined":_typeof(ArrayBuffer)))t.blob=!1;else{n=new ArrayBuffer(0);try{t.blob=0===new Blob([n],{type:"application/zip"}).size}catch(e){try{(r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder)).append(n),t.blob=0===r.getBlob("application/zip").size}catch(e){t.blob=!1}}}var n,r;try{t.nodestream=!!o().Readable}catch(e){t.nodestream=!1}}),g=t(function(e){var h=E(),f=p(),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.encode=function(e){for(var t,n,r,i,a,o,s=[],u=0,c=e.length,l="string"!==h.getTypeOf(e);u<e.length;)o=c-u,r=l?(t=e[u++],n=u<c?e[u++]:0,u<c?e[u++]:0):(t=e.charCodeAt(u++),n=u<c?e.charCodeAt(u++):0,u<c?e.charCodeAt(u++):0),i=(3&t)<<4|n>>4,a=1<o?(15&n)<<2|r>>6:64,o=2<o?63&r:64,s.push(d.charAt(t>>2)+d.charAt(i)+d.charAt(a)+d.charAt(o));return s.join("")},e.decode=function(e){var t,n,r,i,a,o,s=0,u=0;if("data:"===e.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var c,l=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===d.charAt(64)&&l--,e.charAt(e.length-2)===d.charAt(64)&&l--,l%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=new(f.uint8array?Uint8Array:Array)(0|l);s<e.length;)r=d.indexOf(e.charAt(s++)),t=(15&(i=d.indexOf(e.charAt(s++))))<<4|(a=d.indexOf(e.charAt(s++)))>>2,n=(3&a)<<6|(o=d.indexOf(e.charAt(s++))),c[u++]=r<<2|i>>4,64!==a&&(c[u++]=t),64!==o&&(c[u++]=n);return c}}),v=t(function(e,t){t.exports={isNode:("undefined"==typeof Buffer?"undefined":_typeof(Buffer))<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){return Buffer.alloc?Buffer.alloc(e):((e=new Buffer(e)).fill(0),e)},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}}),Y=t(function(e,t){t.exports="function"==typeof setImmediate?setImmediate:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}}),X=t(function(e,t){var n,r,i,a,o=global.MutationObserver||global.WebKitMutationObserver,s=process.browser?o?(n=0,o=new o(c),r=global.document.createTextNode(""),o.observe(r,{characterData:!0}),function(){r.data=n=++n%2}):!global.setImmediate&&_typeof(global.MessageChannel)<"u"?((i=new global.MessageChannel).port1.onmessage=c,function(){i.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?function(){var e=global.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)}:function(){process.nextTick(c)},u=[];function c(){a=!0;for(var e,t,n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}a=!1}t.exports=function(e){1!==u.push(e)||a||s()}}),$=t(function(e,t){var i=X();function u(){}var a,c={},o=["REJECTED"],s=["FULFILLED"],r=["PENDING"];function n(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=r,this.queue=[],this.outcome=void 0,process.browser||(this.handled=a),e!==u&&d(this,e)}function l(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(t,n,r){i(function(){var e;try{e=n(r)}catch(e){return c.reject(t,e)}e===t?c.reject(t,new TypeError("Cannot resolve promise with itself")):c.resolve(t,e)})}function f(e){var t=e&&e.then;if(e&&("object"==_typeof(e)||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(t,e){var n=!1;function r(e){n||(n=!0,c.reject(t,e))}function i(e){n||(n=!0,c.resolve(t,e))}var a=p(function(){e(i,r)});"error"===a.status&&r(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}process.browser||(a=["UNHANDLED"]),(t.exports=n).prototype.finally=function(t){var n;return"function"!=typeof t?this:(n=this.constructor,this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})}))},n.prototype.catch=function(e){return this.then(null,e)},n.prototype.then=function(e,t){var n;return"function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o?this:(n=new this.constructor(u),process.browser||this.handled===a&&(this.handled=null),this.state!==r?h(n,this.state===s?e:t,this.outcome):this.queue.push(new l(n,e,t)),n)},l.prototype.callFulfilled=function(e){c.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){c.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},c.resolve=function(e,t){var n=p(f,t);if("error"===n.status)return c.reject(e,n.value);n=n.value;if(n)d(e,n);else{e.state=s,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callFulfilled(t)}return e},c.reject=function(e,t){e.state=o,e.outcome=t,process.browser||e.handled===a&&i(function(){e.handled===a&&process.emit("unhandledRejection",t,e)});for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},n.resolve=function(e){return e instanceof this?e:c.resolve(new this(u),e)},n.reject=function(e){var t=new this(u);return c.reject(t,e)},n.all=function(e){var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var a=new Array(r),o=0,t=-1,s=new this(u);++t<r;)((e,t)=>{n.resolve(e).then(function(e){a[t]=e,++o!==r||i||(i=!0,c.resolve(s,a))},function(e){i||(i=!0,c.reject(s,e))})})(e[t],t);return s},n.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var i=-1,a=new this(u);++i<n;)(e=>{t.resolve(e).then(function(e){r||(r=!0,c.resolve(a,e))},function(e){r||(r=!0,c.reject(a,e))})})(e[i]);return a}}),m=t(function(e,t){var n=null,n=("undefined"==typeof Promise?"undefined":_typeof(Promise))<"u"?Promise:$();t.exports={Promise:n}}),E=t(function(o){var s=p(),u=g(),t=v(),r=Y(),c=m();function e(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}o.newBlob=function(t,n){o.checkSupport("blob");try{return new Blob([t],{type:n})}catch(e){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(t),r.getBlob(n)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var i={stringifyByChunk:function(e,t,n){var r=[],i=0,a=e.length;if(a<=n)return String.fromCharCode.apply(null,e);for(;i<a;)r.push("array"===t||"nodebuffer"===t?String.fromCharCode.apply(null,e.slice(i,Math.min(i+n,a))):String.fromCharCode.apply(null,e.subarray(i,Math.min(i+n,a)))),i+=n;return r.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:(()=>{try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}})(),nodebuffer:(()=>{try{return s.nodebuffer&&1===String.fromCharCode.apply(null,t.allocBuffer(1)).length}catch(e){return!1}})()}};function n(e){var t=65536,n=o.getTypeOf(e),r=!0;if("uint8array"===n?r=i.applyCanBeUsed.uint8array:"nodebuffer"===n&&(r=i.applyCanBeUsed.nodebuffer),r)for(;1<t;)try{return i.stringifyByChunk(e,n,t)}catch(e){t=Math.floor(t/2)}return i.stringifyByChar(e)}function a(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}o.applyFromCharCode=n;var h={};h.string={string:e,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,t.allocBuffer(e.length))}},h.array={string:n,array:e,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return t.newBufferFrom(e)}},h.arraybuffer={string:function(e){return n(new Uint8Array(e))},array:function(e){return a(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:e,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return t.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:n,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:e,nodebuffer:function(e){return t.newBufferFrom(e)}},h.nodebuffer={string:n,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return a(e,new Uint8Array(e.length))},nodebuffer:e},o.transformTo=function(e,t){if(t=t||"",!e)return t;o.checkSupport(e);var n=o.getTypeOf(t);return h[n][e](t)},o.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&t.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(e){for(var t,n="",r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},o.delay=function(e,t,n){r(function(){e.apply(n||null,t||[])})},o.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},o.extend=function(){for(var e,t={},n=0;n<arguments.length;n++)for(e in arguments[n])arguments[n].hasOwnProperty(e)&&"u"<_typeof(t[e])&&(t[e]=arguments[n][e]);return t},o.prepareContent=function(n,e,r,i,a){return c.Promise.resolve(e).then(function(r){return s.blob&&(r instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(r)))&&("undefined"==typeof FileReader?"undefined":_typeof(FileReader))<"u"?new c.Promise(function(t,n){var e=new FileReader;e.onload=function(e){t(e.target.result)},e.onerror=function(e){n(e.target.error)},e.readAsArrayBuffer(r)}):r}).then(function(e){var t=o.getTypeOf(e);return t?("arraybuffer"===t?e=o.transformTo("uint8array",e):"string"===t&&(a?e=u.decode(e):r&&!0!==i&&(e=l(t=e,new(s.uint8array?Uint8Array:Array)(t.length)))),e):c.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}}),C=t(function(e,t){function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){var e;return!(!this.isPaused||this.isFinished||(e=this.isPaused=!1,this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),e))},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n}),A=t(function(i){for(var e,u=E(),c=p(),l=v(),t=C(),h=new Array(256),e=0;e<256;e++)h[e]=252<=e?6:248<=e?5:240<=e?4:224<=e?3:192<=e?2:1;h[254]=h[254]=1;function n(){t.call(this,"utf-8 decode"),this.leftOver=null}function r(){t.call(this,"utf-8 encode")}i.utf8encode=function(e){if(c.nodebuffer)return l.newBufferFrom(e,"utf-8");for(var t,n,r,i,a=e,o=a.length,s=0,u=0;u<o;u++)55296==(64512&(n=a.charCodeAt(u)))&&u+1<o&&56320==(64512&(r=a.charCodeAt(u+1)))&&(n=65536+(n-55296<<10)+(r-56320),u++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new(c.uint8array?Uint8Array:Array)(s),u=i=0;i<s;u++)55296==(64512&(n=a.charCodeAt(u)))&&u+1<o&&56320==(64512&(r=a.charCodeAt(u+1)))&&(n=65536+(n-55296<<10)+(r-56320),u++),n<128?t[i++]=n:(n<2048?t[i++]=192|n>>>6:(n<65536?t[i++]=224|n>>>12:(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63),t[i++]=128|n>>>6&63),t[i++]=128|63&n);return t},i.utf8decode=function(e){if(c.nodebuffer)return u.transformTo("nodebuffer",e).toString("utf-8");for(var t,n,r=e=u.transformTo(c.uint8array?"uint8array":"array",e),i=r.length,a=new Array(2*i),o=0,s=0;s<i;)if((t=r[s++])<128)a[o++]=t;else if(4<(n=h[t]))a[o++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;1<n&&s<i;)t=t<<6|63&r[s++],n--;1<n?a[o++]=65533:t<65536?a[o++]=t:(t-=65536,a[o++]=55296|t>>10&1023,a[o++]=56320|1023&t)}return a.length!==o&&(a.subarray?a=a.subarray(0,o):a.length=o),u.applyFromCharCode(a)},u.inherits(n,t),n.prototype.processChunk=function(e){var t=u.transformTo(c.uint8array?"uint8array":"array",e.data),n=(this.leftOver&&this.leftOver.length&&(c.uint8array?(n=t,(t=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),t.set(n,this.leftOver.length)):t=this.leftOver.concat(t),this.leftOver=null),((e,t)=>{for(var n=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+h[e[n]]>t?n:t})(t)),r=t;n!==t.length&&(c.uint8array?(r=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(r=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:i.utf8decode(r),meta:e.meta})},n.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=n,u.inherits(r,t),r.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=r}),Q=t(function(e,t){var n=C(),r=E();function i(e){n.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(i,n),i.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=i}),ee=t(function(e,t){var i=o().Readable;function n(e,t,n){i.call(this,t),this._helper=e;var r=this;e.on("data",function(e,t){r.push(e)||r._helper.pause(),n&&n(t)}).on("error",function(e){r.emit("error",e)}).on("end",function(){r.push(null)})}E().inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n}),x=t(function(e,t){var u=E(),i=Q(),a=C(),c=g(),n=p(),r=m(),o=null;if(n.nodestream)try{o=ee()}catch(e){}function s(e,s){return new r.Promise(function(t,n){var r=[],i=e._internalType,a=e._outputType,o=e._mimeType;e.on("data",function(e,t){r.push(e),s&&s(t)}).on("error",function(e){r=[],n(e)}).on("end",function(){try{var e=((e,t,n)=>{switch(e){case"blob":return u.newBlob(u.transformTo("arraybuffer",t),n);case"base64":return c.encode(t);default:return u.transformTo(e,t)}})(a,((e,t)=>{for(var n=0,r=null,i=0,a=0;a<t.length;a++)i+=t[a].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(i),a=0;a<t.length;a++)r.set(t[a],n),n+=t[a].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}})(i,r),o);t(e)}catch(e){n(e)}r=[]}).resume()})}function l(e,t,n){var r=t;switch(t){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=t,this._mimeType=n,u.checkSupport(r),this._worker=e.pipe(new i(r)),e.lock()}catch(e){this._worker=new a("error"),this._worker.error(e)}}l.prototype={accumulate:function(e){return s(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){u.delay(t,arguments,n)}),this},resume:function(){return u.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(u.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new o(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=l}),O=t(function(e){e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!0,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null}),te=t(function(e,t){var n=E(),r=C();function i(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(i,r),i.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished)||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0)},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=i}),l=t(function(e,t){var n=E();var s=(()=>{for(var e=[],t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})();t.exports=function(e,t){return"u"<_typeof(e)||!e.length?0:("string"!==n.getTypeOf(e)?(e,t,n,r)=>{var i=s,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e}:(e,t,n,r)=>{var i=s,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t.charCodeAt(o))];return-1^e})(0|t,e,e.length,0)}}),ne=t(function(e,t){var n=C(),r=l();function i(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}E().inherits(i,n),i.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=i}),re=t(function(e,t){var n=E(),r=C();function i(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(i,r),i.prototype.processChunk=function(e){var t;e&&(t=this.streamInfo[this.propName]||0,this.streamInfo[this.propName]=t+e.data.length),r.prototype.processChunk.call(this,e)},t.exports=i}),D=t(function(e,t){var n=m(),r=te(),i=ne(),a=re();function o(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,n){return e.pipe(new i).pipe(new a("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o}),ie=t(function(e,t){for(var n,a=x(),r=te(),o=A(),i=D(),s=C(),u=function(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}},c=(u.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(n=e.toLowerCase())||"text"===n,i=("binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker(),!this._dataBinary);i&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!i&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new s("error")).error(e)}return new a(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){var n;return this._data instanceof i&&this._data.compression.magic===e.magic?this._data.getCompressedWorker():(n=this._decompressWorker(),this._dataBinary||(n=n.pipe(new o.Utf8EncodeWorker)),i.createWorkerFrom(n,e,t))},_decompressWorker:function(){return this._data instanceof i?this._data.getContentWorker():this._data instanceof s?this._data:new r(this._data)}},["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"]),l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},n=0;n<c.length;n++)u.prototype[c[n]]=l;t.exports=u}),J=t(function(t){var e=("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u"&&("undefined"==typeof Uint16Array?"undefined":_typeof(Uint16Array))<"u"&&("undefined"==typeof Int32Array?"undefined":_typeof(Int32Array))<"u";t.assign=function(e){for(var t,n,r=Array.prototype.slice.call(arguments,1);r.length;){var i=r.shift();if(i){if("object"!=_typeof(i))throw new TypeError(i+"must be non-object");for(var a in i)t=i,n=a,Object.prototype.hasOwnProperty.call(t,n)&&(e[a]=i[a])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){for(var t,n,r,i=0,a=0,o=e.length;a<o;a++)i+=e[a].length;for(r=new Uint8Array(i),a=t=0,o=e.length;a<o;a++)n=e[a],r.set(n,t),t+=n.length;return r}},r={arraySet:function(e,t,n,r,i){for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,n)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,r))},t.setTyped(e)}),ae=t(function(e){var a=J(),l=0,h=1;function t(e){for(var t=e.length;0<=--t;)e[t]=0}var s,u,c,f=29,d=256,p=d+1+f,g=30,m=19,C=2*p+1,A=15,r=16,j=7,_=256,y=16,v=17,b=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],H=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],E=new Array(2*(p+2)),x=(t(E),new Array(2*g)),O=(t(x),new Array(512)),D=(t(O),new Array(256)),B=(t(D),new Array(f)),I=(t(B),new Array(g));function T(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function F(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?O[e]:O[256+(e>>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>r-n?(e.bi_buf|=t<<e.bi_valid&65535,i(e,e.bi_buf),e.bi_buf=t>>r-e.bi_valid,e.bi_valid+=n-r):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function z(e,t,n){R(e,n[2*t],n[2*t+1])}function U(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function M(e,t,n){for(var r,i=new Array(A+1),a=0,o=1;o<=A;o++)i[o]=a=a+n[o-1]<<1;for(r=0;r<=t;r++){var s=e[2*r+1];0!==s&&(e[2*r]=U(i[s]++,s))}}function q(e){for(var t=0;t<p;t++)e.dyn_ltree[2*t]=0;for(t=0;t<g;t++)e.dyn_dtree[2*t]=0;for(t=0;t<m;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*_]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function G(e){8<e.bi_valid?i(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function o(e,t,n,r){var i=2*t,a=2*n;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function N(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&o(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!o(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function W(e,t,n){var r,i,a,o,s=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0==r?z(e,i,t):(z(e,(a=D[i])+d+1,t),0!==(o=w[a])&&R(e,i-=B[a],o),z(e,a=P(--r),n),0!==(o=k[a])&&R(e,r-=I[a],o)),s<e.last_lit;);z(e,_,t)}function L(e,t){var n,r,i,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=C,n=0;n<u;n++)0!==a[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):a[2*n+1]=0;for(;e.heap_len<2;)a[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=c,n=e.heap_len>>1;1<=n;n--)N(e,a,n);for(i=u;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,N(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var l,h,f,d,p,g=e,m=t.dyn_tree,_=t.max_code,y=t.stat_desc.static_tree,v=t.stat_desc.has_stree,b=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,k=t.stat_desc.max_length,S=0,E=0;E<=A;E++)g.bl_count[E]=0;for(m[2*g.heap[g.heap_max]+1]=0,l=g.heap_max+1;l<C;l++)k<(E=m[2*m[2*(h=g.heap[l])+1]+1]+1)&&(E=k,S++),m[2*h+1]=E,_<h||(g.bl_count[E]++,d=0,w<=h&&(d=b[h-w]),p=m[2*h],g.opt_len+=p*(E+d),!v)||(g.static_len+=p*(y[2*h+1]+d));if(0!==S){do{for(E=k-1;0===g.bl_count[E];)E--}while(g.bl_count[E]--,g.bl_count[E+1]+=2,g.bl_count[k]--,0<(S-=2));for(E=k;0!==E;E--)for(h=g.bl_count[E];0!==h;)_<(f=g.heap[--l])||(m[2*f+1]!==E&&(g.opt_len+=(E-m[2*f+1])*m[2*f],m[2*f+1]=E),h--)}M(a,c,e.bl_count)}function Z(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s<u&&i===o||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[2*y]++):s<=10?e.bl_tree[2*v]++:e.bl_tree[2*b]++,a=i,c=(s=0)===o?(u=138,3):i===o?(u=6,3):(u=7,4))}function V(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),r=0;r<=n;r++)if(i=o,o=t[2*(r+1)+1],!(++s<u&&i===o)){if(s<c)for(;z(e,i,e.bl_tree),0!=--s;);else 0!==i?(i!==a&&(z(e,i,e.bl_tree),s--),z(e,y,e.bl_tree),R(e,s-3,2)):s<=10?(z(e,v,e.bl_tree),R(e,s-3,3)):(z(e,b,e.bl_tree),R(e,s-11,7));a=i,c=(s=0)===o?(u=138,3):i===o?(u=6,3):(u=7,4)}}t(I);var K=!1;function Y(e,t,n,r){R(e,0+(r?1:0),3),r=t,t=n,n=!0,G(e=e),n&&(i(e,t),i(e,~t)),a.arraySet(e.pending_buf,e.window,r,t,e.pending),e.pending+=t}e._tr_init=function(e){if(!K){for(var t,n,r,i=new Array(A+1),a=0,o=0;o<f-1;o++)for(B[o]=a,t=0;t<1<<w[o];t++)D[a++]=o;for(D[a-1]=o,o=r=0;o<16;o++)for(I[o]=r,t=0;t<1<<k[o];t++)O[r++]=o;for(r>>=7;o<g;o++)for(I[o]=r<<7,t=0;t<1<<k[o]-7;t++)O[256+r++]=o;for(n=0;n<=A;n++)i[n]=0;for(t=0;t<=143;)E[2*t+1]=8,t++,i[8]++;for(;t<=255;)E[2*t+1]=9,t++,i[9]++;for(;t<=279;)E[2*t+1]=7,t++,i[7]++;for(;t<=287;)E[2*t+1]=8,t++,i[8]++;for(M(E,p+1,i),t=0;t<g;t++)x[2*t+1]=5,x[2*t]=U(t,5);s=new T(E,w,d+1,p,A),u=new T(x,k,0,g,A),c=new T(new Array(0),H,0,m,j),K=!0}e.l_desc=new F(e.dyn_ltree,s),e.d_desc=new F(e.dyn_dtree,u),e.bl_desc=new F(e.bl_tree,c),e.bi_buf=0,e.bi_valid=0,q(e)},e._tr_stored_block=Y,e._tr_flush_block=function(e,t,n,r){var i,a,o,s=0;if(0<e.level?(2===e.strm.data_type&&(e.strm.data_type=(e=>{for(var t=4093624447,n=0;n<=31;n++,t>>>=1)if(1&t&&0!==e.dyn_ltree[2*n])return l;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(n=32;n<d;n++)if(0!==e.dyn_ltree[2*n])return h;return l})(e)),L(e,e.l_desc),L(e,e.d_desc),s=(e=>{var t;for(Z(e,e.dyn_ltree,e.l_desc.max_code),Z(e,e.dyn_dtree,e.d_desc.max_code),L(e,e.bl_desc),t=m-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),(a=e.static_len+3+7>>>3)<=(i=e.opt_len+3+7>>>3)&&(i=a)):i=a=n+5,n+4<=i&&-1!==t)Y(e,t,n,r);else if(4===e.strategy||a===i)R(e,2+(r?1:0),3),W(e,E,x);else{R(e,4+(r?1:0),3);var u=e,c=(t=e.l_desc.max_code+1,n=e.d_desc.max_code+1,s+1);for(R(u,t-257,5),R(u,n-1,5),R(u,c-4,4),o=0;o<c;o++)R(u,u.bl_tree[2*S[o]+1],3);V(u,u.dyn_ltree,t-1),V(u,u.dyn_dtree,n-1),W(e,e.dyn_ltree,e.dyn_dtree)}q(e),r&&G(e)},e._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(D[n]+d+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){R(e,2,3),z(e,_,E),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}}),oe=t(function(e,t){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){for(n-=o=2e3<n?2e3:n;a=a+(i=i+t[r++]|0)|0,--o;);i%=65521,a%=65521}return i|a<<16|0}}),se=t(function(e,t){var s=(()=>{for(var e=[],t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})();t.exports=function(e,t,n,r){var i=s,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e}}),Z=t(function(e,t){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}}),ue=t(function(e){var s,h=J(),u=ae(),f=oe(),d=se(),z=Z(),c=0,l=4,p=0,g=-2,N=-1,L=4,j=2,m=8,H=9,t=286,U=30,M=19,q=2*t+1,G=15,_=3,y=258,v=y+_+1,b=42,w=113,k=1,S=2,E=3,C=4;function A(e,t){return e.msg=z[t],t}function x(e){return(e<<1)-(4<e?9:0)}function O(e){for(var t=e.length;0<=--t;)e[t]=0}function D(e){var t=e.state,n=t.pending;0!==(n=e.avail_out<n?e.avail_out:n)&&(h.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending)&&(t.pending_out=0)}function B(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,D(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function T(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function a(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.w_size-v<e.strstart?e.strstart-(e.w_size-v):0,c=e.window,l=e.w_mask,h=e.prev,f=e.strstart+y,d=c[a+o-1],p=c[a+o];e.good_match<=e.prev_length&&(i>>=2),e.lookahead<s&&(s=e.lookahead);do{if(c[(n=t)+o]===p&&c[n+o-1]===d&&c[n]===c[a]&&c[++n]===c[a+1]){for(a+=2,n++;c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&a<f;);if(r=y-(f-a),a=f-y,o<r){if(e.match_start=t,s<=(o=r))break;d=c[a+o-1],p=c[a+o]}}}while((t=h[t&l])>u&&0!=--i);return o<=e.lookahead?o:e.lookahead}function F(e){var t,n,r,i,a,o,s,u,c,l=e.w_size;do{if(u=e.window_size-e.lookahead-e.strstart,l+(l-v)<=e.strstart){for(h.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=n=e.hash_size;r=e.head[--t],e.head[t]=l<=r?r-l:0,--n;);for(t=n=l;r=e.prev[--t],e.prev[t]=l<=r?r-l:0,--n;);u+=l}if(0===e.strm.avail_in)break;if(o=e.window,s=e.strstart+e.lookahead,u=u,c=void 0,c=(a=e.strm).avail_in,n=0===(c=u<c?u:c)?0:(a.avail_in-=c,h.arraySet(o,a.input,a.next_in,c,s),1===a.state.wrap?a.adler=f(a.adler,o,c,s):2===a.state.wrap&&(a.adler=d(a.adler,o,c,s)),a.next_in+=c,a.total_in+=c,c),e.lookahead+=n,_<=e.lookahead+e.insert)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<<e.hash_shift^e.window[i+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[i+_-1])&e.hash_mask,e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<_)););}while(e.lookahead<v&&0!==e.strm.avail_in)}function n(e,t){for(var n,r;;){if(e.lookahead<v){if(F(e),e.lookahead<v&&t===c)return k;if(0===e.lookahead)break}if(n=0,_<=e.lookahead&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-v&&(e.match_length=a(e,n)),_<=e.match_length)if(r=u._tr_tally(e,e.strstart-e.match_start,e.match_length-_),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=_){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(B(e,!1),0===e.strm.avail_out))return k}return e.insert=e.strstart<_-1?e.strstart:_-1,t===l?(B(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?k:S}function r(e,t){for(var n,r,i;;){if(e.lookahead<v){if(F(e),e.lookahead<v&&t===c)return k;if(0===e.lookahead)break}if(n=0,_<=e.lookahead&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=_-1,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-v&&(e.match_length=a(e,n),e.match_length<=5)&&(1===e.strategy||e.match_length===_&&4096<e.strstart-e.match_start)&&(e.match_length=_-1),_<=e.prev_length&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-_,r=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-_),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=_-1,e.strstart++,r&&(B(e,!1),0===e.strm.avail_out))return k}else if(e.match_available){if((r=u._tr_tally(e,0,e.window[e.strstart-1]))&&B(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return k}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=u._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<_-1?e.strstart:_-1,t===l?(B(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?k:S}function i(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function W(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new h.Buf16(2*q),this.dyn_dtree=new h.Buf16(2*(2*U+1)),this.bl_tree=new h.Buf16(2*(2*M+1)),O(this.dyn_ltree),O(this.dyn_dtree),O(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new h.Buf16(G+1),this.heap=new h.Buf16(2*t+1),O(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new h.Buf16(2*t+1),O(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function o(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=j,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?b:w,e.adler=2===t.wrap?0:1,t.last_flush=c,u._tr_init(t),p):A(e,g)}function P(e){var t=o(e);return t===p&&((e=e.state).window_size=2*e.w_size,O(e.head),e.max_lazy_match=s[e.level].max_lazy,e.good_match=s[e.level].good_length,e.nice_match=s[e.level].nice_length,e.max_chain_length=s[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=_-1,e.match_available=0,e.ins_h=0),t}function R(e,t,n,r,i,a){if(!e)return g;var o=1;if(t===N&&(t=6),r<0?(o=0,r=-r):15<r&&(o=2,r-=16),i<1||H<i||n!==m||r<8||15<r||t<0||9<t||a<0||L<a)return A(e,g);8===r&&(r=9);var s=new W;return(e.state=s).strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+_-1)/_),s.window=new h.Buf8(2*s.w_size),s.head=new h.Buf16(s.hash_size),s.prev=new h.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new h.Buf8(s.pending_buf_size),s.d_buf=+s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,P(e)}s=[new i(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(F(e),0===e.lookahead&&t===c)return k;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,B(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-v&&(B(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?E:C):(e.strstart>e.block_start&&(B(e,!1),e.strm.avail_out),k)}),new i(4,4,8,4,n),new i(4,5,16,8,n),new i(4,6,32,32,n),new i(4,4,16,16,r),new i(8,16,32,32,r),new i(8,16,128,128,r),new i(8,32,128,256,r),new i(32,128,258,1024,r),new i(32,258,258,4096,r)],e.deflateInit=function(e,t){return R(e,t,m,15,8,0)},e.deflateInit2=R,e.deflateReset=P,e.deflateResetKeep=o,e.deflateSetHeader=function(e,t){return e&&e.state&&2===e.state.wrap?(e.state.gzhead=t,p):g},e.deflate=function(e,t){var n,r,i,a;if(!e||!e.state||5<t||t<0)return e?A(e,g):g;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&t!==l)return A(e,0===e.avail_out?-5:g);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===b&&(2===r.wrap?(e.adler=0,I(r,31),I(r,139),I(r,8),r.gzhead?(I(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),I(r,255&r.gzhead.time),I(r,r.gzhead.time>>8&255),I(r,r.gzhead.time>>16&255),I(r,r.gzhead.time>>24&255),I(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),I(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(I(r,255&r.gzhead.extra.length),I(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=d(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(I(r,0),I(r,0),I(r,0),I(r,0),I(r,0),I(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),I(r,3),r.status=w)):(o=m+(r.w_bits-8<<4)<<8,o|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(o|=32),o+=31-o%31,r.status=w,T(r,o),0!==r.strstart&&(T(r,e.adler>>>16),T(r,65535&e.adler)),e.adler=1)),69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),D(e),i=r.pending,r.pending!==r.pending_buf_size));)I(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),D(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}}while(a=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,I(r,a),0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),D(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}}while(a=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,I(r,a),0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&D(e),r.pending+2<=r.pending_buf_size&&(I(r,255&e.adler),I(r,e.adler>>8&255),e.adler=0,r.status=w)):r.status=w),0!==r.pending){if(D(e),0===e.avail_out)return r.last_flush=-1,p}else if(0===e.avail_in&&x(t)<=x(n)&&t!==l)return A(e,-5);if(666===r.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==r.lookahead||t!==c&&666!==r.status){var o=2===r.strategy?((e,t)=>{for(var n;;){if(0===e.lookahead&&(F(e),0===e.lookahead)){if(t===c)return k;break}if(e.match_length=0,n=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(B(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?k:S})(r,t):3===r.strategy?((e,t)=>{for(var n,r,i,a,o=e.window;;){if(e.lookahead<=y){if(F(e),e.lookahead<=y&&t===c)return k;if(0===e.lookahead)break}if(e.match_length=0,_<=e.lookahead&&0<e.strstart&&(r=o[i=e.strstart-1])===o[++i]&&r===o[++i]&&r===o[++i]){for(a=e.strstart+y;r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a;);e.match_length=y-(a-i),e.lookahead<e.match_length&&(e.match_length=e.lookahead)}if(_<=e.match_length?(n=u._tr_tally(e,1,e.match_length-_),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(B(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?k:S})(r,t):s[r.level].func(r,t);if(o!==E&&o!==C||(r.status=666),o===k||o===E)return 0===e.avail_out&&(r.last_flush=-1),p;if(o===S&&(1===t?u._tr_align(r):5!==t&&(u._tr_stored_block(r,0,0,!1),3===t)&&(O(r.head),0===r.lookahead)&&(r.strstart=0,r.block_start=0,r.insert=0),D(e),0===e.avail_out))return r.last_flush=-1,p}return t!==l||!(r.wrap<=0)&&(2===r.wrap?(I(r,255&e.adler),I(r,e.adler>>8&255),I(r,e.adler>>16&255),I(r,e.adler>>24&255),I(r,255&e.total_in),I(r,e.total_in>>8&255),I(r,e.total_in>>16&255),I(r,e.total_in>>24&255)):(T(r,e.adler>>>16),T(r,65535&e.adler)),D(e),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending)?p:1},e.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==b&&69!==t&&73!==t&&91!==t&&103!==t&&t!==w&&666!==t?A(e,g):(e.state=null,t===w?A(e,-3):p):g},e.deflateSetDictionary=function(e,t){var n,r,i,a,o,s,u,c=t.length;if(!e||!e.state||2===(a=(n=e.state).wrap)||1===a&&n.status!==b||n.lookahead)return g;for(1===a&&(e.adler=f(e.adler,t,c,0)),n.wrap=0,c>=n.w_size&&(0===a&&(O(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new h.Buf8(n.w_size),h.arraySet(u,t,c-n.w_size,n.w_size,0),t=u,c=n.w_size),u=e.avail_in,o=e.next_in,s=e.input,e.avail_in=c,e.next_in=0,e.input=t,F(n);n.lookahead>=_;){for(r=n.strstart,i=n.lookahead-(_-1);n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+_-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--i;);n.strstart=r,n.lookahead=_-1,F(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=_-1,n.match_available=0,e.next_in=o,e.input=s,e.avail_in=u,n.wrap=a,p},e.deflateInfo="pako deflate (from Nodeca project)"}),ce=t(function(e){var u=J(),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var t,c=new u.Buf8(256),t=0;t<256;t++)c[t]=252<=t?6:248<=t?5:240<=t?4:224<=t?3:192<=t?2:1;function l(e,t){if(t<65534&&(e.subarray&&a||!e.subarray&&i))return String.fromCharCode.apply(null,u.shrinkBuf(e,t));for(var n="",r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n}c[254]=c[254]=1,e.string2buf=function(e){for(var t,n,r,i,a=e.length,o=0,s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),o+=n<128?1:n<2048?2:n<65536?3:4;for(t=new u.Buf8(o),s=i=0;i<o;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),n<128?t[i++]=n:(n<2048?t[i++]=192|n>>>6:(n<65536?t[i++]=224|n>>>12:(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63),t[i++]=128|n>>>6&63),t[i++]=128|63&n);return t},e.buf2binstring=function(e){return l(e,e.length)},e.binstring2buf=function(e){for(var t=new u.Buf8(e.length),n=0,r=t.length;n<r;n++)t[n]=e.charCodeAt(n);return t},e.buf2string=function(e,t){for(var n,r,i=t||e.length,a=new Array(2*i),o=0,s=0;s<i;)if((n=e[s++])<128)a[o++]=n;else if(4<(r=c[n]))a[o++]=65533,s+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&s<i;)n=n<<6|63&e[s++],r--;1<r?a[o++]=65533:n<65536?a[o++]=n:(n-=65536,a[o++]=55296|n>>10&1023,a[o++]=56320|1023&n)}return l(a,o)},e.utf8border=function(e,t){for(var n=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+c[e[n]]>t?n:t}}),le=t(function(e,t){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}),he=t(function(e){var o=ue(),s=J(),u=ce(),n=Z(),r=le(),c=Object.prototype.toString;function i(e){if(!(this instanceof i))return new i(e);this.options=s.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});e=this.options;if(e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,(this.strm.avail_out=0)!==(t=o.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy)))throw new Error(n[t]);if(e.header&&o.deflateSetHeader(this.strm,e.header),e.dictionary){var t,e="string"==typeof e.dictionary?u.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary;if(0!==(t=o.deflateSetDictionary(this.strm,e)))throw new Error(n[t]);this._dict_set=!0}}function a(e,t){t=new i(t);if(t.push(e,!0),t.err)throw t.msg||n[t.err];return t.result}i.prototype.push=function(e,t){var n,r,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=u.string2buf(e):"[object ArrayBuffer]"===c.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new s.Buf8(a),i.next_out=0,i.avail_out=a),1!==(n=o.deflate(i,r))&&0!==n)return this.onEnd(n),!(this.ended=!0)}while(0!==i.avail_out&&(0!==i.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(u.buf2binstring(s.shrinkBuf(i.output,i.next_out))):this.onData(s.shrinkBuf(i.output,i.next_out))),(0<i.avail_in||0===i.avail_out)&&1!==n);return 4===r?(n=o.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):(2===r&&(this.onEnd(0),i.avail_out=0),!0)},i.prototype.onData=function(e){this.chunks.push(e)},i.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.Deflate=i,e.deflate=a,e.deflateRaw=function(e,t){return(t=t||{}).raw=!0,a(e,t)},e.gzip=function(e,t){return(t=t||{}).gzip=!0,a(e,t)}}),fe=t(function(e,t){t.exports=function(e,t){var n,r,i,a,o,s,u=e.state,c=e.next_in,l=e.input,h=c+(e.avail_in-5),f=e.next_out,d=e.output,p=f-(t-e.avail_out),g=f+(e.avail_out-257),m=u.dmax,_=u.wsize,y=u.whave,v=u.wnext,b=u.window,w=u.hold,k=u.bits,S=u.lencode,E=u.distcode,C=(1<<u.lenbits)-1,A=(1<<u.distbits)-1;e:do{for(k<15&&(w+=l[c++]<<k,k+=8,w+=l[c++]<<k,k+=8),n=S[w&C];;){if(w>>>=r=n>>>24,k-=r,0===(r=n>>>16&255))d[f++]=65535&n;else{if(!(16&r)){if(0==(64&r)){n=S[(65535&n)+(w&(1<<r)-1)];continue}if(32&r){u.mode=12;break e}e.msg="invalid literal/length code",u.mode=30;break e}for(i=65535&n,(r&=15)&&(k<r&&(w+=l[c++]<<k,k+=8),i+=w&(1<<r)-1,w>>>=r,k-=r),k<15&&(w+=l[c++]<<k,k+=8,w+=l[c++]<<k,k+=8),n=E[w&A];;){if(w>>>=r=n>>>24,k-=r,!(16&(r=n>>>16&255))){if(0==(64&r)){n=E[(65535&n)+(w&(1<<r)-1)];continue}e.msg="invalid distance code",u.mode=30;break e}if(a=65535&n,k<(r&=15)&&(w+=l[c++]<<k,(k+=8)<r)&&(w+=l[c++]<<k,k+=8),m<(a+=w&(1<<r)-1)){e.msg="invalid distance too far back",u.mode=30;break e}if(w>>>=r,k-=r,(r=f-p)<a){if(y<(r=a-r)&&u.sane){e.msg="invalid distance too far back",u.mode=30;break e}if(s=b,(o=0)===v){if(o+=_-r,r<i){for(i-=r;d[f++]=b[o++],--r;);o=f-a,s=d}}else if(v<r){if(o+=_+v-r,(r-=v)<i){for(i-=r;d[f++]=b[o++],--r;);if(o=0,v<i){for(i-=r=v;d[f++]=b[o++],--r;);o=f-a,s=d}}}else if(o+=v-r,r<i){for(i-=r;d[f++]=b[o++],--r;);o=f-a,s=d}for(;2<i;)d[f++]=s[o++],d[f++]=s[o++],d[f++]=s[o++],i-=3;i&&(d[f++]=s[o++],1<i)&&(d[f++]=s[o++])}else{for(o=f-a;d[f++]=d[o++],d[f++]=d[o++],d[f++]=d[o++],2<(i-=3););i&&(d[f++]=d[o++],1<i)&&(d[f++]=d[o++])}break}}break}}while(c<h&&f<g);w&=(1<<(k-=(i=k>>3)<<3))-1,e.next_in=c-=i,e.next_out=f,e.avail_in=c<h?h-c+5:5-(c-h),e.avail_out=f<g?g-f+257:257-(f-g),u.hold=w,u.bits=k}}),de=t(function(e,t){var P=J(),R=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],z=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],N=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,r,i,a,o,s){for(var u,c,l,h,f,d,p,g,m,_=s.bits,y=0,v=0,b=0,w=0,k=0,S=0,E=0,C=0,A=0,x=0,O=null,D=0,B=new P.Buf16(16),I=new P.Buf16(16),T=null,F=0,y=0;y<=15;y++)B[y]=0;for(v=0;v<r;v++)B[t[n+v]]++;for(k=_,w=15;1<=w&&0===B[w];w--);if(w<k&&(k=w),0===w)i[a++]=20971520,i[a++]=20971520,s.bits=1;else{for(b=1;b<w&&0===B[b];b++);for(k<b&&(k=b),y=C=1;y<=15;y++)if((C=(C<<1)-B[y])<0)return-1;if(0<C&&(0===e||1!==w))return-1;for(I[1]=0,y=1;y<15;y++)I[y+1]=I[y]+B[y];for(v=0;v<r;v++)0!==t[n+v]&&(o[I[t[n+v]]++]=v);if(d=0===e?(O=T=o,19):1===e?(O=R,D-=257,T=z,F-=257,256):(O=N,T=L,-1),y=b,f=a,E=v=x=0,l=-1,h=(A=1<<(S=k))-1,1===e&&852<A||2===e&&592<A)return 1;for(;;){for(m=o[v]<d?(g=0,o[v]):o[v]>d?(g=T[F+o[v]],O[D+o[v]]):(g=96,0),u=1<<(p=y-E),b=c=1<<S;i[f+(x>>E)+(c-=u)]=p<<24|g<<16|m|0,0!==c;);for(u=1<<y-1;x&u;)u>>=1;if(0!==u?x=(x&u-1)+u:x=0,v++,0==--B[y]){if(y===w)break;y=t[n+o[v]]}if(k<y&&(x&h)!==l){for(f+=b,C=1<<(S=y-(E=0===E?k:E));S+E<w&&!((C-=B[S+E])<=0);)S++,C<<=1;if(A+=1<<S,1===e&&852<A||2===e&&592<A)return 1;i[l=x&h]=k<<24|S<<16|f-a|0}}0!==x&&(i[f+x]=y-E<<24|64<<16|0),s.bits=k}return 0}}),pe=t(function(e){var I=J(),T=oe(),F=se(),P=fe(),R=de(),z=1,N=2,L=0,j=-2,H=1,n=852,r=592;function U(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=H,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(r),t.sane=1,t.back=-1,L):j}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):j}function s(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t))?j:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,o(e))}function t(e,t){var n;return e?(n=new i,(e.state=n).window=null,(n=s(e,t))!==L&&(e.state=null),n):j}var M,q,G=!0;function W(e,t,n,r){var i,e=e.state;return null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new I.Buf8(e.wsize)),e.wsize<=r?(I.arraySet(e.window,t,n-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(r<(i=e.wsize-e.wnext)&&(i=r),I.arraySet(e.window,t,n-r,i,e.wnext),(r-=i)?(I.arraySet(e.window,t,n-r,r,0),e.wnext=r,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=i))),0}e.inflateReset=o,e.inflateReset2=s,e.inflateResetKeep=a,e.inflateInit=function(e){return t(e,15)},e.inflateInit2=t,e.inflate=function(e,t){var n,r,i,a,o,s,u,c,l,h,f,d,p,g,m,_,y,v,b,w,k,S,E,C,A=0,x=new I.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return j;12===(n=e.state).mode&&(n.mode=13),o=e.next_out,i=e.output,a=e.next_in,r=e.input,c=n.hold,l=n.bits,h=s=e.avail_in,f=u=e.avail_out,S=L;e:for(;;)switch(n.mode){case H:if(0===n.wrap)n.mode=13;else{for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(2&n.wrap&&35615===c)x[n.check=0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0),l=c=0,n.mode=2;else if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",n.mode=30;else if(8!=(15&c))e.msg="unknown compression method",n.mode=30;else{if(l-=4,k=8+(15&(c>>>=4)),0===n.wbits)n.wbits=k;else if(k>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<k,e.adler=n.check=1,n.mode=512&c?10:12,l=c=0}}break;case 2:for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(n.flags=c,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0)),l=c=0,n.mode=3;case 3:for(;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.head&&(n.head.time=c),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,x[2]=c>>>16&255,x[3]=c>>>24&255,n.check=F(n.check,x,4,0)),l=c=0,n.mode=4;case 4:for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0)),l=c=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0)),l=c=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((d=s<(d=n.length)?s:d)&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),I.arraySet(n.head.extra,r,a,d,k)),512&n.flags&&(n.check=F(n.check,r,d,a)),s-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;for(d=0;k=r[a+d++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k)),k&&d<s;);if(512&n.flags&&(n.check=F(n.check,r,d,a)),s-=d,a+=d,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break e;for(d=0;k=r[a+d++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k)),k&&d<s;);if(512&n.flags&&(n.check=F(n.check,r,d,a)),s-=d,a+=d,k)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}l=c=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}e.adler=n.check=U(c),l=c=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=l,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last)c>>>=7&l,l-=7&l,n.mode=27;else{for(;l<3;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}switch(n.last=1&c,--l,3&(c>>>=1)){case 0:n.mode=14;break;case 1:D=B=void 0;var D,B=n;if(G){for(M=new I.Buf32(512),q=new I.Buf32(32),D=0;D<144;)B.lens[D++]=8;for(;D<256;)B.lens[D++]=9;for(;D<280;)B.lens[D++]=7;for(;D<288;)B.lens[D++]=8;for(R(z,B.lens,0,288,M,0,B.work,{bits:9}),D=0;D<32;)B.lens[D++]=5;R(N,B.lens,0,32,q,0,B.work,{bits:5}),G=!1}if(B.lencode=M,B.lenbits=9,B.distcode=q,B.distbits=5,n.mode=20,6!==t)break;c>>>=2,l-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}c>>>=2,l-=2}break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&c,l=c=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(d=n.length){if(0===(d=u<(d=s<d?s:d)?u:d))break e;I.arraySet(i,r,a,d,o),s-=d,a+=d,u-=d,o+=d,n.length-=d}else n.mode=12;break;case 17:for(;l<14;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(n.nlen=257+(31&c),c>>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;l<3;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.lens[O[n.have++]]=7&c,c>>>=3,l-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},S=R(0,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;_=(A=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,y=65535&A,!((m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(y<16)c>>>=m,l-=m,n.lens[n.have++]=y;else{if(16===y){for(C=m+2;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(c>>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}k=n.lens[n.have-1],d=3+(3&c),c>>>=2,l-=2}else if(17===y){for(C=m+3;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}k=0,d=3+(7&(c>>>=m)),c>>>=3,l=l-m-3}else{for(C=m+7;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}k=0,d=11+(127&(c>>>=m)),c>>>=7,l=l-m-7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;d--;)n.lens[n.have++]=k}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,E={bits:n.lenbits},S=R(z,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},S=R(N,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,S){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=s&&258<=u){e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=l,P(e,f),o=e.next_out,i=e.output,u=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;_=(A=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,y=65535&A,!((m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(_&&0==(240&_)){for(v=m,b=_,w=y;_=(A=n.lencode[w+((c&(1<<v+b)-1)>>v)])>>>16&255,y=65535&A,!(v+(m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=m,l-=m,n.back+=m,n.length=y,0===_){n.mode=26;break}if(32&_){n.back=-1,n.mode=12;break}if(64&_){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&_,n.mode=22;case 22:if(n.extra){for(C=n.extra;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;_=(A=n.distcode[c&(1<<n.distbits)-1])>>>16&255,y=65535&A,!((m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(0==(240&_)){for(v=m,b=_,w=y;_=(A=n.distcode[w+((c&(1<<v+b)-1)>>v)])>>>16&255,y=65535&A,!(v+(m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=m,l-=m,n.back+=m,64&_){e.msg="invalid distance code",n.mode=30;break}n.offset=y,n.extra=15&_,n.mode=24;case 24:if(n.extra){for(C=n.extra;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===u)break e;if(n.offset>(d=f-u)){if((d=n.offset-d)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}p=d>n.wnext?(d-=n.wnext,n.wsize-d):n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=o-n.offset,d=n.length;for(u-=d=u<d?u:d,n.length-=d;i[o++]=g[p++],--d;);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;i[o++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(0===s)break e;s--,c|=r[a++]<<l,l+=8}if(f-=u,e.total_out+=f,n.total+=f,f&&(e.adler=n.check=(n.flags?F:T)(n.check,i,f,o-f)),f=u,(n.flags?c:U(c))!==n.check){e.msg="incorrect data check",n.mode=30;break}l=c=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}l=c=0}n.mode=29;case 29:S=1;break e;case 30:S=-3;break e;case 31:return-4;default:return j}return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=l,(n.wsize||f!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&W(e,e.output,e.next_out,f-e.avail_out)?(n.mode=31,-4):(h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,n.total+=f,n.wrap&&f&&(e.adler=n.check=(n.flags?F:T)(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),S=(0==h&&0===f||4===t)&&S===L?-5:S)},e.inflateEnd=function(e){var t;return e&&e.state?((t=e.state).window&&(t.window=null),e.state=null,L):j},e.inflateGetHeader=function(e,t){return e&&e.state&&0!=(2&(e=e.state).wrap)?((e.head=t).done=!1,L):j},e.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state&&(0===(n=e.state).wrap||11===n.mode)?11===n.mode&&T(1,t,r,0)!==n.check?-3:W(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,L):j},e.inflateInfo="pako inflate (from Nodeca project)"}),ge=t(function(e,t){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}}),me=t(function(e,t){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}),_e=t(function(e){var h=pe(),f=J(),d=ce(),p=ge(),n=Z(),r=le(),i=me(),g=Object.prototype.toString;function a(e){if(!(this instanceof a))return new a(e);this.options=f.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options,e=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits)&&(t.windowBits=-15),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,this.strm.avail_out=0,h.inflateInit2(this.strm,t.windowBits));if(e!==p.Z_OK)throw new Error(n[e]);if(this.header=new i,h.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=d.string2buf(t.dictionary):"[object ArrayBuffer]"===g.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=h.inflateSetDictionary(this.strm,t.dictionary))!==p.Z_OK)throw new Error(n[e])}function o(e,t){t=new a(t);if(t.push(e,!0),t.err)throw t.msg||n[t.err];return t.result}a.prototype.push=function(e,t){var n,r,i,a,o,s=this.strm,u=this.options.chunkSize,c=this.options.dictionary,l=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?p.Z_FINISH:p.Z_NO_FLUSH,"string"==typeof e?s.input=d.binstring2buf(e):"[object ArrayBuffer]"===g.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new f.Buf8(u),s.next_out=0,s.avail_out=u),(n=(n=h.inflate(s,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&c?h.inflateSetDictionary(this.strm,c):n)===p.Z_BUF_ERROR&&!0===l&&(n=p.Z_OK,l=!1),n!==p.Z_STREAM_END&&n!==p.Z_OK)return this.onEnd(n),!(this.ended=!0)}while(!s.next_out||0!==s.avail_out&&n!==p.Z_STREAM_END&&(0!==s.avail_in||r!==p.Z_FINISH&&r!==p.Z_SYNC_FLUSH)||("string"===this.options.to?(i=d.utf8border(s.output,s.next_out),a=s.next_out-i,o=d.buf2string(s.output,i),s.next_out=a,s.avail_out=u-a,a&&f.arraySet(s.output,s.output,i,a,0),this.onData(o)):this.onData(f.shrinkBuf(s.output,s.next_out))),0===s.avail_in&&0===s.avail_out&&(l=!0),(0<s.avail_in||0===s.avail_out)&&n!==p.Z_STREAM_END);return(r=n===p.Z_STREAM_END?p.Z_FINISH:r)===p.Z_FINISH?(n=h.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===p.Z_OK):(r===p.Z_SYNC_FLUSH&&(this.onEnd(p.Z_OK),s.avail_out=0),!0)},a.prototype.onData=function(e){this.chunks.push(e)},a.prototype.onEnd=function(e){e===p.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=f.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.Inflate=a,e.inflate=o,e.inflateRaw=function(e,t){return(t=t||{}).raw=!0,o(e,t)},e.ungzip=o}),ye=t(function(e,t){var n={};(0,J().assign)(n,he(),_e(),ge()),t.exports=n}),ve=t(function(e){var t=("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u"&&("undefined"==typeof Uint16Array?"undefined":_typeof(Uint16Array))<"u"&&("undefined"==typeof Uint32Array?"undefined":_typeof(Uint32Array))<"u",n=ye(),r=E(),i=C(),a=t?"uint8array":"array";function o(e,t){i.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}e.magic="\b\0",r.inherits(o,i),o.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,e.data),!1)},o.prototype.flush=function(){i.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},o.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},e.compressWorker=function(e){return new o("Deflate",e)},e.uncompressWorker=function(){return new o("Inflate",{})}}),be=t(function(e){var t=C();e.STORE={magic:"\0\0",compressWorker:function(e){return new t("STORE compression")},uncompressWorker:function(){return new t("STORE decompression")}},e.DEFLATE=ve()}),we=t(function(e){e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\b"}),ke=t(function(e,t){function y(e,t){for(var n="",r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function r(e,t,n,r,i,a){var o=e.file,s=e.compression,u=a!==b.utf8encode,c=v.transformTo("string",a(o.name)),l=v.transformTo("string",b.utf8encode(o.name)),h=o.comment,a=v.transformTo("string",a(h)),f=v.transformTo("string",b.utf8encode(h)),d=l.length!==o.name.length,h=f.length!==h.length,p="",g=o.dir,m=o.date,_={crc32:0,compressedSize:0,uncompressedSize:0},n=(t&&!n||(_.crc32=e.crc32,_.compressedSize=e.compressedSize,_.uncompressedSize=e.uncompressedSize),0),e=(t&&(n|=8),u||!d&&!h||(n|=2048),0),t=0,m=(g&&(e|=16),"UNIX"===i?(t=798,e|=(u=o.unixPermissions,i=g,(65535&(u?u:i?16893:33204))<<16)):(t=20,e|=63&(o.dosPermissions||0)),g=m.getUTCHours(),g<<=6,g=(g=(g|m.getUTCMinutes())<<5)|m.getUTCSeconds()/2,u=m.getUTCFullYear()-1980,u=(u=((u<<=4)|m.getUTCMonth()+1)<<5)|m.getUTCDate(),d&&(i=y(1,1)+y(w(c),4)+l,p+="up"+y(i.length,2)+i),h&&(o=y(1,1)+y(w(a),4)+f,p+="uc"+y(o.length,2)+o),""),m=(m=(m=(m=(m=(m=(m=(m=(m=(m+="\n\0")+y(n,2))+s.magic)+y(g,2))+y(u,2))+y(_.crc32,4))+y(_.compressedSize,4))+y(_.uncompressedSize,4))+y(c.length,2))+y(p.length,2);return{fileRecord:k.LOCAL_FILE_HEADER+m+c+p,dirRecord:k.CENTRAL_FILE_HEADER+y(t,2)+m+y(a.length,2)+"\0\0\0\0"+y(e,4)+y(r,4)+c+p+a}}var v=E(),i=C(),b=A(),w=l(),k=we();function n(e,t,n,r){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}v.inherits(n,i),n.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},n.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;t?(e=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName),this.push({data:e.fileRecord,meta:{percent:0}})):this.accumulate=!0},n.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:(t=e,k.DATA_DESCRIPTOR+y(t.crc32,4)+y(t.compressedSize,4)+y(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},n.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,n=((e,t,n,r,i)=>(i=v.transformTo("string",i(r)),k.CENTRAL_DIRECTORY_END+"\0\0\0\0"+y(e,2)+y(e,2)+y(t,4)+y(n,4)+y(i.length,2)+i))(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},n.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},n.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},n.prototype.error=function(e){var t=this._sources;if(!i.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},n.prototype.lock=function(){i.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=n}),Se=t(function(e){var c=be(),n=ke();e.generateWorker=function(e,o,t){var s=new n(o.streamFiles,t,o.platform,o.encodeFileName),u=0;try{e.forEach(function(e,t){u++;var n=((e,t)=>{if(t=c[e=e||t])return t;throw new Error(e+" is not a valid compression method !")})(t.options.compression,o.compression),r=t.options.compressionOptions||o.compressionOptions||{},i=t.dir,a=t.date;t._compressWorker(n,r).withStreamInfo("file",{name:e,dir:i,date:a,comment:t.comment||"",unixPermissions:t.unixPermissions,dosPermissions:t.dosPermissions}).pipe(s)}),s.entriesCount=u}catch(e){s.error(e)}return s}}),Ee=t(function(e,t){var n=E(),r=C();function i(e,t){r.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(i,r),i.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},i.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=i}),Ce=t(function(e,t){function o(e){var t=(e="/"===e.slice(-1)?e.substring(0,e.length-1):e).lastIndexOf("/");return 0<t?e.substring(0,t):""}function s(e,t){return t=_typeof(t)<"u"?t:l.createFolders,e=_(e),this.files[e]||m.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]}var i=A(),u=E(),c=C(),a=x(),l=O(),h=D(),f=ie(),d=Se(),p=v(),g=Ee(),m=function(e,t,n){var r=u.getTypeOf(t),i=u.extend(n||{},l),a=(i.date=i.date||new Date,null!==i.compression&&(i.compression=i.compression.toUpperCase()),"string"==typeof i.unixPermissions&&(i.unixPermissions=parseInt(i.unixPermissions,8)),i.unixPermissions&&16384&i.unixPermissions&&(i.dir=!0),i.dosPermissions&&16&i.dosPermissions&&(i.dir=!0),i.dir&&(e=_(e)),i.createFolders&&(a=o(e))&&s.call(this,a,!0),"string"===r&&!1===i.binary&&!1===i.base64);(!n||"u"<_typeof(n.binary))&&(i.binary=!a);(t instanceof h&&0===t.uncompressedSize||i.dir||!t||0===t.length)&&(i.base64=!1,i.binary=!0,t="",i.compression="STORE");r=null,r=t instanceof h||t instanceof c?t:p.isNode&&p.isStream(t)?new g(e,t):u.prepareContent(e,t,i.binary,i.optimizedBinaryString,i.base64),n=new f(e,r,i);this.files[e]=n},_=function(e){return"/"!==e.slice(-1)&&(e+="/"),e};function y(e){return"[object RegExp]"===Object.prototype.toString.call(e)}t.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)r=this.files[t],n=t.slice(this.root.length,t.length),n&&t.slice(0,this.root.length)===this.root&&e(n,r)},filter:function(n){var r=[];return this.forEach(function(e,t){n(e,t)&&r.push(t)}),r},file:function(e,t,n){var r,i;return 1===arguments.length?y(e)?(r=e,this.filter(function(e,t){return!t.dir&&r.test(e)})):(i=this.files[this.root+e])&&!i.dir?i:null:(e=this.root+e,m.call(this,e,t,n),this)},folder:function(n){var e,t;return n?y(n)?this.filter(function(e,t){return t.dir&&n.test(e)}):(e=this.root+n,e=s.call(this,e),(t=this.clone()).root=e.name,t):this},remove:function(n){n=this.root+n;var e=this.files[n];if(e||("/"!==n.slice(-1)&&(n+="/"),e=this.files[n]),e&&!e.dir)delete this.files[n];else for(var t=this.filter(function(e,t){return t.name.slice(0,n.length)===n}),r=0;r<t.length;r++)delete this.files[t[r].name];return this},generate:function(e){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t={};try{if((t=u.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=t.type.toLowerCase(),t.compression=t.compression.toUpperCase(),"binarystring"===t.type&&(t.type="string"),!t.type)throw new Error("No output type specified.");u.checkSupport(t.type),"darwin"!==t.platform&&"freebsd"!==t.platform&&"linux"!==t.platform&&"sunos"!==t.platform||(t.platform="UNIX"),"win32"===t.platform&&(t.platform="DOS");var n=t.comment||this.comment||"",r=d.generateWorker(this,t,n)}catch(e){(r=new c("error")).error(e)}return new a(r,t.type||"string",t.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}}}),Ae=t(function(e,t){var n=E();function r(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(e){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r}),xe=t(function(e,t){var n=Ae();function r(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}E().inherits(r,n),r.prototype.byteAt=function(e){return this.data[this.zero+e]},r.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===n&&this.data[a+2]===r&&this.data[a+3]===i)return a-this.zero;return-1},r.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),e=e.charCodeAt(3),i=this.readData(4);return t===i[0]&&n===i[1]&&r===i[2]&&e===i[3]},r.prototype.readData=function(e){var t;return this.checkOffset(e),0===e?[]:(t=this.data.slice(this.zero+this.index,this.zero+this.index+e),this.index+=e,t)},t.exports=r}),Oe=t(function(e,t){var n=Ae();function r(e){n.call(this,e)}E().inherits(r,n),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r}),De=t(function(e,t){var n=xe();function r(e){n.call(this,e)}E().inherits(r,n),r.prototype.readData=function(e){var t;return this.checkOffset(e),0===e?new Uint8Array(0):(t=this.data.subarray(this.zero+this.index,this.zero+this.index+e),this.index+=e,t)},t.exports=r}),Be=t(function(e,t){var n=De();function r(e){n.call(this,e)}E().inherits(r,n),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r}),Ie=t(function(e,t){var n=E(),r=p(),i=xe(),a=Oe(),o=Be(),s=De();t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new o(e):r.uint8array?new s(n.transformTo("uint8array",e)):new i(n.transformTo("array",e)):new a(e)}}),Te=t(function(e,t){var n=Ie(),r=E(),i=D(),a=l(),o=A(),s=be(),u=p();function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t;if(e.skip(22),this.fileNameLength=e.readInt(2),t=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(t),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=(e=>{for(var t in s)if(s.hasOwnProperty(t)&&s[t].magic===e)return s[t];return null})(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){var t;this.extraFields[1]&&(t=n(this.extraFields[1].value),this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS)&&(this.diskNumberStart=t.readInt(4))},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[t]={id:t,length:n,value:r};e.setIndex(i)},handleUTF8:function(){var e,t=u.uint8array?"uint8array":"array";this.useUTF8()?(this.fileNameStr=o.utf8decode(this.fileName),this.fileCommentStr=o.utf8decode(this.fileComment)):(null!==(e=this.findExtraFieldUnicodePath())?this.fileNameStr=e:(e=r.transformTo(t,this.fileName),this.fileNameStr=this.loadOptions.decodeFileName(e)),null!==(e=this.findExtraFieldUnicodeComment())?this.fileCommentStr=e:(e=r.transformTo(t,this.fileComment),this.fileCommentStr=this.loadOptions.decodeFileName(e)))},findExtraFieldUnicodePath:function(){var e,t=this.extraFields[28789];return!t||1!==(e=n(t.value)).readInt(1)||a(this.fileName)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))},findExtraFieldUnicodeComment:function(){var e,t=this.extraFields[25461];return!t||1!==(e=n(t.value)).readInt(1)||a(this.fileComment)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))}},t.exports=c}),Fe=t(function(e,t){var n=Ie(),r=E(),i=we(),a=Te(),o=(A(),p());function s(e){this.files=[],this.loadOptions=e}s.prototype={checkSignature:function(e){var t;if(!this.reader.readAndCheckSignature(e))throw this.reader.index-=4,t=this.reader.readString(4),new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(t)+", expected "+r.pretty(e)+")")},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);e=this.reader.readString(4)===t;return this.reader.setIndex(n),e},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=o.uint8array?"uint8array":"array",t=r.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(t)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){for(var e,t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(e=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(e<0)throw!this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(e);var t=e;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}e=this.centralDirOffset+this.centralDirSize,e=t-(e=this.zip64?e+20+(12+this.zip64EndOfCentralSize):e);if(0<e)this.isSignature(t,i.CENTRAL_FILE_HEADER)||(this.reader.zero=e);else if(e<0)throw new Error("Corrupted zip: missing "+Math.abs(e)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=s}),Pe=t(function(e,t){var n=E(),o=m(),r=A(),s=Fe(),u=ne(),c=v();t.exports=function(e,i){var a=this;return i=n.extend(i||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),c.isNode&&c.isStream(e)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",e,!0,i.optimizedBinaryString,i.base64).then(function(e){var t=new s(i);return t.load(e),t}).then(function(e){var t=[o.Promise.resolve(e)],n=e.files;if(i.checkCRC32)for(var r=0;r<n.length;r++)t.push((r=>new o.Promise(function(e,t){var n=r.decompressed.getContentWorker().pipe(new u);n.on("error",function(e){t(e)}).on("end",function(){n.streamInfo.crc32!==r.decompressed.crc32?t(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()}))(n[r]));return o.Promise.all(t)}).then(function(e){for(var e=e.shift(),t=e.files,n=0;n<t.length;n++){var r=t[n];a.file(r.fileNameStr,r.decompressed,{binary:!0,optimizedBinaryString:!0,date:r.date,dir:r.dir,comment:r.fileCommentStr.length?r.fileCommentStr:null,unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions,createFolders:i.createFolders})}return e.zipComment.length&&(a.comment=e.zipComment),a})}}),Re=t(function(e,t){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e,t=new n;for(e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(n.prototype=Ce()).loadAsync=Pe(),n.support=p(),n.defaults=O(),n.version="3.7.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=m(),t.exports=n}),u={},ze=u,Ne={Command:function(){return Le},jszip:function(){return je.default}};for(i in Ne)s(ze,i,{get:Ne[i],enumerable:!0});e.exports=(e=u,r(s({},"__esModule",{value:!0}),e));var u=n(M(),1).default,Le=(u.program,u.Command),je=n(Re())}),ve=Lt(function(e,t){var n,r,i="rpk",a="crossAtomicService";t.exports={MAX_SIZE_SSPK:2097152,MAX_SIZE_SPK:20971520,SIGN_MAGIC:"RPK Sig Block 42",SIGN_MAGIC_APK:"APK Sig Block 42",SIGN_TYPE_FULL_PACKAGE:16777473,SIGN_TYPE_FULL_PACKAGE_APK:1896449818,SIGN_TYPE_FILE_LIST:16777729,CRYPT_TYPE_RSA_SHA256:259,SIGN_HEADER:[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32],BEGIN_TAG:165,JOINT_TAG:90,CERT_HEAD:"-----BEGIN CERTIFICATE-----\n",CERT_END:"\n-----END CERTIFICATE-----",setSignType:function(e){return i=e},isApkSign:function(){return"apk"===i},setDssHost:function(e){return n=e},setDssKey:function(e){return r=e},setDssKeyId:function(e){return a=e},getDssHost:function(){return n},getDssKey:function(){return r},getDssKeyId:function(){return a},setDssConfig:function(e){n=e.dssHost,r=e.dssKey}}}),Ge=Lt(function(e,t){var c=ve(),l=22,h=67324752,f=33639248,d=101010256,p=16;t.exports={parserZip:function(e,t){var n,r,i,a,o,s,u={tag:!1,length:e.length,sections:{header:null,central:null,footer:null}};return u.sections.footer=(e=>{var t={tag:!1};if(e&&!(e.length<l))for(var n=e.length-l;0<=n;n--)if(d===e.readInt32LE(n)){t.tag=!0,t.startIndex=n,t.len=e.length-n,t.previous=e.readInt32LE(n+p);break}return t})(e),u.sections.footer.tag&&(u.sections.central=(i=e,a=u.sections.footer.previous,o=u.sections.footer.startIndex-u.sections.footer.previous,s={tag:!1},!i||i.length<a||f===i.readInt32LE(a)&&(s.tag=!0,s.startIndex=a,s.len=o,s.previous=i.readInt32LE(a+42)),s),u.sections.central.tag)&&(o=u.sections.central.previous,i=u.sections.central.startIndex-u.sections.central.previous,t&&(u.sections.sign=(a=o,s={tag:!1},!(t=e)||t.length<a||(a=c.isApkSign()?c.SIGN_MAGIC_APK:c.SIGN_MAGIC,0<(a=t.indexOf(a))&&(n=t.readInt32LE(a-8),r=a+16-n-8,t.readInt32LE(r)===n)&&(s.tag=!0,s.len=n,s.startIndex=a+16,s.previous=r)),s),o=0,i=u.sections.sign.startIndex-u.sections.sign.len-8),u.sections.header=(t=o,n=i,a={tag:!1},!(r=e)||r.length<t||h===r.readInt32LE(t)&&(a.tag=!0,a.startIndex=t,a.len=n,a.previous=-1),a),u.sections.header.tag&&(u.tag=!0)),u},checkZipBuffer:function(e,t){return!e||e.length<=4?(console.log("### Sign Failed, cannot open file: ",t),!1):h===e.readInt32LE(0)||(console.log("### Sign Failed, zip file error: ",t),!1)}}}),tn=Lt(function(e,t){var s,n={decode:function(e){if(void 0===s){var t="= \f\n\r\t \u2028\u2029";for(s=[],a=0;a<64;++a)s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a)]=a;for(a=0;a<t.length;++a)s[t.charAt(a)]=-1}for(var n=[],r=0,i=0,a=0;a<e.length;++a){var o=e.charAt(a);if("="===o)break;if(-1!==(o=s[o])){if(void 0===o)throw"Illegal character at offset "+a;r|=o,4<=++i?(n[n.length]=r>>16,n[n.length]=r>>8&255,n[n.length]=255&r,i=r=0):r<<=6}}switch(i){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:n[n.length]=r>>10;break;case 3:n[n.length]=r>>16,n[n.length]=r>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z\d+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z\d+\/=\s]+)====/,unarmor:function(e){var t=n.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw"RegExp out of sync";e=t[2]}return n.decode(e)}};t.exports=n}),nn=Lt(function(e,t){var u,n={decode:function(e){if(void 0===u){var t="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(u=[],o=0;o<16;++o)u[t.charAt(o)]=o;for(t=t.toLowerCase(),o=10;o<16;++o)u[t.charAt(o)]=o;for(o=0;o<n.length;++o)u[n.charAt(o)]=-1}for(var r=[],i=0,a=0,o=0;o<e.length;++o){var s=e.charAt(o);if("="===s)break;if(-1!==(s=u[s])){if(void 0===s)throw"Illegal character at offset "+o;i|=s,2<=++a?(r[r.length]=i,a=i=0):i<<=4}}if(a)throw"Hex encoding incomplete: 4 bits missing";return r}};t.exports=n}),on=Lt(function(e,t){var n={};n.digest=function(e,t){void 0===t&&(t=0);var n;t^=-1;for(var r=0,i=e.length;r<i;r++)n=255&(t^e.charCodeAt(r)),t=t>>>8^"0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substr(9*n,8);return-1^t},t.exports=n}),Ye=Lt(function(e,t){var n=tn(),r=nn(),i=on();t.exports={Base64:n,Hex:r,CRC32:i}}),Xe=Lt(function(e,t){var s=require("crypto"),u=require("http"),c=ve(),l=require("js-base64").encodeURL;var h={"Content-Type":"application/json"};function i(e){var t,n,r,i={version:"1",payload:l(e),paddingMode:"1"},e=(new Date).getTime(),a=(h.Authorization=(t=i,n=(new Date).getTime(),t="POST&"+new URL(c.getDssHost()).pathname+"&&"+JSON.stringify(t)+"&appid="+c.getDssKeyId()+"&timestamp="+n,r=c.getDssKey(),r=s.createHmac("sha256",r).update(t).digest("base64"),"CLOUDSOA-HMAC-SHA256 appid=".concat(c.getDssKeyId(),", timestamp=").concat(n,', signature="').concat(r,'"')),h["X-Request-ID"]=e,new URL(c.getDssHost())),o=a.pathname;return new Promise(function(n){var e=u.request({host:a.hostname,port:8108,method:"POST",path:o,headers:h},function(e){var t="";e.on("data",function(e){t+=e}),e.on("end",function(){n(JSON.parse(t))})});e.on("error",function(e){console.error("sign request error: ".concat(e.message))}),e.write(JSON.stringify(i)),e.end()})}function r(e){return n.apply(this,arguments)}function n(){return(n=_asyncToGenerator(_regenerator().m(function e(t){var n,r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i(t);case 1:return n=e.v,console.log(n),r={},e.a(2,(n&&0===n.status?(r.cert=n.result.cert,r.signature=n.result.signature):console.error("sign request error:"+(n?n.result.errMsg:"")),r))}},e)}))).apply(this,arguments)}function a(e){var t;if(e)return t=(e=e.replace(/-/g,"+").replace(/_/g,"/")).length%4,e+"====".substring(0,t)}function o(){return(o=_asyncToGenerator(_regenerator().m(function e(t){var n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return c.setDssConfig(t),e.n=1,r("abc");case 1:return n=e.v,n=a(n.cert).replace(/(.{64})/g,"$1\n"),e.a(2,c.CERT_HEAD+n+c.CERT_END)}},e)}))).apply(this,arguments)}t.exports={getSignDigestOnline:r,Base64UrlToBase64:a,setOnlineParam:function(e,t){c.setDssKey(e),c.setDssHost(t)},generateCertificate:function(e){return o.apply(this,arguments)}}}),er=Lt(function(e,t){var v=ve(),f=Ge(),n=require("js-base64"),o=n.encode,d=n.Base64,s=require("http"),r=require("fs"),p=require("crypto"),a=Ye(),g=Xe(),u="Rsagen",c="Rsagen-V3.0.1.20190615",l="Normal",h="NONEWITHRSA",m="signData";function _(e,t){var n=t.startIndex,e=e.slice(n,t.startIndex+t.len),n=Buffer.alloc(5+t.len);n[0]=v.BEGIN_TAG,n.writeInt32LE(e.length,1),e.copy(n,5),t.sign=B(n)}function y(e){function t(e){e.copy(r,i),i+=e.length}var e=e.sections,n=e.header.sign.length+e.central.sign.length+e.footer.sign.length+5,r=Buffer.alloc(n),i=0;return r.writeInt8(v.JOINT_TAG,0),r.writeInt32LE(3,1),i+=5,t(e.header.sign),t(e.central.sign),t(e.footer.sign),B(r)}function b(e,t){var r={keyId:t.keyId,clientType:u,clientVersion:c,algorithmType:l,userName:t.userName,unSignData:o(e),passwordDigest:t.passwordDigest,algorithm:h,outFileNameArray:[m],encryptPassword:t.encryptPassword},i=new URL(t.host),a=i.pathname;return new Promise(function(n){var e=s.request({host:i.hostname,method:"POST",path:a,headers:{"Content-Type":"application/json"}},function(e){var t="";e.on("data",function(e){t+=e}),e.on("end",function(){n(JSON.parse(t))})});e.on("error",function(e){console.error("problem with request: ".concat(e.message))}),e.write(JSON.stringify(r)),e.end()})}function w(e){var t=Buffer.from(v.SIGN_HEADER),e=B(e),n=Buffer.alloc(e.length+t.length),r=0;return t.copy(n,0),r+=t.length,e.copy(n,r),n}function k(e){var t=Buffer.alloc(e.length+12);return t.writeInt32LE(e.length+8,0),t.writeInt32LE(v.CRYPT_TYPE_RSA_SHA256,4),t.writeInt32LE(e.length,8),e.copy(t,12),{len:t.length,buffer:t}}function S(e,t){var n={len:12,digests:{size:0,data:[]},certs:{size:0,data:[]},additional:0};return n.digests.data.push(e),n.digests.size+=e.len,n.len+=e.len,n.certs.data.push(t),n.certs.size+=t.len,n.len+=t.len,n}function E(){return(E=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if((r={len:16+n.cert.pemBuffer.length,size:12+n.cert.pemBuffer.length,signdata:{size:0,buffer:null},signatures:{size:0,data:[]},pubkey:{size:n.cert.pemBuffer.length,buffer:n.cert.pemBuffer}}).signdata.buffer=A(t),r.signdata.size=t.len,r.size+=t.len,r.len+=t.len,v.isApkSign())return e.n=1,g.getSignDigestOnline(r.signdata.buffer);e.n=2;break;case 1:i=e.v,i=Buffer.from(d.toUint8Array(i.signature)),e.n=8;break;case 2:if("dss"===n.type)return e.n=3,g.getSignDigestOnline(r.signdata.buffer);e.n=4;break;case 3:a=e.v,i=Buffer.from(d.toUint8Array(a.signature)),e.n=8;break;case 4:if(n.signOnline)return a=w(r.signdata.buffer),e.n=5,b(a,n.onlineConfig);e.n=7;break;case 5:if((o=e.v).success){e.n=6;break}throw new Error(o.message);case 6:i=Buffer.from(d.toUint8Array(o.data.signData)),e.n=8;break;case 7:(s=p.createSign("RSA-SHA256")).update(r.signdata.buffer),i=s.sign(n.privateKey);case 8:return s={len:i.length+12,size:i.length+8,id:v.CRYPT_TYPE_RSA_SHA256,buffer:i},e.a(2,(r.signatures.data.push(s),r.signatures.size+=s.len,r.size+=s.len,r.len+=s.len,r))}},e)}))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if((i={len:4+n.len,size:n.len,data:[]}).data.push(n),a=v.isApkSign()?v.SIGN_TYPE_FULL_PACKAGE_APK:v.SIGN_TYPE_FULL_PACKAGE,(i={len:32+(a={len:i.len+12,size:i.len+4,id:a,value:i}).len,size:24+a.len,data:[]}).data.push(a),t.files&&!v.isApkSign())return e.n=1,function(){return O.apply(this,arguments)}(t.files,r);e.n=2;break;case 1:(a=e.v)&&((o={len:4+a.length,size:a.length,data:[]}).data.push(a),o={len:o.len+12,size:o.len+4,id:v.SIGN_TYPE_FILE_LIST,value:o},i.data.push(o),i.size+=o.len,i.len+=o.len);case 2:return e.a(2,i)}},e)}))).apply(this,arguments)}function A(e){var t=Buffer.alloc(e.len),n=0;return t.writeInt32LE(e.digests.size,n),n+=4,e.digests.data.forEach(function(e){e.buffer.copy(t,n),n+=e.len}),t.writeInt32LE(e.certs.size,n),n+=4,e.certs.data.forEach(function(e){e.buffer.copy(t,n),n+=e.len}),t.writeInt32LE(e.additional,n),t}function x(e){var i={len:8,size:4,digests:[],sign:null};return e.forEach(function(e){var t=a.CRC32.digest(e.name.toString()),n=6+e.hash.length,r=Buffer.alloc(n);r.writeInt32LE(t,0),r.writeInt16LE(e.hash.length,4),e.hash.copy(r,6),i.digests.push(r),i.size+=n,i.len+=n}),i}function O(){return(O=_asyncToGenerator(_regenerator().m(function e(i,a){var o,s,u,c,l,h,f;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:o=x(i),s=Buffer.alloc(o.size),u=0,o.digests.forEach(function(e){e.copy(s,u),u+=e.length}),a.sign?(console.log("sign files, use remote sign"),c=a.sign,e.n=7):e.n=1;break;case 1:if("dss"===a.type)return e.n=2,g.getSignDigestOnline(s);e.n=3;break;case 2:l=e.v,c=Buffer.from(d.toUint8Array(l.signature)),e.n=7;break;case 3:if(a.signOnline)return l=w(s),e.n=4,b(l,a.onlineConfig);e.n=6;break;case 4:if((h=e.v).success){e.n=5;break}throw new Error(h.message);case 5:c=Buffer.from(d.toUint8Array(h.data.signData)),e.n=7;break;case 6:(f=p.createSign("RSA-SHA256")).update(s),c=f.sign(a.privateKey);case 7:return e.a(2,(o.digests=s.slice(),o.sign={len:12+c.length,size:8+c.length,id:v.CRYPT_TYPE_RSA_SHA256,data:c},o.len+=o.sign.len,t=o,r=n=void 0,n=Buffer.alloc(t.len),r=0,n.writeInt32LE(t.size,0),r+=4,t.digests.copy(n,4),r+=t.digests.length,n.writeInt32LE(t.sign.size,r),r+=4,n.writeInt32LE(t.sign.id,r),r+=4,n.writeInt32LE(t.sign.data.length,r),r+=4,t.sign.data.copy(n,r),n))}var t,n,r},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regenerator().m(function e(o,s,u){var c,l,h;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(f.checkZipBuffer(o)){e.n=1;break}return e.a(2,null);case 1:if((c=f.parserZip(o)).options={files:s},c.tag){e.n=2;break}return e.a(2,null);case 2:return Object.keys(c.sections).forEach(function(e){e=c.sections[e];_(o,e)}),l=y(c),l=k(l),l=S(l,u.cert.obj),e.n=3,function(){return E.apply(this,arguments)}(l,u);case 3:return l=e.v,e.n=4,function(){return C.apply(this,arguments)}(c.options,l,u);case 4:return h=e.v,e.a(2,(c.signchunk=(e=>{var t=Buffer.alloc(e.len),n=0,r=(t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(0,n),n+=4,v.isApkSign()?v.SIGN_TYPE_FULL_PACKAGE_APK:v.SIGN_TYPE_FULL_PACKAGE),e=(e.data.forEach(function(e){t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(0,n),n+=4,t.writeInt32LE(e.id,n),n+=4,t.writeInt32LE(e.value.size,n),n+=4,r===e.id?e.value.data.forEach(function(e){t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(e.signdata.size,n),n+=4,e.signdata.buffer.copy(t,n),n+=e.signdata.buffer.length,t.writeInt32LE(e.signatures.size,n),n+=4,e.signatures.data.forEach(function(e){t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(e.id,n),n+=4,t.writeInt32LE(e.buffer.length,n),n+=4,e.buffer.copy(t,n),n+=e.buffer.length}),t.writeInt32LE(e.pubkey.size,n),n+=4,e.pubkey.buffer.copy(t,n),n+=e.pubkey.buffer.length}):v.SIGN_TYPE_FILE_LIST===e.id&&e.value.data.forEach(function(e){e.copy(t,n),n+=e.length})}),t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(0,n),n+=4,v.isApkSign()?v.SIGN_MAGIC_APK:v.SIGN_MAGIC);return Buffer.from(e).copy(t,n),t})(h),t=o,n=c,a=i=r=void 0,r=Buffer.alloc(t.length+n.signchunk.length),i=0,a=n.sections,t.copy(r,0,a.header.startIndex,a.header.startIndex+a.header.len),i+=a.header.len,n.signchunk.copy(r,i),i+=n.signchunk.length,t.copy(r,i,a.central.startIndex,a.central.startIndex+a.central.len),i+=a.central.len,t.writeInt32LE(a.central.startIndex+n.signchunk.length,a.footer.startIndex+16),t.copy(r,i,a.footer.startIndex,a.footer.startIndex+a.footer.len),r))}var t,n,r,i,a},e)}))).apply(this,arguments)}function D(){return(D=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(f.checkZipBuffer(t)){e.n=1;break}return e.a(2,null);case 1:if((i=f.parserZip(t)).options={files:n},i.tag){e.n=2;break}return e.a(2,null);case 2:return Object.keys(i.sections).forEach(function(e){e=i.sections[e];_(t,e)}),a=y(i),a=k(a),a=S(a,r.cert.obj),e.a(2,A(a))}},e)}))).apply(this,arguments)}function B(e){var t=p.createHash("SHA256");return t.update(e),t.digest()}function I(e,t){var n={};return n.size=e.readInt32LE(t),n.buffer=e.slice(t+=4,t+n.size),{obj:n,i:t+=n.size}}t.exports={hashFile:function(e){return B(r.readFileSync(e))},signZipResource:function(e,t,n){return i.apply(this,arguments)},getBufferSha256:B,getSignChunk:function(e,t){for(var n,r,i,a,o,s=(y=t.previous+8)+t.len,u=[],c={signDataBufList:[]},l=v.isApkSign()?v.SIGN_TYPE_FULL_PACKAGE_APK:v.SIGN_TYPE_FULL_PACKAGE;y<s;){a=y,void 0,(o={}).size=(h=e).readInt32LE(a),o.id=h.readInt32LE(a+=8),a+=4,o.value={},o.value.size=h.readInt32LE(a),o.value.data=[];var h={data:o,index:a+=4},f=h.data,d=(y=h.index)+f.value.size,p={};if(l===f.id)for(;y<d;){p.size=e.readInt32LE(y);var g=I(e,y+=4),m=(p.signdata=g.obj,y=g.i,c.signDataBufList.push(p.signdata.buffer),p.signatures={},p.signatures.size=e.readInt32LE(y),(y+=4)+p.signatures.size);for(p.signatures.data=[];y<m;){n=y,i=r=void 0,(r={}).size=(_=e).readInt32LE(n),r.id=_.readInt32LE(n+=4),i=_.readInt32LE(n+=4),r.buffer=_.slice(n+=4,n+i);var _={sData:r,index:n+=i},y=_.index;p.signatures.data.push(_.sData)}g=I(e,y);p.pubkey=g.obj,y=g.i,f.value.data.push(p)}else v.SIGN_TYPE_FILE_LIST===f.id&&(p=e.slice(y,y+f.value.size),f.value.data.push(p));u.push(f)}return c.data=u,c.size=t.size,c},getCertBuffer:function(e){var t,n;if(e)return e.signDataBufList&&0<e.signDataBufList.length?(n=e.signDataBufList[t=0].readInt32LE(0),n=e.signDataBufList[0].readInt32LE(t=t+(4+n)+4),e=e.signDataBufList[0].slice(t+=4,t+n),v.CERT_HEAD+e.toString("base64")+v.CERT_END):void 0;console.error("no sign chunk!")},getSignFilesObject:x,getSignData:function(e,t,n){return D.apply(this,arguments)}}}),Ce=Lt(function(e,t){var s=require("path"),p=require("fs"),g=require("crypto"),m=Pe().jszip,_=er(),l=require("jsrsasign"),h=Ye(),y=Ge(),v=er(),f=Xe(),b=(0,require("@atomicservice/ascf-base").getLogger)("spk-sign-utils"),u="META-INF/CERT",o="hash.json",w={type:"nodebuffer",compression:"DEFLATE",compressionOptions:{level:9}};function c(){return(c=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r={},t.forEach(function(e){var t=e.fileBuildPath,e=e.fileContentDigest;return r[t]=e.toString("hex")}),(i=new m).file(o,JSON.stringify({algorithm:"SHA-256",digests:r})),e.n=1,i.generateAsync(w);case 1:return i=e.v,a={name:o,hash:_.getBufferSha256(i)},e.n=2,_.signZipResource(i,[a],n);case 2:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function k(){return n.apply(this,arguments)}function n(){return(n=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=t.fileList,i=new m,a=r.map(function(e){return{name:e.fileBuildPath,hash:e.fileContentDigest}}),e.n=1,function(){return c.apply(this,arguments)}(r,n);case 1:return o=e.v,i.file(u,o),a.unshift({name:u,hash:_.getBufferSha256(o)}),o=Object.assign({},w),r.forEach(function(e){var t=e.fileBuildPath;i.file(t,e.fileContentBuffer)}),e.n=2,i.generateAsync(o);case 2:return o=e.v,e.n=3,_.signZipResource(o,a,n);case 3:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function a(){return(a=_asyncToGenerator(_regenerator().m(function e(t,n,r,i,a){var o,s,u,c,l,h,f,d,p;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,k(r,n);case 1:if(o=e.v,i.length){e.n=2;break}return e.a(2,{rpkBuffer:o});case 2:if(s=new m,u=[],c=Object.assign({},w),a.disableSubpackages&&"false"!==a.disableSubpackages){e.n=4;break}return h=i.map(function(e){return k(e,n)}),e.n=3,Promise.all(h).catch(function(){new Error("ERROR: Rpk sign failed!")});case 3:e.v.forEach(function(e,t){t="".concat(i[t].pkgName);e.length,s.file(t,e),u.push({name:t,hash:_.getBufferSha256(e)})}),e.n=6;break;case 4:return l=i[0],e.n=5,k(l,n).catch(function(){new Error("ERROR: Rpk sign failed!")});case 5:h=e.v,f="".concat(l.pkgName),h.length,s.file(f,h),u.push({name:f,hash:_.getBufferSha256(h)});case 6:return e.n=7,s.generateAsync(c);case 7:return f=e.v,e.n=8,_.signZipResource(f,u,n);case 8:return d=e.v,p=o,e.a(2,{rpksBuffer:d,rpkBuffer:p})}},e)}))).apply(this,arguments)}function r(){return(r=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=p.readFileSync(n),e.n=1,_.signZipResource(r,[],t);case 1:return r=e.v,e.a(2,{apkBuffer:r})}},e)}))).apply(this,arguments)}function d(e,t,n,r){e.fileList.push({fileBuildPath:t,fileContentBuffer:n,fileContentDigest:r})}function i(e){var t,n,r,i,a,o,s,e=e.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/);if(e)return o=e[1],s=parseInt(o),2===o.length&&(50<=s&&s<100?s=1900+s:0<=s&&s<50&&(s=2e3+s)),o=parseInt(e[2])-1,t=parseInt(e[3]),n=parseInt(e[4]),r=parseInt(e[5]),i=parseInt(e[6]),a=0,""!==(e=e[7])&&(e=(e.substr(1)+"00").substr(0,3),a=parseInt(e)),Date.UTC(s,o,t,n,r,i,a);throw new Error("Your certificate is Invalid.")}function S(e,t,n){return E.apply(this,arguments)}function E(){return(E=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a,o,s,u,c=arguments;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(i={signOnline:null!=r,privateKey:n,onlineConfig:r},(a=3<c.length&&void 0!==c[3]?c[3]:{})&&a.dssHost&&a.dssKey)return e.n=1,f.generateCertificate(a);e.n=2;break;case 1:t=e.v,i.type="dss";case 2:return(a=new l.X509).readCertPEM(t.toString()),o=l.KEYUTIL.getPEM(a.getPublicKey()),s=Buffer.from(h.Base64.unarmor(t)),u=Buffer.alloc(s.length+4),e.a(2,(u.writeInt32LE(s.length,0),s.copy(u,4),i.cert={content:t,obj:{len:u.length,buffer:u},pemBuffer:Buffer.from(h.Base64.unarmor(o))},i))}},e)}))).apply(this,arguments)}function C(e){var t=new l.X509,e=(t.readCertPEM(e),t.getSignatureValueHex()),t=Buffer.from(e,"hex").toString("base64"),e=v.getBufferSha256(t);return Buffer.from(e).toString("hex")}function A(){return(A=_asyncToGenerator(_regenerator().m(function e(a){var o,s,u,c,l,h,f,d;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(a&&p.existsSync(a)){e.n=1;break}throw new Error("No rpk file : "+a);case 1:if(o=p.readFileSync(a),y.checkZipBuffer(o)){e.n=2;break}throw new Error("Get File Certificate Error!");case 2:if((s=y.parserZip(o,!0)).sections.sign.tag){e.n=3;break}throw new Error("No sign block!");case 3:if(u=v.getSignChunk(o,s.sections.sign),c=v.getCertBuffer(u)){e.n=4;break}throw new Error("Get Certificate error!");case 4:return l=u.data[0].value.data[0].signatures.data[0].buffer,h=[],t=o,i=r=void 0,n=(n=s).sections,r=Buffer.alloc(n.header.len+n.central.len+n.footer.len),i=0,t.copy(r,0,n.header.startIndex,n.header.startIndex+n.header.len),i+=n.header.len,t.copy(r,i,n.central.startIndex,n.central.startIndex+n.central.len),i+=n.central.len,t.copy(r,i,n.footer.startIndex,n.footer.startIndex+n.footer.len),r.writeInt32LE(n.header.len,r.length-6),f=r,e.n=5,S(c);case 5:return d=e.v,e.n=6,_.getSignData(f,h,d);case 6:d=e.v,g.createVerify("RSA-SHA256").update(d).verify(c,l)||(b.error("Failed to verify the signature"),process.exit(-1));case 7:return e.a(2)}var t,n,r,i},e)}))).apply(this,arguments)}t.exports={generatePkgDef:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=[],n={pkgName:"base.sspk",fileList:[]};return e.forEach(function(e){e=e.resource;t.push({pkgName:"".concat(e,".sspk"),fileList:[],root:e})}),{mainPkg:{pkgName:"base.spk",fileList:[]},subPkgs:e.length?[n].concat(t):[n]}},addResourceToPkg:function(e,t,a,o){e.forEach(function(n){var r,e=p.readFileSync(s.join(t,n)),i=[n,e,_.getBufferSha256(e)];d.apply(void 0,[a].concat(i)),o.length&&(r=!0,o.slice(1).forEach(function(e){var t=n.split("/");t[0]===e.root&&(i[0]=t.slice(1).join("/"),d.apply(void 0,[e].concat(i)),r=!1)}),r)&&d.apply(void 0,[o[0]].concat(i))})},signPkgs:function(e,t,n,r,i){return a.apply(this,arguments)},DIGEST_PATH:u,getResources:function(e){return function n(r,i){var a=[],o=s.posix.join(r,i);return p.readdirSync(o).forEach(function(e){var t=s.posix.join(o,e),e=s.posix.join(i,e);p.statSync(t).isFile()?a.push(e):a=a.concat(n(r,e))}),a}(e,".").filter(function(e){return e!==u})},checkValidity:function(e){(t=new l.X509).readCertPEM(String(e));var e=i(t.getNotAfter()),t=i(t.getNotBefore()),n=Number(new Date);return{validityDays:Number(e-n)/864e5,isInvalid:0<Number(t)-n}},getSignInfo:S,getApkSignInfo:function(e){var t={signOnline:!1,onlineConfig:null},n=((n=new l.X509).readCertPEM(e.toString()),l.KEYUTIL.getPEM(n.getPublicKey())),r=Buffer.from(h.Base64.unarmor(e)),i=Buffer.alloc(r.length+4);return i.writeInt32LE(r.length,0),r.copy(i,4),t.cert={content:e,obj:{len:i.length,buffer:i},pemBuffer:Buffer.from(h.Base64.unarmor(n))},t},getSignedZipCertFp:function(e){return A.apply(this,arguments)},getCertFp:function(e){if(p.existsSync(e))return C(p.readFileSync(e).toString());console.error("error : certificate.pem is not exist!")},signFullApk:function(e,t){return r.apply(this,arguments)},getCertString:function(e){if(!e||!p.existsSync(e))throw new Error("No srpk file : "+e);if(e=p.readFileSync(e),!y.checkZipBuffer(e))throw new Error("Get File Certificate Error!");var t=y.parserZip(e,!0);if(!t.sections.sign.tag)throw new Error("No sign block!");if(e=v.getSignChunk(e,t.sections.sign),t=v.getCertBuffer(e))return C(t);throw new Error("Get Certificate error!")}}}),le=Lt(function(e,t){var l=require("path"),h=require("fs"),n=require("json5"),r=require("rimraf"),f=require("decompress"),i="src/main/resources/rawfile",o=(0,require("@atomicservice/ascf-base").getLogger)("utils"),a=require("child_process"),s=a.exec,u=a.spawnSync;function c(e){var t,n=l.resolve(e,"build-profile.json5");if(!h.existsSync(n))return l.join(e,"entry");n=d(n);if(0<(null==n||null==(t=n.modules)?void 0:t.length))return l.join(e,n.modules[0].srcPath);throw new Error("getEntryPkgPath error, build-profile.json5 file modules is null")}function d(t){if(!h.existsSync(t))return{};var e={};try{e=n.parse(h.readFileSync(t,"utf-8").toString()||"{}")}catch(e){throw new Error("parse json file error at ".concat(t,":").concat(e.lineNumber,":").concat(e.columnNumber," "))}return e}var p=function(e){return Promise.all(e.map(function(t){if(h.existsSync(t))return new Promise(function(e){r.sync(t),e()})}))};function g(){return(g=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o,s,u,c;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,f(t,n);case 1:i=h.readdirSync(n,{withFileTypes:!0}),r=[],i=_createForOfIteratorHelper(i),e.p=2,i.s();case 3:if((c=i.n()).done)e.n=9;else{if(a=c.value,o=l.resolve(l.join(n,a.name)),s="","base.sspk"===a.name)return e.n=4,f(o,n);e.n=5}break;case 4:s=l.resolve(l.join(n,"META-INF")),e.n=7;break;case 5:return u=a.name.split(".")[0],e.n=6,f(o,l.resolve(n,u));case 6:s=l.resolve(l.resolve(n,u,"META-INF"));case 7:r.push(s),h.unlinkSync(o);case 8:e.n=3;break;case 9:e.n=11;break;case 10:e.p=10,c=e.v,i.e(c);case 11:return e.p=11,i.f(),e.f(11);case 12:return e.n=13,p(r);case 13:e.n=15;break;case 14:throw e.p=14,e.v;case 15:return e.a(2)}},e,null,[[2,10,11,12],[0,14]])}))).apply(this,arguments)}t.exports={RAWFILE_DIR:i,ASCF_BUILD:"ascf/ascf_build",ASCF_CONFIG_JSON:"ascf/ascf_src/ascf.config.json",P12_PATH:"sign/ascf-build.p12",QUICK_SERVICE_BUILD:"build/quick_service_build",DIST_PATH:"build/dist",getManifestData:function(e){return d(l.resolve(c(e),i,"manifest.json"))},getEntryPkgPath:c,readJsonFile:d,clearResource:p,copyDirectory:function e(t,n){var r;if(h.mkdirSync(n,{recursive:!0}),h.statSync(t).isFile())r=l.join(n,l.basename(t)),h.copyFileSync(t,r);else{var i,a=_createForOfIteratorHelper(h.readdirSync(t,{withFileTypes:!0}));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=l.resolve(l.join(t,o.name)),u=l.join(n,o.name);o.isDirectory()?e(s,u):h.copyFileSync(s,u)}}catch(e){a.e(e)}finally{a.f()}}},mkdirsSync:function e(t){if(!h.existsSync(t)){if(h.existsSync(l.dirname(t))||!e(l.dirname(t)))return h.mkdirSync(t);print("mkdirSync err : ".concat(t))}},formatHexString:function(e){if(64!==e.length)throw new Error("指纹格式错误");for(var t="",n=0;n<e.length;n+=2)t+=e.substr(n,2)+":";return t.slice(0,-1).toUpperCase()},extractspk:function(e,t){return g.apply(this,arguments)},deleteDirectory:function t(n){h.existsSync(n)&&(h.readdirSync(n).forEach(function(e){e=l.join(n,e),h.lstatSync(e).isDirectory()?t(e):h.unlinkSync(e)}),h.rmdirSync(n))},executeCommand:function(i){var a=/^mac verified ok/i;return new Promise(function(t,n){var e,r=s(i);null!=(e=r.stdout)&&e.on("data",function(e){o.debug(e)}),null!=(e=r.stderr)&&e.on("data",function(e){!e.match(a)&&i.includes("pkcs12")&&n(e)}),null!=(e=r.stderr)&&e.on("error",function(e){n(e)}),r.on("close",function(e){t(e)})})},checkOpenSSL:function(e){if(0===(e=u(e,["version"],{encoding:"utf-8"})).status)return o.debug(e.stdout),!0;throw new Error("Please install openssl or configure PATH."+e.stderr)},validatePassword:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return!(t.length<8)&&(e=0,/[a-z]/.test(t)&&e++,/[A-Z]/.test(t)&&e++,/[0-9]/.test(t)&&e++,/[`~!@#$%^&*()\-_=+\\|[{}];:'",<.>\/?]/.test(t)&&e++,2<=e)}}}),lr=Lt(function(e,t){var r=require("path"),n=require("os"),i=le().checkOpenSSL,a=n.platform(),n=require("@atomicservice/ascf-base"),o=n.getLogger,s=n.installAscfTools,u=o("openssl"),c=!1;function l(){return(l=_asyncToGenerator(_regenerator().m(function e(){var t,n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(t="openssl","win32"===a)return e.n=1,s();e.n=2;break;case 1:n=e.v,t=r.join(n,"/lib/tools/release_64/bin/openssl.exe");case 2:return e.a(2,(c||(u.debug(t),c=i(t)),t))}},e)}))).apply(this,arguments)}function h(){return(h=_asyncToGenerator(_regenerator().m(function e(){var t,n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(t="","win32"===a)return e.n=1,s();e.n=2;break;case 1:n=e.v,t="-config ".concat(r.join(n,"/lib/tools/release_64/SSL/openssl.cnf"));case 2:return e.a(2,t)}},e)}))).apply(this,arguments)}t.exports={getOpensslPath:function(){return l.apply(this,arguments)},getOpensslConfig:function(){return h.apply(this,arguments)}}}),Qn=Lt(function(z,e){var f,l=require("crypto"),d=require("path"),p=require("fs"),n=Pe().jszip,g=Ce(),t=require("@atomicservice/ascf-base").getLogger,r=le(),m=r.RAWFILE_DIR,_=r.ASCF_BUILD,y=r.clearResource,v=r.copyDirectory,b=r.getEntryPkgPath,w=r.getManifestData,k=r.readJsonFile,S=r.ASCF_CONFIG_JSON,c=r.P12_PATH,N=r.QUICK_SERVICE_BUILD,L=r.DIST_PATH,h=r.executeCommand,E=lr().getOpensslPath,C=t("generate-spk"),s=100,j=1e4,H=0;function A(){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=d.resolve(t,S),e.n=1,function(){return u.apply(this,arguments)}(n,t,r);case 1:return i=e.v,e.n=2,function(){return o.apply(this,arguments)}(n,t,r);case 2:return a=e.v,e.a(2,g.getSignInfo(a,i,f))}},e)}))).apply(this,arguments)}function o(){return(o=_asyncToGenerator(_regenerator().m(function e(r,i,a){var o,s,u;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(o="",p.existsSync(r.signPublicKeyPath)&&(C.debug("Obtaining a public Key using a Path"),o=p.readFileSync(r.signPublicKeyPath)),!o&&p.existsSync(r.signProfilePath))return C.debug("Obtain the private key using the p12 file path specified by the parameter"),e.n=1,R(r.signProfilePath,F(r.signPwd));e.n=2;break;case 1:o=e.v;case 2:o||!p.existsSync(a)?e.n=5:(s=null==(s=JSON.parse(p.readFileSync(a).toString()))?void 0:s.signConfig,p.existsSync(null==s?void 0:s.publicKeyPath)?(C.debug("Obtain the public key from the ascf.config.json publicKeyPath"),o=p.readFileSync(s.publicKeyPath),e.n=5):e.n=3);break;case 3:if(p.existsSync(null==s?void 0:s.profilePath))return C.debug("Obtain the public key from the ascf.config.json profilePath"),e.n=4,R(s.profilePath,F(r.signPwd));e.n=5;break;case 4:o=e.v;case 5:if(u=d.resolve(i,"sign/certificate.pem"),!o&&p.existsSync(u)&&(C.debug("Obtaining the public key using ".concat(u)),o=p.readFileSync(u)),u=d.resolve(i,c),!o&&p.existsSync(u))return C.debug("Obtaining the public Key Using the .p12 File"),e.n=6,R(u,F(r.signPwd));e.n=7;break;case 6:o=e.v;case 7:o||(C.error("failed to obtain the public key, please ensure certificate.pem or ascf-build.p12 under sign"),process.exit(-1)),n=t=void 0;var t=o,n=(t=g.checkValidity(t)).validityDays,t=t.isInvalid;if(n<0||t)throw new Error("ERROR: Your certificate is Invalid.");return n<180&&C.warn("WARNING: Your certificate is valid for less than 180 days. Please update it in time."),e.a(2,o)}},e)}))).apply(this,arguments)}function u(){return(u=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(i="",p.existsSync(t.signPrivateKeyPath)&&(C.debug("Obtaining a private Key using a Path"),i=p.readFileSync(t.signPrivateKeyPath)),!i&&p.existsSync(t.signProfilePath))return C.debug("Obtain the private key using the p12 file path specified by the parameter"),e.n=1,P(t.signProfilePath,F(t.signPwd));e.n=2;break;case 1:i=e.v;case 2:i||!p.existsSync(r)?e.n=5:(a=null==(a=JSON.parse(p.readFileSync(r).toString()))?void 0:a.signConfig,p.existsSync(null==a?void 0:a.privateKeyPath)?(C.debug("Obtain the private key from the ascf.config.json privateKeyPath"),i=p.readFileSync(a.privateKeyPath),e.n=5):e.n=3);break;case 3:if(p.existsSync(null==a?void 0:a.profilePath))return C.debug("Obtain the private key from the ascf.config.json profilePath"),e.n=4,P(a.profilePath,F(t.signPwd));e.n=5;break;case 4:i=e.v;case 5:if(o=d.resolve(n,"sign/private.pem"),!i&&p.existsSync(o)&&(C.debug("Obtaining the private key using ".concat(o)),i=p.readFileSync(o)),o=d.resolve(n,c),!i&&p.existsSync(o))return C.debug("Obtaining the private Key Using the p12 File"),e.n=6,P(o,F(t.signPwd));e.n=7;break;case 6:i=e.v;case 7:return i||(C.error("failed to obtain the private key, please ensure private.pem or ascf-build.p12 under sign"),process.exit(-1)),e.a(2,i)}},e)}))).apply(this,arguments)}function x(){return a.apply(this,arguments)}function a(){return(a=_asyncToGenerator(_regenerator().m(function e(i,t,a,o){return _regenerator().w(function(e){for(;;)if(0===e.n)return e.a(2,(p.existsSync(i)||p.mkdirSync(i),t=a.rpksBuffer,n=i,(r=o).length>s&&(r=r.slice(0,s)),n=d.join(n,r),p.writeFileSync(n,t),C.info("Build spk ".concat(n)),n));var t,n,r},e)}))).apply(this,arguments)}function O(e){if(!e.package||!e.package.startsWith("com.atomicservice."))throw new Error("The package in the app.json file cannot be empty and must start with com.atomicservice.");if(!e.versionName||!e.versionCode)throw new Error("The versionName and versionCode fields in the app.json file cannot be empty.")}function D(e){var t=(new Date).toISOString().split("T")[0].split("-").join(""),n="production"===process.env.NODE_ENV?"release":"debug";return"".concat(e.package,"-").concat(e.versionCode,"-").concat(n,"-").concat(t,".spk")}function B(){return(B=_asyncToGenerator(_regenerator().m(function e(n,t){var r,i,a,o,s,u,c,l,h;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(r=d.join(n,S),(f=(p.existsSync(r)?require(r):{}).sign)&&!f.host)throw new Error("ERROR: The signature configuration file is incorrect, the hostvalue is empty.");e.n=1;break;case 1:return e.n=2,A(n,t);case 2:if(i=e.v){e.n=3;break}throw new Error("ERROR: Failed to obtain the signature configuration information.");case 3:return a=d.resolve(n,L),o=d.resolve(n,N),e.n=4,y([o]);case 4:if(O(s=w(n)),u=D(s),null!=(r=s.subpackages)&&r.forEach(function(e){var t=d.resolve(n,_,e.resource,m);v(t,d.resolve(o,e.resource))}),v(d.resolve(b(n),m),o),l=g.generatePkgDef(s.subpackages),c=l.mainPkg,l=l.subPkgs,(h=0<(h=[]).length?h:g.getResources(o)).length){e.n=5;break}throw new Error("The packed file is empty.");case 5:return e.a(2,(g.addResourceToPkg(h,o,c,l),g.signPkgs("",i,c,l,t).then((()=>{var t=_asyncToGenerator(_regenerator().m(function e(t){var n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x(a,s.subpackages,t,u);case 1:if(n=e.v,"release"===s.versionType)return e.n=2,T(n);e.n=2;break;case 2:return e.a(2,n)}},e)}));return function(e){return t.apply(this,arguments)}})())))}},e)}))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a,o,s,u,c,l,h;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return a={signPrivateKeyPath:r,signPublicKeyPath:n,disableSubpackages:!1},e.n=1,A("",a);case 1:if(o=e.v,l=d.resolve(t,"manifest.json"),s=k(l),u=D(s),O(s),l=g.generatePkgDef(s.subpackages),c=l.mainPkg,l=l.subPkgs,(h=0<(h=[]).length?h:g.getResources(t)).length){e.n=2;break}throw new Error("The packed file is empty.");case 2:g.addResourceToPkg(h,t,c,l),i=null!=i?i:d.resolve(t,"dist"),g.signPkgs("",o,c,l,a).then((()=>{var t=_asyncToGenerator(_regenerator().m(function e(t){var n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x(i,s.subpackages,t,u);case 1:if(n=e.v,"release"===s.versionType)return e.n=2,T(n);e.n=2;break;case 2:return e.a(2,n)}},e)}));return function(e){return t.apply(this,arguments)}})());case 3:return e.a(2)}},e)}))).apply(this,arguments)}function T(e){var t=ve(),a=t.MAX_SIZE_SSPK,t=t.MAX_SIZE_SPK;if(p.statSync(e).size>t)throw new Error("Total package is exceed limit ".concat(t/1024/1024," MB."));return new Promise(function(r,i){p.readFile(e,function(e,t){if(e)return i(e);n.loadAsync(t).then(function(e){var n=null;if(e.forEach(function(e,t){if(j<++H)throw"Reached max. number of files";!n&&t._data.compressedSize>a&&(n=new Error("Package is exceed limit ".concat(a/1024/1024," MB.")))}),n)return i(n);r()})})})}function F(e){e=null!=e?e:process.env.ASCF_SIGN_PWD;return e||(C.error("signPwd is null, please configure through cli options, ascf.config.json or env ASCF_SIGN_PWD"),process.exit(-1)),e}function P(u,c){return new Promise((n=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o,s;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return C.debug("Start to obtain the private key"),r=l.randomBytes(16).toString("hex"),i=l.randomBytes(16).toString("hex"),e.p=1,e.n=2,E();case 2:return a=e.v,o="".concat(a," pkcs12 -in ").concat(u," -nocerts -nodes -out ").concat(r," -passin pass:").concat(c),C.debug("".concat(a," pkcs12 -in ").concat(u," -nocerts -nodes -out ").concat(r," -passin pass:***")),e.n=3,h(o);case 3:return o="".concat(a," ec -in ").concat(r," -check -out ").concat(i),C.debug("".concat(a," ec -in ").concat(r," -check -out ").concat(i)),e.n=4,h(o);case 4:return p.existsSync(r)&&p.unlinkSync(r),s="",e.a(2,(p.existsSync(i)&&(s=p.readFileSync(i),p.unlinkSync(i)),C.debug("Obtaining the private key is complete."),t(s)));case 5:e.p=5,s=e.v,p.existsSync(r)&&p.unlinkSync(r),p.existsSync(i)&&p.unlinkSync(i),n("Failed to obtain the private key: ".concat(s));case 6:return e.a(2)}},e,null,[[1,5]])})),function(e,t){return n.apply(this,arguments)}));var n}function R(o,s){return new Promise((n=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=l.randomBytes(16).toString("hex"),e.p=1,e.n=2,E();case 2:return i=e.v,a="".concat(i," pkcs12 -in ").concat(o," -nokeys -clcerts -passin pass:").concat(s," | ").concat(i," x509 -out ").concat(r),C.debug("".concat(i," pkcs12 -in ").concat(o," -nokeys -clcerts -passin pass:*** | ").concat(i," x509 -out ").concat(r)),e.n=3,h(a);case 3:if(p.existsSync(r))return i=p.readFileSync(r),e.a(2,(p.unlinkSync(r),t(i)));e.n=4;break;case 4:e.n=6;break;case 5:e.p=5,a=e.v,p.existsSync(r)&&p.unlinkSync(r),n("Failed to obtain the cert key: ".concat(a));case 6:return e.a(2)}},e,null,[[1,5]])})),function(e,t){return n.apply(this,arguments)}));var n}e.exports={signSpk:function(e,t){return B.apply(this,arguments)},resignSpk:function(e,t,n,r){return I.apply(this,arguments)}}}),ri=Lt(function(e,t){require("path");var s=require("fs"),n=require("@atomicservice/ascf-base").getLogger,r=le(),u=r.executeCommand,c=r.validatePassword,r=lr(),l=r.getOpensslPath,h=r.getOpensslConfig,f=n("cert-utils");function i(){return(i=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(s.existsSync(t)||s.existsSync(n))throw new Error("".concat(t," or ").concat(n," exists"));e.n=1;break;case 1:return e.p=1,e.n=2,l();case 2:return r=e.v,e.n=3,h();case 3:return i=e.v,a="".concat(r," ecparam -name secp256r1 -genkey -noout -out ").concat(t),f.debug(a),e.n=4,u(a);case 4:return a="".concat(r," req -new -x509 -key ").concat(t," -out ").concat(n,' -days 3650 -sha256 -subj "/CN=ASCF/OU=/O=/L=/ST=/C=CN" ').concat(i),f.debug(a),e.n=5,u(a);case 5:e.n=7;break;case 6:e.p=6,o=e.v,f.error("Failed to generate cert",o),s.existsSync(t)&&s.unlinkSync(t),s.existsSync(n)&&s.unlinkSync(n);case 7:return e.a(2)}},e,null,[[1,6]])}))).apply(this,arguments)}function a(){return(a=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a,o;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c(i)){e.n=1;break}throw new Error("Invalid Password.\nThe password must contain at least 8 characters and include any two of the following:\n1. Lowercase letters: a-z\n2. Uppercase letters : A-Z\n3. Digits : 0-9\n4. Special characters : `~!@#$%^&*()-_=+\\|[{}];:'\",<.>/?");case 1:if(s.existsSync(t))throw new Error("".concat(t," exists"));e.n=2;break;case 2:return e.p=2,e.n=3,l();case 3:return o=e.v,a="".concat(o," pkcs12 -export -out ").concat(t," -inkey ").concat(n," -in ").concat(r," -passout pass:").concat(i),f.debug("".concat(o," pkcs12 -export -out ").concat(t," -inkey ").concat(n," -in ").concat(r," -passout pass:***")),e.n=4,u(a);case 4:e.n=6;break;case 5:e.p=5,o=e.v,f.error("Failed to generate p12",o),s.existsSync(t)&&s.unlinkSync(t);case 6:return e.a(2)}},e,null,[[2,5]])}))).apply(this,arguments)}t.exports={genCert:function(e,t){return i.apply(this,arguments)},genP12:function(e,t,n,r){return a.apply(this,arguments)}}}),ii=Lt(function(e){var r=require("path"),i=require("decompress"),a=Ce().getSignedZipCertFp,t=le(),o=t.clearResource,s=t.deleteDirectory;function n(){return(n=_asyncToGenerator(_regenerator().m(function e(t,n){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=null!=n?n:r.resolve(r.dirname(t),"dist"),e.n=1,a(t);case 1:return e.n=2,o([n]);case 2:return e.n=3,i(t,n);case 3:s(r.resolve(n,"META-INF"));case 4:return e.a(2)}},e)}))).apply(this,arguments)}e.verifySignHandler=function(e,t){return n.apply(this,arguments)}}),li=Lt(function(e,t){var m=require("fs"),_=require("path"),i=Pe().jszip,n=le(),y=n.mkdirsSync,f=n.extractspk,d=n.clearResource,v=Ce(),a="manifest.json",b="";function p(){return(p=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a,o,s,u,c,l,h,f,d,p,g;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return y(n),a=t.package,o=t.versionType,s=t.versionCode,d=i.privateKeyFilePath,c=i.certFilePath,c=m.readFileSync(c),d=m.readFileSync(d),e.n=1,v.getSignInfo(c,d);case 1:if(u=e.v,c=v.generatePkgDef(t.subpackages),l=c.mainPkg,h=c.subPkgs,(f=0<(f=[]).length?f:v.getResources(r)).length){e.n=2;break}throw new Error("The packed file is empty.");case 2:return v.addResourceToPkg(f,r,l,h),e.n=3,v.signPkgs(a,u,l,h,{disableSubpackages:!1});case 3:d=e.v,p=d.rpksBuffer,g=(new Date).toISOString().split("T")[0].split("-").join(""),b=_.join(n,"".concat(a,"-").concat(s,"-").concat(o,"-").concat(g,".spk")),m.writeFileSync(b,p);case 4:return e.a(2)}},e)}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regenerator().m(function e(t){var n,r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,(new i).loadAsync(m.readFileSync(t));case 1:if((n=e.v).files["base.sspk"]){e.n=2;break}throw new Error("Can not resolve base.sspk file.");case 2:return e.n=3,n.files["base.sspk"].async("nodebuffer");case 3:return r=e.v,e.n=4,(new i).loadAsync(r);case 4:return e.n=5,e.v.file(a).async("string");case 5:return r=e.v,e.a(2,JSON.parse(r)||{})}},e)}))).apply(this,arguments)}t.exports={spkHandler:function(s,u,c,l,h){return new Promise((n=_asyncToGenerator(_regenerator().m(function e(n,r){var i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(m.existsSync(s)){e.n=1;break}return e.a(2,r(new Error("Can not resolve spk file: ".concat(s))));case 1:if(m.existsSync(u)){e.n=2;break}return e.a(2,r(new Error("Can not resolve certificate file: ".concat(u))));case 2:if(m.existsSync(c)){e.n=3;break}return e.a(2,r(new Error("Can not resolve private key file: ".concat(c))));case 3:return e.n=4,function(){return g.apply(this,arguments)}(s);case 4:if(i=e.v,t=i,0===Object.keys(t).length)return e.a(2,r(new Error("Invalid spk file.")));e.n=5;break;case 5:return a=i.package,o=_.dirname(s),o=_.join(o,a),a=_.join(null!=l?l:o,"quick-service-build"),o=_.join(null!=l?l:o,"dist"),e.n=6,d([a,o]);case 6:return y(a),e.n=7,f(s,a);case 7:return i.versionType=null!=h?h:i.versionType,m.writeFileSync(_.resolve(a,"manifest.json"),JSON.stringify(i,null,2)),e.n=8,function(){return p.apply(this,arguments)}(i,o,a,{privateKeyFilePath:c,certFilePath:u});case 8:return e.a(2,n(b))}var t},e)})),function(e,t){return n.apply(this,arguments)}));var n}}}),_Qn=Qn(),oo=_Qn.signSpk,lo=_Qn.resignSpk,_ri=ri(),ho=_ri.genCert,uo=_ri.genP12,_le6=le(),co=_le6.formatHexString,_ii=ii(),fo=_ii.verifySignHandler,_require9=require("@atomicservice/ascf-base"),po=_require9.getLogger,_li=li(),go=_li.spkHandler,_Ce2=Ce(),mo=_Ce2.getCertString,Rt=po("index");function _o(e,t){return _o18.apply(this,arguments)}function _o18(){return(_o18=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec sign spk"),e.n=1,oo(t,n);case 1:return r=e.v,e.a(2,(Rt.info("Signed successfully."),r));case 2:e.p=2,r=e.v,Rt.fatal("Signing failed: "+r),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function bo(e,t,n,r){return _bo.apply(this,arguments)}function _bo(){return(_bo=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec resign spk"),e.n=1,lo(t,n,r,i);case 1:Rt.info("Signed successfully."),e.n=3;break;case 2:e.p=2,a=e.v,Rt.fatal("Signing failed: "+a),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function yo(e,t){return _yo.apply(this,arguments)}function _yo(){return(_yo=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec verify sign"),e.n=1,fo(t,n);case 1:Rt.info("Signature verification succeeded."),e.n=3;break;case 2:e.p=2,r=e.v,Rt.info("Failed to verify the signature: ",r),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function vo(e,t,n,r,i){return _vo.apply(this,arguments)}function _vo(){return(_vo=_asyncToGenerator(_regenerator().m(function e(t,n,r,i,a){var o;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec repack"),e.n=1,go(t,n,r,i,a);case 1:o=e.v,Rt.info("exec repack success, repack package path: "+o),e.n=3;break;case 2:e.p=2,o=e.v,Rt.fatal("repack failed: "+o),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function wo(e){try{Rt.info("start exec print fingerprints");var t=mo(e),n=co(t);Rt.info("exec print fingerprints success, fingerprints info: "+n)}catch(e){Rt.fatal("failed to obtain the fingerprint: "+e),process.exit(-1)}}process.on("uncaughtException",function(e){Rt.error("ASCF uncaught error",e)}),process.on("unhandledRejection",function(e,t){Rt.error("ASCF unhandled rejection at:",t,"reason:",e)}),module.exports={signPkg:_o,resignPkg:bo,verifySign:yo,repackHandler:vo,printFp:wo,genCert:ho,genP12:uo};
1
+ function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _regenerator(){var p,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function r(e,t,n,r){var i,a,o,s,u,c,l,h,f,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(i=e,a=n,l=r||[],h=!1,f={p:c=0,n:0,v:p,a:d,f:d.bind(p,4),d:function(e,t){return o=e,s=0,u=p,f.n=t,g}},function(e,t,n){if(1<c)throw TypeError("Generator is already running");for(h&&1===t&&d(t,n),s=t,u=n;(_=s<2?p:u)||!h;){o||(s?s<3?(1<s&&(f.n=-1),d(s,u)):f.n=u:f.v=u);try{if(c=2,o){if(_=o[e=s?e:"next"]){if(!(_=_.call(o,u)))throw TypeError("iterator result is not an object");if(!_.done)return _;u=_.value,s<2&&(s=0)}else 1===s&&(_=o.return)&&_.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),s=1);o=p}else if((_=(h=f.n<0)?u:i.call(a,f))!==g)break}catch(e){o=p,s=1,u=e}finally{c=1}}return{value:_,done:h}}),!0),t;function d(e,t){for(s=e,u=t,_=0;!h&&c&&!n&&_<l.length;_++){var n,r=l[_],i=f.p,a=r[2];3<e?(n=a===t)&&(u=r[(s=r[4])?5:s=3],r[4]=r[5]=p):r[0]<=i&&((n=e<2&&i<r[1])?(s=0,f.v=t,f.n=r[1]):i<a&&(n=e<3||r[0]>t||a<t)&&(r[4]=e,r[5]=t,f.n=a,s=0))}if(n||1<e)return g;throw h=!0,t}}var g={};function m(){}function i(){}function a(){}var _=Object.getPrototypeOf,e=[][t]?_(_([][t]())):(_regeneratorDefine2(_={},t,function(){return this}),_),o=a.prototype=m.prototype=Object.create(e);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,_regeneratorDefine2(e,n,"GeneratorFunction")),e.prototype=Object.create(o),e}return _regeneratorDefine2(o,"constructor",i.prototype=a),_regeneratorDefine2(a,"constructor",i),_regeneratorDefine2(a,n,i.displayName="GeneratorFunction"),_regeneratorDefine2(o),_regeneratorDefine2(o,n,"Generator"),_regeneratorDefine2(o,t,function(){return this}),_regeneratorDefine2(o,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:s}})()}function _regeneratorDefine2(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(_regeneratorDefine2=function(e,t,n,r){function i(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function _asyncToGenerator(s){return function(){var e=this,o=arguments;return new Promise(function(t,n){var r=s.apply(e,o);function i(e){asyncGeneratorStep(r,t,n,i,a,"next",e)}function a(e){asyncGeneratorStep(r,t,n,i,a,"throw",e)}i(void 0)})}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _callSuper(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}function _possibleConstructorReturn(e,t){if(t&&("object"==_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(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&&_setPrototypeOf(e,t)}function _wrapNativeSuper(e){var n="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(t,e)})(e)}function _construct(e,t,n){var r;return _isNativeReflectConstruct()?Reflect.construct.apply(null,arguments):((r=[null]).push.apply(r,t),t=new(e.bind.apply(e,r)),n&&_setPrototypeOf(t,n.prototype),t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function _isNativeFunction(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var n,r,i,a,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return i=!(r=!0),{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){i=!0,n=e},f:function(){try{r||null==o.return||o.return()}finally{if(i)throw n}}};if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return o&&(e=o),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _typeof(e){return(_typeof="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})(e)}var Lt=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},Pe=Lt(function(c,e){function t(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}}function r(t,n,r,i){if(n&&"object"==_typeof(n)||"function"==typeof n){var a,o=_createForOfIteratorHelper(y(n));try{for(o.s();!(a=o.n()).done;)(()=>{var e=a.value;j.call(t,e)||e===r||s(t,e,{get:function(){return n[e]},enumerable:!(i=_(n,e))||i.enumerable})})()}catch(e){o.e(e)}finally{o.f()}}return t}function n(e,t,n){return n=null!=e?h(D(e)):{},r(!t&&e&&e.__esModule?n:s(n,"default",{value:e,enumerable:!0}),e)}var i,h=Object.create,s=Object.defineProperty,_=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,D=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,b=t(function(e){_inherits(i,_wrapNativeSuper(Error));var t=_createClass(i),n=(_inherits(r,t),_createClass(r));function r(e){return _classCallCheck(this,r),e=_callSuper(this,r,[1,"commander.invalidArgument",e]),Error.captureStackTrace(_assertThisInitialized(e),e.constructor),e.name=e.constructor.name,e}function i(e,t,n){return _classCallCheck(this,i),n=_callSuper(this,i,[n]),Error.captureStackTrace(_assertThisInitialized(n),n.constructor),n.name=n.constructor.name,n.code=t,n.exitCode=e,n.nestedError=void 0,n}e.CommanderError=t,e.InvalidArgumentError=n}),w=t(function(e){var r=b().InvalidArgumentError,t=_createClass(function e(t,n){switch(_classCallCheck(this,e),this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t}3<this._name.length&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))},[{key:"name",value:function(){return this._name}},{key:"_concatValue",value:function(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}},{key:"default",value:function(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}},{key:"argParser",value:function(e){return this.parseArg=e,this}},{key:"choices",value:function(e){var n=this;return this.argChoices=e.slice(),this.parseArg=function(e,t){if(n.argChoices.includes(e))return n.variadic?n._concatValue(e,t):e;throw new r("Allowed choices are ".concat(n.argChoices.join(", "),"."))},this}},{key:"argRequired",value:function(){return this.required=!0,this}},{key:"argOptional",value:function(){return this.required=!1,this}}]);e.Argument=t,e.humanReadableArgName=function(e){var t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}}),k=t(function(e){var n=w().humanReadableArgName,t=_createClass(function e(){_classCallCheck(this,e),this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1},[{key:"visibleCommands",value:function(e){var t,n,r=e.commands.filter(function(e){return!e._hidden});return e._hasImplicitHelpCommand()&&(n=(t=_slicedToArray(e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),3))[1],t=t[2],(n=e.createCommand(n).helpOption(!1)).description(e._helpCommandDescription),t&&n.arguments(t),r.push(n)),this.sortSubcommands&&r.sort(function(e,t){return e.name().localeCompare(t.name())}),r}},{key:"visibleOptions",value:function(e){var n,t=e.options.filter(function(e){return!e.hidden}),r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);return(r||i)&&(r=r?i?e.createOption(e._helpFlags,e._helpDescription):e.createOption(e._helpShortFlag,e._helpDescription):e.createOption(e._helpLongFlag,e._helpDescription),t.push(r)),this.sortOptions&&(n=function(e){return e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"")},t.sort(function(e,t){return n(e).localeCompare(n(t))})),t}},{key:"visibleArguments",value:function(t){return t._argsDescription&&t._args.forEach(function(e){e.description=e.description||t._argsDescription[e.name()]||""}),t._args.find(function(e){return e.description})?t._args:[]}},{key:"subcommandTerm",value:function(e){var t=e._args.map(function(e){return n(e)}).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}},{key:"optionTerm",value:function(e){return e.flags}},{key:"argumentTerm",value:function(e){return e.name()}},{key:"longestSubcommandTermLength",value:function(e,n){return n.visibleCommands(e).reduce(function(e,t){return Math.max(e,n.subcommandTerm(t).length)},0)}},{key:"longestOptionTermLength",value:function(e,n){return n.visibleOptions(e).reduce(function(e,t){return Math.max(e,n.optionTerm(t).length)},0)}},{key:"longestArgumentTermLength",value:function(e,n){return n.visibleArguments(e).reduce(function(e,t){return Math.max(e,n.argumentTerm(t).length)},0)}},{key:"commandUsage",value:function(e){for(var t=e._name,n=(e._aliases[0]&&(t=t+"|"+e._aliases[0]),""),r=e.parent;r;r=r.parent)n=r.name()+" "+n;return n+t+" "+e.usage()}},{key:"commandDescription",value:function(e){return e.description()}},{key:"subcommandDescription",value:function(e){return e.summary()||e.description()}},{key:"optionDescription",value:function(e){var t=[];return e.argChoices&&t.push("choices: ".concat(e.argChoices.map(function(e){return JSON.stringify(e)}).join(", "))),void 0!==e.defaultValue&&(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push("default: ".concat(e.defaultValueDescription||JSON.stringify(e.defaultValue))),void 0!==e.presetArg&&e.optional&&t.push("preset: ".concat(JSON.stringify(e.presetArg))),void 0!==e.envVar&&t.push("env: ".concat(e.envVar)),0<t.length?"".concat(e.description," (").concat(t.join(", "),")"):e.description}},{key:"argumentDescription",value:function(e){var t=[];return e.argChoices&&t.push("choices: ".concat(e.argChoices.map(function(e){return JSON.stringify(e)}).join(", "))),void 0!==e.defaultValue&&t.push("default: ".concat(e.defaultValueDescription||JSON.stringify(e.defaultValue))),0<t.length?(t="(".concat(t.join(", "),")"),e.description?"".concat(e.description," ").concat(t):t):e.description}},{key:"formatHelp",value:function(e,n){var r=n.padWidth(e,n),i=n.helpWidth||80;function t(e,t){return t?(t="".concat(e.padEnd(r+2)).concat(t),n.wrap(t,i-2,r+2)):e}function a(e){return e.join("\n").replace(/^/gm," ".repeat(2))}var o=["Usage: ".concat(n.commandUsage(e)),""],s=n.commandDescription(e),s=(0<s.length&&(o=o.concat([s,""])),n.visibleArguments(e).map(function(e){return t(n.argumentTerm(e),n.argumentDescription(e))})),s=(0<s.length&&(o=o.concat(["Arguments:",a(s),""])),n.visibleOptions(e).map(function(e){return t(n.optionTerm(e),n.optionDescription(e))})),s=(0<s.length&&(o=o.concat(["Options:",a(s),""])),n.visibleCommands(e).map(function(e){return t(n.subcommandTerm(e),n.subcommandDescription(e))}));return(o=0<s.length?o.concat(["Commands:",a(s),""]):o).join("\n")}},{key:"padWidth",value:function(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}},{key:"wrap",value:function(e,t,n){var r,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:40;return e.match(/[\n]\s+/)||(t=t-n)<i?e:(i=e.slice(0,n),e=e.slice(n),r=" ".repeat(n),n=new RegExp(".{1,"+(t-1)+"}([\\s​]|$)|[^\\s​]+?([\\s​]|$)","g"),i+(e.match(n)||[]).map(function(e,t){return"\n"===e.slice(-1)&&(e=e.slice(0,e.length-1)),(0<t?r:"")+e.trimRight()}).join("\n"))}}]);e.Help=t}),S=t(function(e){var r=b().InvalidArgumentError,t=_createClass(function e(t,n){_classCallCheck(this,e),this.flags=t,this.description=n||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;n=i(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0},[{key:"default",value:function(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}},{key:"preset",value:function(e){return this.presetArg=e,this}},{key:"conflicts",value:function(e){return this.conflictsWith=this.conflictsWith.concat(e),this}},{key:"implies",value:function(e){return this.implied=Object.assign(this.implied||{},e),this}},{key:"env",value:function(e){return this.envVar=e,this}},{key:"argParser",value:function(e){return this.parseArg=e,this}},{key:"makeOptionMandatory",value:function(){return this.mandatory=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"hideHelp",value:function(){return this.hidden=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"_concatValue",value:function(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}},{key:"choices",value:function(e){var n=this;return this.argChoices=e.slice(),this.parseArg=function(e,t){if(n.argChoices.includes(e))return n.variadic?n._concatValue(e,t):e;throw new r("Allowed choices are ".concat(n.argChoices.join(", "),"."))},this}},{key:"name",value:function(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}},{key:"attributeName",value:function(){return this.name().replace(/^no-/,"").split("-").reduce(function(e,t){return e+t[0].toUpperCase()+t.slice(1)})}},{key:"is",value:function(e){return this.short===e||this.long===e}},{key:"isBoolean",value:function(){return!this.required&&!this.optional&&!this.negate}}]),n=_createClass(function e(t){var n=this;_classCallCheck(this,e),this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(function(e){(e.negate?n.negativeOptions:n.positiveOptions).set(e.attributeName(),e)}),this.negativeOptions.forEach(function(e,t){n.positiveOptions.has(t)&&n.dualOptions.add(t)})},[{key:"valueFromOption",value:function(e,t){var n=t.attributeName();return!this.dualOptions.has(n)||(n=this.negativeOptions.get(n).presetArg,t.negate===((void 0!==n&&n)===e))}}]);function i(e){var t,e=e.split(/[ |,]+/);return 1<e.length&&!/^[[<]/.test(e[1])&&(t=e.shift()),e=e.shift(),!t&&/^-[^-]$/.test(e)&&(t=e,e=void 0),{shortFlag:t,longFlag:e}}e.Option=t,e.splitOptionFlags=i,e.DualOptions=n}),H=t(function(e){e.suggestSimilar=function(r,e){if(!e||0===e.length)return"";e=Array.from(new Set(e));var t=r.startsWith("--"),i=(t&&(r=r.slice(2),e=e.map(function(e){return e.slice(2)})),[]),a=3;return e.forEach(function(e){var t,n;e.length<=1||(t=((e,t)=>{if(3<Math.abs(e.length-t.length))return Math.max(e.length,t.length);for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(var a=1;a<=t.length;a++)for(var o=1;o<=e.length;o++){var s=1,s=e[o-1]===t[a-1]?0:1;n[o][a]=Math.min(n[o-1][a]+1,n[o][a-1]+1,n[o-1][a-1]+s),1<o&&1<a&&e[o-1]===t[a-2]&&e[o-2]===t[a-1]&&(n[o][a]=Math.min(n[o][a],n[o-2][a-2]+1))}return n[e.length][t.length]})(r,e),.4<((n=Math.max(r.length,e.length))-t)/n&&(t<a?(a=t,i=[e]):t===a&&i.push(e)))}),i.sort(function(e,t){return e.localeCompare(t)}),1<(i=t?i.map(function(e){return"--".concat(e)}):i).length?"\n(Did you mean one of ".concat(i.join(", "),"?)"):1===i.length?"\n(Did you mean ".concat(i[0],"?)"):""}}),U=t(function(e){var n,t=require("events").EventEmitter,l=require("child_process"),h=require("path"),f=require("fs"),d=require("process"),r=w(),i=r.Argument,a=r.humanReadableArgName,p=b().CommanderError,o=k().Help,r=S(),s=r.Option,u=r.splitOptionFlags,c=r.DualOptions,g=H().suggestSimilar,r=(_inherits(m,t),_createClass(m,[{key:"copyInheritedSettings",value:function(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}},{key:"command",value:function(e,t,n){"object"==_typeof(t)&&null!==t&&(n=t,t=null);var n=n||{},e=_slicedToArray(e.match(/([^ ]+) *(.*)/),3),r=e[1],e=e[2],r=this.createCommand(r);return t&&(r.description(t),r._executableHandler=!0),n.isDefault&&(this._defaultCommandName=r._name),r._hidden=!(!n.noHelp&&!n.hidden),r._executableFile=n.executableFile||null,e&&r.arguments(e),this.commands.push(r),r.parent=this,r.copyInheritedSettings(this),t?this:r}},{key:"createCommand",value:function(e){return new m(e)}},{key:"createHelp",value:function(){return Object.assign(new o,this.configureHelp())}},{key:"configureHelp",value:function(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}},{key:"configureOutput",value:function(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}},{key:"showHelpAfterError",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this._showHelpAfterError=e="string"!=typeof e?!!e:e,this}},{key:"showSuggestionAfterError",value:function(){return this._showSuggestionAfterError=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"addCommand",value:function(e,t){if(e._name)return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this;throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()")}},{key:"createArgument",value:function(e,t){return new i(e,t)}},{key:"argument",value:function(e,t,n,r){e=this.createArgument(e,t);return"function"==typeof n?e.default(r).argParser(n):e.default(n),this.addArgument(e),this}},{key:"arguments",value:function(e){var t=this;return e.split(/ +/).forEach(function(e){t.argument(e)}),this}},{key:"addArgument",value:function(e){var t=this._args.slice(-1)[0];if(t&&t.variadic)throw new Error("only the last argument can be variadic '".concat(t.name(),"'"));if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error("a default value for a required argument is never used: '".concat(e.name(),"'"));return this._args.push(e),this}},{key:"addHelpCommand",value:function(e,t){return!1===e?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,"string"==typeof e&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}},{key:"_hasImplicitHelpCommand",value:function(){return void 0===this._addImplicitHelpCommand?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}},{key:"hook",value:function(e,t){var n=["preSubcommand","preAction","postAction"];if(n.includes(e))return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this;throw new Error("Unexpected value for event passed to hook : '".concat(e,"'.\nExpecting one of '").concat(n.join("', '"),"'"))}},{key:"exitOverride",value:function(e){return this._exitCallback=e||function(e){if("commander.executeSubCommandAsync"!==e.code)throw e},this}},{key:"_exit",value:function(e,t,n){this._exitCallback&&this._exitCallback(new p(e,t,n)),d.exit(e)}},{key:"action",value:function(n){var r=this;return this._actionHandler=function(e){var t=r._args.length,e=e.slice(0,t);return r._storeOptionsAsProperties?e[t]=r:e[t]=r.opts(),e.push(r),n.apply(r,e)},this}},{key:"createOption",value:function(e,t){return new s(e,t)}},{key:"addOption",value:function(i){function n(e,t,n){null==e&&void 0!==i.presetArg&&(e=i.presetArg);var r=a.getOptionValue(o);if(null!==e&&i.parseArg)try{e=i.parseArg(e,r)}catch(e){throw"commander.invalidArgument"===e.code&&(t="".concat(t," ").concat(e.message),a.error(t,{exitCode:e.exitCode,code:e.code})),e}else null!==e&&i.variadic&&(e=i._concatValue(e,r));null==e&&(e=!i.negate&&(!(!i.isBoolean()&&!i.optional)||"")),a.setOptionValueWithSource(o,e,n)}var e,a=this,t=i.name(),o=i.attributeName();i.negate?(e=i.long.replace(/^--no-/,"--"),this._findOption(e)||this.setOptionValueWithSource(o,void 0===i.defaultValue||i.defaultValue,"default")):void 0!==i.defaultValue&&this.setOptionValueWithSource(o,i.defaultValue,"default"),this.options.push(i);return this.on("option:"+t,function(e){var t="error: option '".concat(i.flags,"' argument '").concat(e,"' is invalid.");n(e,t,"cli")}),i.envVar&&this.on("optionEnv:"+t,function(e){var t="error: option '".concat(i.flags,"' value '").concat(e,"' from env '").concat(i.envVar,"' is invalid.");n(e,t,"env")}),this}},{key:"_optionEx",value:function(e,t,n,r,i){if("object"==_typeof(t)&&t instanceof s)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");var a,t=this.createOption(t,n);return t.makeOptionMandatory(!!e.mandatory),"function"==typeof r?t.default(i).argParser(r):r instanceof RegExp?(a=r,r=function(e,t){e=a.exec(e);return e?e[0]:t},t.default(i).argParser(r)):t.default(r),this.addOption(t)}},{key:"option",value:function(e,t,n,r){return this._optionEx({},e,t,n,r)}},{key:"requiredOption",value:function(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}},{key:"combineFlagAndOptionalValue",value:function(){return this._combineFlagAndOptionalValue=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"allowUnknownOption",value:function(){return this._allowUnknownOption=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"allowExcessArguments",value:function(){return this._allowExcessArguments=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"enablePositionalOptions",value:function(){return this._enablePositionalOptions=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this}},{key:"passThroughOptions",value:function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}},{key:"storeOptionsAsProperties",value:function(){if(this._storeOptionsAsProperties=!!(!(0<arguments.length&&void 0!==arguments[0])||arguments[0]),this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}},{key:"getOptionValue",value:function(e){return(this._storeOptionsAsProperties?this:this._optionValues)[e]}},{key:"setOptionValue",value:function(e,t){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this}},{key:"setOptionValueWithSource",value:function(e,t,n){return this.setOptionValue(e,t),this._optionValueSources[e]=n,this}},{key:"getOptionValueSource",value:function(e){return this._optionValueSources[e]}},{key:"_prepareUserArgs",value:function(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");var n;switch(t=t||{},void 0===e&&(e=d.argv,d.versions)&&d.versions.electron&&(t.from="electron"),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":n=d.defaultApp?(this._scriptPath=e[1],e.slice(2)):e.slice(1);break;case"user":n=e.slice(0);break;default:throw new Error("unexpected parse option { from: '".concat(t.from,"' }"))}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}},{key:"parse",value:function(e,t){e=this._prepareUserArgs(e,t);return this._parseCommand([],e),this}},{key:"parseAsync",value:(n=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=this._prepareUserArgs(t,n),e.n=1,this._parseCommand([],r);case 1:return e.a(2,this)}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"_executeSubCommand",value:function(n,e){e=e.slice();var r=[".js",".ts",".tsx",".mjs",".cjs"];function t(e,t){var n=h.resolve(e,t);return f.existsSync(n)?n:!r.includes(h.extname(t))&&(e=r.find(function(e){return f.existsSync("".concat(n).concat(e))}))?"".concat(n).concat(e):void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();var i,a,o,s=n._executableFile||"".concat(this._name,"-").concat(n._name),u=this._executableDir||"";if(this._scriptPath){try{i=f.realpathSync(this._scriptPath)}catch(e){i=this._scriptPath}u=h.resolve(h.dirname(i),u)}u&&((i=t(u,s))||n._executableFile||!this._scriptPath||(a=h.basename(this._scriptPath,h.extname(this._scriptPath)))!==this._name&&(i=t(u,"".concat(a,"-").concat(n._name))),s=i||s),a=r.includes(h.extname(s)),(o="win32"!==d.platform?a?(e.unshift(s),e=y(d.execArgv).concat(e),l.spawn(d.argv[0],e,{stdio:"inherit"})):l.spawn(s,e,{stdio:"inherit"}):(e.unshift(s),e=y(d.execArgv).concat(e),l.spawn(d.execPath,e,{stdio:"inherit"}))).killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(function(e){d.on(e,function(){!1===o.killed&&null===o.exitCode&&o.kill(e)})});var c=this._exitCallback;c?o.on("close",function(){c(new p(d.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):o.on("close",d.exit.bind(d)),o.on("error",function(e){var t;if("ENOENT"===e.code)throw t=u?"searched for local subcommand relative to directory '".concat(u,"'"):"no directory for search for local subcommand, use .executableDir() to supply a custom directory",t="'".concat(s,"' does not exist\n - if '").concat(n._name,"' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ").concat(t),new Error(t);if("EACCES"===e.code)throw new Error("'".concat(s,"' not executable"));c?((t=new p(1,"commander.executeSubCommandAsync","(error)")).nestedError=e,c(t)):d.exit(1)}),this.runningCommand=o}},{key:"_dispatchSubcommand",value:function(e,t,n){var r=this,i=this._findCommand(e);return i||this.help({error:!0}),e=this._chainOrCallSubCommandHook(void 0,i,"preSubcommand"),this._chainOrCall(e,function(){if(!i._executableHandler)return i._parseCommand(t,n);r._executeSubCommand(i,t.concat(n))})}},{key:"_checkNumberOfArguments",value:function(){var n=this;this._args.forEach(function(e,t){e.required&&null==n.args[t]&&n.missingArgument(e.name())}),!(0<this._args.length&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}},{key:"_processArguments",value:function(){function r(t,n,r){var e=n;if(null!==n&&t.parseArg)try{e=t.parseArg(n,r)}catch(e){throw"commander.invalidArgument"===e.code&&(r="error: command-argument value '".concat(n,"' is invalid for argument '").concat(t.name(),"'. ").concat(e.message),i.error(r,{exitCode:e.exitCode,code:e.code})),e}return e}var i=this,a=(this._checkNumberOfArguments(),[]);this._args.forEach(function(n,e){var t=n.defaultValue;n.variadic?e<i.args.length?(t=i.args.slice(e),n.parseArg&&(t=t.reduce(function(e,t){return r(n,t,e)},n.defaultValue))):void 0===t&&(t=[]):e<i.args.length&&(t=i.args[e],n.parseArg)&&(t=r(n,t,n.defaultValue)),a[e]=t}),this.processedArgs=a}},{key:"_chainOrCall",value:function(e,t){return e&&e.then&&"function"==typeof e.then?e.then(function(){return t()}):t()}},{key:"_chainOrCallHooks",value:function(e,n){var t=this,r=e,i=[];return v(this).reverse().filter(function(e){return void 0!==e._lifeCycleHooks[n]}).forEach(function(t){t._lifeCycleHooks[n].forEach(function(e){i.push({hookedCommand:t,callback:e})})}),"postAction"===n&&i.reverse(),i.forEach(function(e){r=t._chainOrCall(r,function(){return e.callback(e.hookedCommand,t)})}),r}},{key:"_chainOrCallSubCommandHook",value:function(e,t,n){var r=this,i=e;return void 0!==this._lifeCycleHooks[n]&&this._lifeCycleHooks[n].forEach(function(e){i=r._chainOrCall(i,function(){return e(r,t)})}),i}},{key:"_parseCommand",value:function(e,t){var n=this,r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return 1===e.length&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return _(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),_(this,r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();function i(){0<r.unknown.length&&n.unknownOption(r.unknown[0])}var a,o="command:".concat(this.name());if(this._actionHandler)return i(),this._processArguments(),a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,function(){return n._actionHandler(n.processedArgs)}),this.parent&&(a=this._chainOrCall(a,function(){n.parent.emit(o,e,t)})),a=this._chainOrCallHooks(a,"postAction");if(this.parent&&this.parent.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}},{key:"_findCommand",value:function(t){if(t)return this.commands.find(function(e){return e._name===t||e._aliases.includes(t)})}},{key:"_findOption",value:function(t){return this.options.find(function(e){return e.is(t)})}},{key:"_checkForMissingMandatoryOptions",value:function(){for(var e=this;e;e=e.parent)(t=>{t.options.forEach(function(e){e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)})})(e)}},{key:"_checkForConflictingLocalOptions",value:function(){var n=this,r=this.options.filter(function(e){e=e.attributeName();return void 0!==n.getOptionValue(e)&&"default"!==n.getOptionValueSource(e)});r.filter(function(e){return 0<e.conflictsWith.length}).forEach(function(t){var e=r.find(function(e){return t.conflictsWith.includes(e.attributeName())});e&&n._conflictingOption(t,e)})}},{key:"_checkForConflictingOptions",value:function(){for(var e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}},{key:"parseOptions",value:function(e){var t=[],n=[],r=t,i=e.slice();function a(e){return 1<e.length&&"-"===e[0]}for(var o=null;i.length;){var s=i.shift();if("--"===s){r===n&&r.push(s),r.push.apply(r,_toConsumableArray(i));break}if(o&&!a(s))this.emit("option:".concat(o.name()),s);else{if(o=null,a(s)){var u,c=this._findOption(s);if(c){c.required?(void 0===(u=i.shift())&&this.optionMissingArgument(c),this.emit("option:".concat(c.name()),u)):c.optional?(u=null,0<i.length&&!a(i[0])&&(u=i.shift()),this.emit("option:".concat(c.name()),u)):this.emit("option:".concat(c.name())),o=c.variadic?c:null;continue}}if(2<s.length&&"-"===s[0]&&"-"!==s[1]){c=this._findOption("-".concat(s[1]));if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit("option:".concat(c.name()),s.slice(2)):(this.emit("option:".concat(c.name())),i.unshift("-".concat(s.slice(2))));continue}}if(/^--[^=]+=/.test(s)){var l=s.indexOf("="),h=this._findOption(s.slice(0,l));if(h&&(h.required||h.optional)){this.emit("option:".concat(h.name()),s.slice(l+1));continue}}if(a(s)&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===n.length){if(this._findCommand(s)){t.push(s),0<i.length&&n.push.apply(n,_toConsumableArray(i));break}if(s===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(s),0<i.length&&t.push.apply(t,_toConsumableArray(i));break}if(this._defaultCommandName){n.push(s),0<i.length&&n.push.apply(n,_toConsumableArray(i));break}}if(this._passThroughOptions){r.push(s),0<i.length&&r.push.apply(r,_toConsumableArray(i));break}r.push(s)}}return{operands:t,unknown:n}}},{key:"opts",value:function(){if(this._storeOptionsAsProperties){for(var e={},t=this.options.length,n=0;n<t;n++){var r=this.options[n].attributeName();e[r]=r===this._versionOptionName?this._version:this[r]}return e}return this._optionValues}},{key:"optsWithGlobals",value:function(){return v(this).reduce(function(e,t){return Object.assign(e,t.opts())},{})}},{key:"error",value:function(e,t){this._outputConfiguration.outputError("".concat(e,"\n"),this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr("".concat(this._showHelpAfterError,"\n")):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));var t=t||{},n=t.exitCode||1;this._exit(n,t.code||"commander.error",e)}},{key:"_parseOptionsEnv",value:function(){var n=this;this.options.forEach(function(e){var t;e.envVar&&e.envVar in d.env&&(t=e.attributeName(),void 0!==n.getOptionValue(t)&&!["default","config","env"].includes(n.getOptionValueSource(t))||(e.required||e.optional?n.emit("optionEnv:".concat(e.name()),d.env[e.envVar]):n.emit("optionEnv:".concat(e.name()))))})}},{key:"_parseOptionsImplied",value:function(){function n(e){return void 0!==r.getOptionValue(e)&&!["default","implied"].includes(r.getOptionValueSource(e))}var r=this,t=new c(this.options);this.options.filter(function(e){return void 0!==e.implied&&n(e.attributeName())&&t.valueFromOption(r.getOptionValue(e.attributeName()),e)}).forEach(function(t){Object.keys(t.implied).filter(function(e){return!n(e)}).forEach(function(e){r.setOptionValueWithSource(e,t.implied[e],"implied")})})}},{key:"missingArgument",value:function(e){e="error: missing required argument '".concat(e,"'");this.error(e,{code:"commander.missingArgument"})}},{key:"optionMissingArgument",value:function(e){e="error: option '".concat(e.flags,"' argument missing");this.error(e,{code:"commander.optionMissingArgument"})}},{key:"missingMandatoryOptionValue",value:function(e){e="error: required option '".concat(e.flags,"' not specified");this.error(e,{code:"commander.missingMandatoryOptionValue"})}},{key:"_conflictingOption",value:function(e,t){function n(e){t=(e=e).attributeName(),r=a.getOptionValue(t),i=a.options.find(function(e){return e.negate&&t===e.attributeName()}),n=a.options.find(function(e){return!e.negate&&t===e.attributeName()});var t,n,r=i&&(void 0===i.presetArg&&!1===r||void 0!==i.presetArg&&r===i.presetArg)?i:n||e,i=r.attributeName();return"env"===a.getOptionValueSource(i)?"environment variable '".concat(r.envVar,"'"):"option '".concat(r.flags,"'")}var a=this,e="error: ".concat(n(e)," cannot be used with ").concat(n(t));this.error(e,{code:"commander.conflictingOption"})}},{key:"unknownOption",value:function(e){if(!this._allowUnknownOption){var t="";if(e.startsWith("--")&&this._showSuggestionAfterError){var n=[],r=this;do{var i=r.createHelp().visibleOptions(r).filter(function(e){return e.long}).map(function(e){return e.long}),n=n.concat(i),r=r.parent}while(r&&!r._enablePositionalOptions);t=g(e,n)}e="error: unknown option '".concat(e,"'").concat(t);this.error(e,{code:"commander.unknownOption"})}}},{key:"_excessArguments",value:function(e){var t,n;this._allowExcessArguments||(t=1===(n=this._args.length)?"":"s",n="error: too many arguments".concat(this.parent?" for '".concat(this.name(),"'"):"",". Expected ").concat(n," argument").concat(t," but got ").concat(e.length,"."),this.error(n,{code:"commander.excessArguments"}))}},{key:"unknownCommand",value:function(){var t,e=this.args[0],n="",e=(this._showSuggestionAfterError&&(t=[],this.createHelp().visibleCommands(this).forEach(function(e){t.push(e.name()),e.alias()&&t.push(e.alias())}),n=g(e,t)),"error: unknown command '".concat(e,"'").concat(n));this.error(e,{code:"commander.unknownCommand"})}},{key:"version",value:function(e,t,n){var r=this;if(void 0===e)return this._version;this._version=e;t=this.createOption(t=t||"-V, --version",n=n||"output the version number");return this._versionOptionName=t.attributeName(),this.options.push(t),this.on("option:"+t.name(),function(){r._outputConfiguration.writeOut("".concat(e,"\n")),r._exit(0,"commander.version",e)}),this}},{key:"description",value:function(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}},{key:"summary",value:function(e){return void 0===e?this._summary:(this._summary=e,this)}},{key:"alias",value:function(e){if(void 0===e)return this._aliases[0];var t=this;if(e===(t=0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler?this.commands[this.commands.length-1]:t)._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}},{key:"aliases",value:function(e){var t=this;return void 0===e?this._aliases:(e.forEach(function(e){return t.alias(e)}),this)}},{key:"usage",value:function(e){var t;return void 0===e?this._usage||(t=this._args.map(function(e){return a(e)}),[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?t:[]).join(" ")):(this._usage=e,this)}},{key:"name",value:function(e){return void 0===e?this._name:(this._name=e,this)}},{key:"nameFromFilename",value:function(e){return this._name=h.basename(e,h.extname(e)),this}},{key:"executableDir",value:function(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}},{key:"helpInformation",value:function(e){var t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}},{key:"_getHelpContext",value:function(e){var t=this,n={error:!!(e=e||{}).error},r=n.error?function(e){return t._outputConfiguration.writeErr(e)}:function(e){return t._outputConfiguration.writeOut(e)};return n.write=e.write||r,n.command=this,n}},{key:"outputHelp",value:function(e){"function"==typeof e&&(t=e,e=void 0);var t,n=this._getHelpContext(e),e=(v(this).reverse().forEach(function(e){return e.emit("beforeAllHelp",n)}),this.emit("beforeHelp",n),this.helpInformation(n));if(t&&"string"!=typeof(e=t(e))&&!Buffer.isBuffer(e))throw new Error("outputHelp callback must return a string or a Buffer");n.write(e),this.emit(this._helpLongFlag),this.emit("afterHelp",n),v(this).forEach(function(e){return e.emit("afterAllHelp",n)})}},{key:"helpOption",value:function(e,t){return"boolean"==typeof e?this._hasHelpOption=e:(this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription,e=u(this._helpFlags),this._helpShortFlag=e.shortFlag,this._helpLongFlag=e.longFlag),this}},{key:"help",value:function(e){this.outputHelp(e);var t=d.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}},{key:"addHelpText",value:function(e,n){var t=["beforeAll","before","after","afterAll"];if(t.includes(e))return e="".concat(e,"Help"),this.on(e,function(e){var t="function"==typeof n?n({error:e.error,command:e.command}):n;t&&e.write("".concat(t,"\n"))}),this;throw new Error("Unexpected value for position to addHelpText.\nExpecting one of '".concat(t.join("', '"),"'"))}}]));function m(e){var t;return _classCallCheck(this,m),(t=_callSuper(this,m)).commands=[],t.options=[],t.parent=null,t._allowUnknownOption=!1,t._allowExcessArguments=!0,t._args=[],t.args=[],t.rawArgs=[],t.processedArgs=[],t._scriptPath=null,t._name=e||"",t._optionValues={},t._optionValueSources={},t._storeOptionsAsProperties=!1,t._actionHandler=null,t._executableHandler=!1,t._executableFile=null,t._executableDir=null,t._defaultCommandName=null,t._exitCallback=null,t._aliases=[],t._combineFlagAndOptionalValue=!0,t._description="",t._summary="",t._argsDescription=void 0,t._enablePositionalOptions=!1,t._passThroughOptions=!1,t._lifeCycleHooks={},t._showHelpAfterError=!1,t._showSuggestionAfterError=!0,t._outputConfiguration={writeOut:function(e){return d.stdout.write(e)},writeErr:function(e){return d.stderr.write(e)},getOutHelpWidth:function(){return d.stdout.isTTY?d.stdout.columns:void 0},getErrHelpWidth:function(){return d.stderr.isTTY?d.stderr.columns:void 0},outputError:function(e,t){return t(e)}},t._hidden=!1,t._hasHelpOption=!0,t._helpFlags="-h, --help",t._helpDescription="display help for command",t._helpShortFlag="-h",t._helpLongFlag="--help",t._addImplicitHelpCommand=void 0,t._helpCommandName="help",t._helpCommandnameAndArgs="help [command]",t._helpCommandDescription="display help for command",t._helpConfiguration={},t}function _(t,e){t._hasHelpOption&&e.find(function(e){return e===t._helpLongFlag||e===t._helpShortFlag})&&(t.outputHelp(),t._exit(0,"commander.helpDisplayed","(outputHelp)"))}function y(e){return e.map(function(e){var t,n,r,i;return e.startsWith("--inspect")&&(n="127.0.0.1",r="9229",null!==(i=e.match(/^(--inspect(-brk)?)$/))?t=i[1]:null!==(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):null!==(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=i[1],n=i[3],r=i[4]),t)&&"0"!==r?"".concat(t,"=").concat(n,":").concat(parseInt(r)+1):e})}function v(e){for(var t=[],n=e;n;n=n.parent)t.push(n);return t}e.Command=r}),M=t(function(e,t){var n=w().Argument,r=U().Command,i=b(),a=i.CommanderError,i=i.InvalidArgumentError,o=k().Help,s=S().Option;((e=t.exports=new r).program=e).Argument=n,e.Command=r,e.CommanderError=a,e.Help=o,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i,e.Option=s}),I=t(function(e,t){"u"<("undefined"==typeof process?"undefined":_typeof(process))||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?t.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,a,o=arguments.length;switch(o){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,n)});case 4:return process.nextTick(function(){e.call(null,t,n,r)});default:for(i=new Array(o-1),a=0;a<i.length;)i[a++]=arguments[a];return process.nextTick(function(){e.apply(null,i)})}}}:t.exports=process}),W=t(function(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}}),T=t(function(e,t){t.exports=require("stream")}),F=t(function(e,t){var n=require("buffer"),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");e=r(e);return void 0!==t?"string"==typeof n?e.fill(t,n):e.fill(t):e.fill(0),e},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}),P=t(function(e){function t(e){return Object.prototype.toString.call(e)}e.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},e.isBoolean=function(e){return"boolean"==typeof e},e.isNull=function(e){return null===e},e.isNullOrUndefined=function(e){return null==e},e.isNumber=function(e){return"number"==typeof e},e.isString=function(e){return"string"==typeof e},e.isSymbol=function(e){return"symbol"==_typeof(e)},e.isUndefined=function(e){return void 0===e},e.isRegExp=function(e){return"[object RegExp]"===t(e)},e.isObject=function(e){return"object"==_typeof(e)&&null!==e},e.isDate=function(e){return"[object Date]"===t(e)},e.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},e.isFunction=function(e){return"function"==typeof e},e.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==_typeof(e)||"u"<_typeof(e)},e.isBuffer=require("buffer").Buffer.isBuffer}),q=t(function(e,t){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){var n;t&&(e.super_=t,(n=function(){}).prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e)}}),R=t(function(e,t){try{if("function"!=typeof(n=require("util")).inherits)throw"";t.exports=n.inherits}catch(e){t.exports=q()}var n}),G=t(function(e,t){var o=F().Buffer,n=require("util");function r(){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}t.exports=(r.prototype.push=function(e){e={data:e,next:null};0<this.length?this.tail.next=e:this.head=e,this.tail=e,++this.length},r.prototype.unshift=function(e){e={data:e,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},r.prototype.shift=function(){var e;if(0!==this.length)return e=this.head.data,1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},r.prototype.concat=function(e){if(0===this.length)return o.alloc(0);for(var t,n,r=o.allocUnsafe(e>>>0),i=this.head,a=0;i;)t=i.data,n=a,t.copy(r,n),a+=i.data.length,i=i.next;return r},r),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})}),z=t(function(e,t){var a=I();function o(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,a.nextTick(o,this,e)):a.nextTick(o,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,a.nextTick(o,n,e)):a.nextTick(o,n,e):t&&t(e)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}),V=t(function(e,t){t.exports=require("util").deprecate}),f=t(function(e,t){var d=I();function h(a){var o=this;this.next=null,this.entry=null,this.finish=function(){var e=o,t=a,n=void 0,r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}}t.exports=u;var a,f=!process.browser&&-1<["v0.10","v0.9."].indexOf(process.version.slice(0,5))?setImmediate:d.nextTick,t=(u.WritableState=s,Object.create(P())),n=(t.inherits=R(),{deprecate:V()}),r=T(),p=F().Buffer,g=(("undefined"==typeof global?"undefined":_typeof(global))<"u"?global:("undefined"==typeof window?"undefined":_typeof(window))<"u"?window:("undefined"==typeof self?"undefined":_typeof(self))<"u"?self:{}).Uint8Array||function(){};var i,o=z();function m(){}function s(e,l){a=a||N(),e=e||{};var t=l instanceof a,n=(this.objectMode=!!e.objectMode,t&&(this.objectMode=this.objectMode||!!e.writableObjectMode),e.highWaterMark),r=e.writableHighWaterMark,i=this.objectMode?16:16384,n=(this.highWaterMark=n||0===n?n:t&&(r||0===r)?r:i,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,(this.destroyed=!1)===e.decodeStrings);this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){e=e,n=(t=l)._writableState,r=n.sync,i=n.writecb;var t,n,r,i,a=n;{var o,s,u,c;(a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0,e)?(a=t,s=r,u=e,c=i,--(o=n).pendingcb,s?(d.nextTick(c,u),d.nextTick(w,a,o),a._writableState.errorEmitted=!0,a.emit("error",u)):(c(u),a._writableState.errorEmitted=!0,a.emit("error",u),w(a,o))):((e=b(n))||n.corked||n.bufferProcessing||!n.bufferedRequest||v(t,n),r?f(y,t,n,e,i):y(t,n,e,i))}},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new h(this)}t.inherits(u,r),s.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(s.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function u(e){if(a=a||N(),!(i.call(u,this)||this instanceof a))return new u(e);this._writableState=new s(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final)&&(this._final=e.final),r.call(this)}function _(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function y(e,t,n,r){var i;n||(n=e,0===(i=t).length&&i.needDrain&&(i.needDrain=!1,n.emit("drain"))),t.pendingcb--,r(),w(e,t)}function v(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),r=t.corkedRequestsFree;r.entry=n;for(var a=0,o=!0;n;)(i[a]=n).isBuf||(o=!1),n=n.next,a+=1;i.allBuffers=o,_(e,t,!0,t.length,i,"",r.finish),t.pendingcb++,t.lastBufferedRequest=null,r.next?(t.corkedRequestsFree=r.next,r.next=null):t.corkedRequestsFree=new h(t),t.bufferedRequestCount=0}else{for(;n;){var s=n.chunk,u=n.encoding,c=n.callback;if(_(e,t,!1,t.objectMode?1:s.length,s,u,c),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function b(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function c(t,n){t._final(function(e){n.pendingcb--,e&&t.emit("error",e),n.prefinished=!0,t.emit("prefinish"),w(t,n)})}function w(e,t){var n,r,i=b(t);return i&&(n=e,(r=t).prefinished||r.finalCalled||("function"==typeof n._final?(r.pendingcb++,r.finalCalled=!0,d.nextTick(c,n,r)):(r.prefinished=!0,n.emit("prefinish"))),0===t.pendingcb)&&(t.finished=!0,e.emit("finish")),i}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function(e){return!!i.call(this,e)||this===u&&e&&e._writableState instanceof s}})):i=function(e){return e instanceof this},u.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},u.prototype.write=function(e,t,n){var r,i,a,o,s,u,c,l=this._writableState,h=!1,f=!l.objectMode&&(f=e,p.isBuffer(f)||f instanceof g);return f&&!p.isBuffer(e)&&(c=e,e=p.from(c)),"function"==typeof t&&(n=t,t=null),t=f?"buffer":t||l.defaultEncoding,"function"!=typeof n&&(n=m),l.ended?(c=this,s=n,u=new Error("write after end"),c.emit("error",u),d.nextTick(s,u)):(f||(s=this,u=l,i=n,o=!(a=!0),null===(r=e)?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||u.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(s.emit("error",o),d.nextTick(i,o),a=!1),a))&&(l.pendingcb++,h=((e,t,n,r,i,a)=>{n||(s=((e,t,n)=>t=e.objectMode||!1===e.decodeStrings||"string"!=typeof t?t:p.from(t,n))(t,r,i),r!==s&&(n=!0,i="buffer",r=s));var o,s=t.objectMode?1:r.length,u=(t.length+=s,t.length<t.highWaterMark);return u||(t.needDrain=!0),t.writing||t.corked?(o=t.lastBufferedRequest,t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},o?o.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1):_(e,t,!1,s,r,i,a),u})(this,l,f,e,t,n)),h},u.prototype.cork=function(){this._writableState.corked++},u.prototype.uncork=function(){var e=this._writableState;!e.corked||(e.corked--,e.writing)||e.corked||e.bufferProcessing||!e.bufferedRequest||v(this,e)},u.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase()))return this._writableState.defaultEncoding=e,this;throw new TypeError("Unknown encoding: "+e)},Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),u.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},u.prototype._writev=null,u.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,t=e=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||(e=this,t=n,(n=r).ending=!0,w(e,n),t&&(n.finished?d.nextTick(t):e.once("finish",t)),n.ended=!0,e.writable=!1)},Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),u.prototype.destroy=o.destroy,u.prototype._undestroy=o.undestroy,u.prototype._destroy=function(e,t){this.end(),t(e)}}),N=t(function(e,t){var n,r,i,a=I(),o=Object.keys||function(e){var t,n=[];for(t in e)n.push(t);return n},t=(t.exports=c,Object.create(P())),s=(t.inherits=R(),d()),u=f();for(t.inherits(c,s),n=o(u.prototype),i=0;i<n.length;i++)r=n[i],c.prototype[r]||(c.prototype[r]=u.prototype[r]);function c(e){if(!(this instanceof c))return new c(e);s.call(this,e),u.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||a.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),c.prototype._destroy=function(e,t){this.push(null),this.end(),a.nextTick(t,e)}}),L=t(function(e){var n=F().Buffer,r=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t=(e=>{if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}})(e);if("string"==typeof t||n.isEncoding!==r&&r(e))return t||e;throw new Error("Unknown encoding: "+e)}function t(e){var t;switch(this.encoding=i(e),this.encoding){case"utf16le":this.text=s,this.end=u,t=4;break;case"utf8":this.fillLast=o,t=4;break;case"base64":this.text=c,this.end=l,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function o(e){var t,n=this.lastTotal-this.lastNeed,r=(t=this,128!=(192&(r=e)[0])?(t.lastNeed=0,"�"):1<t.lastNeed&&1<r.length?128!=(192&r[1])?(t.lastNeed=1,"�"):2<t.lastNeed&&2<r.length&&128!=(192&r[2])?(t.lastNeed=2,"�"):void 0:void 0);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,n,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,n,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2!=0)return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1);t=e.toString("utf16le",t);if(t){var n=t.charCodeAt(t.length-1);if(55296<=n&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],t.slice(0,-1)}return t}function u(e){var t,e=e&&e.length?this.write(e):"";return this.lastNeed?(t=this.lastTotal-this.lastNeed,e+this.lastChar.toString("utf16le",0,t)):e}function c(e,t){var n=(e.length-t)%3;return 0==n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){e=e&&e.length?this.write(e):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}(e.StringDecoder=t).prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},t.prototype.end=function(e){e=e&&e.length?this.write(e):"";return this.lastNeed?e+"�":e},t.prototype.text=function(e,t){var n=((e,t,n)=>{var r,i=t.length-1;return i<n?0:0<=(r=a(t[i]))?(0<r&&(e.lastNeed=r-1),r):--i<n||-2===r?0:0<=(r=a(t[i]))?(0<r&&(e.lastNeed=r-2),r):!(--i<n||-2===r)&&0<=(r=a(t[i]))?(0<r&&(2===r?r=0:e.lastNeed=r-3),r):0})(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;n=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},t.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}}),d=t(function(e,t){function g(e,t){return e.listeners(t).length}var a,m=I(),_=(t.exports=c,W()),n=(c.ReadableState=i,require("events").EventEmitter,T()),h=F().Buffer,f=(("undefined"==typeof global?"undefined":_typeof(global))<"u"?global:("undefined"==typeof window?"undefined":_typeof(window))<"u"?window:("undefined"==typeof self?"undefined":_typeof(self))<"u"?self:{}).Uint8Array||function(){};var o,t=Object.create(P()),r=(t.inherits=R(),require("util")),y=void 0,y=r&&r.debuglog?r.debuglog("stream"):function(){},s=G(),r=z(),u=(t.inherits(c,n),["error","close","destroy","pause","resume"]);function i(e,t){e=e||{};var t=t instanceof(a=a||N()),n=(this.objectMode=!!e.objectMode,t&&(this.objectMode=this.objectMode||!!e.readableObjectMode),e.highWaterMark),r=e.readableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:t&&(r||0===r)?r:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new s,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o=o||L().StringDecoder,this.decoder=new o(e.encoding),this.encoding=e.encoding)}function c(e){if(a=a||N(),!(this instanceof c))return new c(e);this._readableState=new i(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy)&&(this._destroy=e.destroy),n.call(this)}function l(e,t,n,r,i){var a,o,s,u,c,l=e._readableState;return null===t?(l.reading=!1,o=e,(u=l).ended||(u.decoder&&(s=u.decoder.end())&&s.length&&(u.buffer.push(s),u.length+=u.objectMode?1:s.length),u.ended=!0,b(o))):(i||(s=l,a=c=(e=>h.isBuffer(e)||e instanceof f)(u=t)||"string"==typeof u||void 0===u||s.objectMode?c:new TypeError("Invalid non-string/buffer chunk")),a?e.emit("error",a):l.objectMode||t&&0<t.length?("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===h.prototype||(o=t,t=h.from(o)),r?l.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):d(e,l,t,!0):l.ended?e.emit("error",new Error("stream.push() after EOF")):(l.reading=!1,!l.decoder||n||(t=l.decoder.write(t),l.objectMode)||0!==t.length?d(e,l,t,!1):k(e,l))):r||(l.reading=!1)),!(i=l).ended&&(i.needReadable||i.length<i.highWaterMark||0===i.length)}function d(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&b(e)),k(e,t)}Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),c.prototype.destroy=r.destroy,c.prototype._undestroy=r.undestroy,c.prototype._destroy=function(e,t){this.push(null),t(e)},c.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=h.from(e,t),t=""),n=!0),l(this,e,t,!1,n)},c.prototype.unshift=function(e){return l(this,e,null,!0,!1)},c.prototype.isPaused=function(){return!1===this._readableState.flowing},c.prototype.setEncoding=function(e){return o=o||L().StringDecoder,this._readableState.decoder=new o(e),this._readableState.encoding=e,this};var p=8388608;function v(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?(t.flowing&&t.length?t.buffer.head.data:t).length:(e>t.highWaterMark&&(t.highWaterMark=(p<=(n=e)?n=p:(n--,n=(n=(n=(n=(n|=n>>>1)|n>>>2)|n>>>4)|n>>>8)|n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var n}function b(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(y("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?m.nextTick(w,e):w(e))}function w(e){y("emit readable"),e.emit("readable"),A(e)}function k(e,t){t.readingMore||(t.readingMore=!0,m.nextTick(S,e,t))}function S(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(y("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function E(e){y("readable nexttick read 0"),e.read(0)}function C(e,t){t.reading||(y("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(y("flow",t.flowing);t.flowing&&null!==e.read(););}function x(e,t){var n,r,i;return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):(e=e,r=t.buffer,t=t.decoder,e<r.head.data.length?(i=r.head.data.slice(0,e),r.head.data=r.head.data.slice(e)):i=e===r.head.data.length?r.shift():(t?(e,t)=>{var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(i+=o===a.length?a:a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n).data=a.slice(o);break}++r}return t.length-=r,i}:(e,t)=>{var n=h.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r).data=a.slice(o);break}++i}return t.length-=i,n})(e,r),n=i),n)}function O(e){var t=e._readableState;if(0<t.length)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,m.nextTick(B,t,e))}function B(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}c.prototype.read=function(e){y("read",e),e=parseInt(e,10);var t,n=this._readableState,r=e;return 0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&(n.length>=n.highWaterMark||n.ended)?(y("read: emitReadable",n.length,n.ended),(0===n.length&&n.ended?O:b)(this),null):0===(e=v(e,n))&&n.ended?(0===n.length&&O(this),null):(t=n.needReadable,y("need readable",t),(0===n.length||n.length-e<n.highWaterMark)&&y("length less than watermark",t=!0),n.ended||n.reading?y("reading or ended",t=!1):t&&(y("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=v(r,n))),null===(t=0<e?x(e,n):null)?(n.needReadable=!0,e=0):n.length-=e,0===n.length&&(n.ended||(n.needReadable=!0),r!==e)&&n.ended&&O(this),null!==t&&this.emit("data",t),t)},c.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},c.prototype.pipe=function(n,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=n;break;case 1:i.pipes=[i.pipes,n];break;default:i.pipes.push(n)}i.pipesCount+=1,y("pipe count=%d opts=%j",i.pipesCount,e);e=(!e||!1!==e.end)&&n!==process.stdout&&n!==process.stderr?o:p;function a(e,t){y("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,y("cleanup"),n.removeListener("close",f),n.removeListener("finish",d),n.removeListener("drain",s),n.removeListener("error",h),n.removeListener("unpipe",a),r.removeListener("end",o),r.removeListener("end",p),r.removeListener("data",l),u=!0,!i.awaitDrain||n._writableState&&!n._writableState.needDrain||s())}function o(){y("onend"),n.end()}i.endEmitted?m.nextTick(e):r.once("end",e),n.on("unpipe",a);t=r;var t,s=function(){var e=t._readableState;y("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&g(t,"data")&&(e.flowing=!0,A(t))},u=(n.on("drain",s),!1);var c=!1;function l(e){y("ondata"),(c=!1)!==n.write(e)||c||((1===i.pipesCount&&i.pipes===n||1<i.pipesCount&&-1!==D(i.pipes,n))&&!u&&(y("false write response, pause",i.awaitDrain),i.awaitDrain++,c=!0),r.pause())}function h(e){y("onerror",e),p(),n.removeListener("error",h),0===g(n,"error")&&n.emit("error",e)}function f(){n.removeListener("finish",d),p()}function d(){y("onfinish"),n.removeListener("close",f),p()}function p(){y("unpipe"),r.unpipe(n)}return r.on("data",l),((e,t,n)=>{if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?_(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)})(n,"error",h),n.once("close",f),n.once("finish",d),n.emit("pipe",r),i.flowing||(y("pipe resume"),r.resume()),n},c.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0!==t.pipesCount)if(1===t.pipesCount)e&&e!==t.pipes||(e=e||t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n));else if(e){var r=D(t.pipes,e);-1!==r&&(t.pipes.splice(r,1),--t.pipesCount,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n))}else{var i=t.pipes,a=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<a;o++)i[o].emit("unpipe",this,{hasUnpiped:!1})}return this},c.prototype.addListener=c.prototype.on=function(e,t){t=n.prototype.on.call(this,e,t);return"data"===e?!1!==this._readableState.flowing&&this.resume():"readable"!==e||(e=this._readableState).endEmitted||e.readableListening||(e.readableListening=e.needReadable=!0,e.emittedReadable=!1,e.reading?e.length&&b(this):m.nextTick(E,this)),t},c.prototype.resume=function(){var e,t=this._readableState;return t.flowing||(y("resume"),t.flowing=!0,e=this,(t=t).resumeScheduled||(t.resumeScheduled=!0,m.nextTick(C,e,t))),this},c.prototype.pause=function(){return y("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(y("pause"),this._readableState.flowing=!1,this.emit("pause")),this},c.prototype.wrap=function(t){var e,n=this,r=this._readableState,i=!1;for(e in t.on("end",function(){var e;y("wrapped end"),r.decoder&&!r.ended&&(e=r.decoder.end())&&e.length&&n.push(e),n.push(null)}),t.on("data",function(e){y("wrapped data"),r.decoder&&(e=r.decoder.write(e)),r.objectMode&&null==e||!(r.objectMode||e&&e.length)||n.push(e)||(i=!0,t.pause())}),t)void 0===this[e]&&"function"==typeof t[e]&&(this[e]=(e=>function(){return t[e].apply(t,arguments)})(e));for(var a=0;a<u.length;a++)t.on(u[a],this.emit.bind(this,u[a]));return this._read=function(e){y("wrapped _read",e),i&&(i=!1,t.resume())},this},Object.defineProperty(c.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),c._fromList=x}),a=t(function(e,t){t.exports=n;var r=N(),t=Object.create(P());function n(e){if(!(this instanceof n))return new n(e);r.call(this,e),this._transformState={afterTransform:function(e,t){var n=this._transformState,r=(n.transforming=!1,n.writecb);if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,(n.writecb=null)!=t&&this.push(t),r(e),(n=this._readableState).reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush)&&(this._flush=e.flush),this.on("prefinish",i)}function i(){var n=this;"function"==typeof this._flush?this._flush(function(e,t){a(n,e,t)}):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");e.push(null)}t.inherits=R(),t.inherits(n,r),n.prototype.push=function(e,t){return this._transformState.needTransform=!1,r.prototype.push.call(this,e,t)},n.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},n.prototype._write=function(e,t,n){var r=this._transformState;r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming&&(n=this._readableState,r.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)},n.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},n.prototype._destroy=function(e,t){var n=this;r.prototype._destroy.call(this,e,function(e){t(e),n.emit("close")})}}),K=t(function(e,t){t.exports=r;var n=a(),t=Object.create(P());function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}t.inherits=R(),t.inherits(r,n),r.prototype._transform=function(e,t,n){n(null,e)}}),o=t(function(e,t){var n=require("stream");"disable"===process.env.READABLE_STREAM&&n?(t.exports=n,(e=t.exports=n.Readable).Readable=n.Readable,e.Writable=n.Writable,e.Duplex=n.Duplex,e.Transform=n.Transform,e.PassThrough=n.PassThrough,e.Stream=n):((e=t.exports=d()).Stream=n||e,(e.Readable=e).Writable=f(),e.Duplex=N(),e.Transform=a(),e.PassThrough=K())}),p=t(function(t){if(t.base64=!0,t.array=!0,t.string=!0,t.arraybuffer=("undefined"==typeof ArrayBuffer?"undefined":_typeof(ArrayBuffer))<"u"&&("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u",t.nodebuffer=("undefined"==typeof Buffer?"undefined":_typeof(Buffer))<"u",t.uint8array=("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u","u"<("undefined"==typeof ArrayBuffer?"undefined":_typeof(ArrayBuffer)))t.blob=!1;else{n=new ArrayBuffer(0);try{t.blob=0===new Blob([n],{type:"application/zip"}).size}catch(e){try{(r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder)).append(n),t.blob=0===r.getBlob("application/zip").size}catch(e){t.blob=!1}}}var n,r;try{t.nodestream=!!o().Readable}catch(e){t.nodestream=!1}}),g=t(function(e){var h=E(),f=p(),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.encode=function(e){for(var t,n,r,i,a,o,s=[],u=0,c=e.length,l="string"!==h.getTypeOf(e);u<e.length;)o=c-u,r=l?(t=e[u++],n=u<c?e[u++]:0,u<c?e[u++]:0):(t=e.charCodeAt(u++),n=u<c?e.charCodeAt(u++):0,u<c?e.charCodeAt(u++):0),i=(3&t)<<4|n>>4,a=1<o?(15&n)<<2|r>>6:64,o=2<o?63&r:64,s.push(d.charAt(t>>2)+d.charAt(i)+d.charAt(a)+d.charAt(o));return s.join("")},e.decode=function(e){var t,n,r,i,a,o,s=0,u=0;if("data:"===e.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var c,l=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===d.charAt(64)&&l--,e.charAt(e.length-2)===d.charAt(64)&&l--,l%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=new(f.uint8array?Uint8Array:Array)(0|l);s<e.length;)r=d.indexOf(e.charAt(s++)),t=(15&(i=d.indexOf(e.charAt(s++))))<<4|(a=d.indexOf(e.charAt(s++)))>>2,n=(3&a)<<6|(o=d.indexOf(e.charAt(s++))),c[u++]=r<<2|i>>4,64!==a&&(c[u++]=t),64!==o&&(c[u++]=n);return c}}),v=t(function(e,t){t.exports={isNode:("undefined"==typeof Buffer?"undefined":_typeof(Buffer))<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){return Buffer.alloc?Buffer.alloc(e):((e=new Buffer(e)).fill(0),e)},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}}),Y=t(function(e,t){t.exports="function"==typeof setImmediate?setImmediate:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}}),X=t(function(e,t){var n,r,i,a,o=global.MutationObserver||global.WebKitMutationObserver,s=process.browser?o?(n=0,o=new o(c),r=global.document.createTextNode(""),o.observe(r,{characterData:!0}),function(){r.data=n=++n%2}):!global.setImmediate&&_typeof(global.MessageChannel)<"u"?((i=new global.MessageChannel).port1.onmessage=c,function(){i.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?function(){var e=global.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)}:function(){process.nextTick(c)},u=[];function c(){a=!0;for(var e,t,n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}a=!1}t.exports=function(e){1!==u.push(e)||a||s()}}),Q=t(function(e,t){var i=X();function u(){}var a,c={},o=["REJECTED"],s=["FULFILLED"],r=["PENDING"];function n(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=r,this.queue=[],this.outcome=void 0,process.browser||(this.handled=a),e!==u&&d(this,e)}function l(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(t,n,r){i(function(){var e;try{e=n(r)}catch(e){return c.reject(t,e)}e===t?c.reject(t,new TypeError("Cannot resolve promise with itself")):c.resolve(t,e)})}function f(e){var t=e&&e.then;if(e&&("object"==_typeof(e)||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(t,e){var n=!1;function r(e){n||(n=!0,c.reject(t,e))}function i(e){n||(n=!0,c.resolve(t,e))}var a=p(function(){e(i,r)});"error"===a.status&&r(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}process.browser||(a=["UNHANDLED"]),(t.exports=n).prototype.finally=function(t){var n;return"function"!=typeof t?this:(n=this.constructor,this.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})}))},n.prototype.catch=function(e){return this.then(null,e)},n.prototype.then=function(e,t){var n;return"function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o?this:(n=new this.constructor(u),process.browser||this.handled===a&&(this.handled=null),this.state!==r?h(n,this.state===s?e:t,this.outcome):this.queue.push(new l(n,e,t)),n)},l.prototype.callFulfilled=function(e){c.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){c.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},c.resolve=function(e,t){var n=p(f,t);if("error"===n.status)return c.reject(e,n.value);n=n.value;if(n)d(e,n);else{e.state=s,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callFulfilled(t)}return e},c.reject=function(e,t){e.state=o,e.outcome=t,process.browser||e.handled===a&&i(function(){e.handled===a&&process.emit("unhandledRejection",t,e)});for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},n.resolve=function(e){return e instanceof this?e:c.resolve(new this(u),e)},n.reject=function(e){var t=new this(u);return c.reject(t,e)},n.all=function(e){var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var a=new Array(r),o=0,t=-1,s=new this(u);++t<r;)((e,t)=>{n.resolve(e).then(function(e){a[t]=e,++o!==r||i||(i=!0,c.resolve(s,a))},function(e){i||(i=!0,c.reject(s,e))})})(e[t],t);return s},n.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var i=-1,a=new this(u);++i<n;)(e=>{t.resolve(e).then(function(e){r||(r=!0,c.resolve(a,e))},function(e){r||(r=!0,c.reject(a,e))})})(e[i]);return a}}),m=t(function(e,t){var n=null,n=("undefined"==typeof Promise?"undefined":_typeof(Promise))<"u"?Promise:Q();t.exports={Promise:n}}),E=t(function(o){var s=p(),u=g(),t=v(),r=Y(),c=m();function e(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}o.newBlob=function(t,n){o.checkSupport("blob");try{return new Blob([t],{type:n})}catch(e){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(t),r.getBlob(n)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var i={stringifyByChunk:function(e,t,n){var r=[],i=0,a=e.length;if(a<=n)return String.fromCharCode.apply(null,e);for(;i<a;)r.push("array"===t||"nodebuffer"===t?String.fromCharCode.apply(null,e.slice(i,Math.min(i+n,a))):String.fromCharCode.apply(null,e.subarray(i,Math.min(i+n,a)))),i+=n;return r.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:(()=>{try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}})(),nodebuffer:(()=>{try{return s.nodebuffer&&1===String.fromCharCode.apply(null,t.allocBuffer(1)).length}catch(e){return!1}})()}};function n(e){var t=65536,n=o.getTypeOf(e),r=!0;if("uint8array"===n?r=i.applyCanBeUsed.uint8array:"nodebuffer"===n&&(r=i.applyCanBeUsed.nodebuffer),r)for(;1<t;)try{return i.stringifyByChunk(e,n,t)}catch(e){t=Math.floor(t/2)}return i.stringifyByChar(e)}function a(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}o.applyFromCharCode=n;var h={};h.string={string:e,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,t.allocBuffer(e.length))}},h.array={string:n,array:e,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return t.newBufferFrom(e)}},h.arraybuffer={string:function(e){return n(new Uint8Array(e))},array:function(e){return a(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:e,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return t.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:n,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:e,nodebuffer:function(e){return t.newBufferFrom(e)}},h.nodebuffer={string:n,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return a(e,new Uint8Array(e.length))},nodebuffer:e},o.transformTo=function(e,t){if(t=t||"",!e)return t;o.checkSupport(e);var n=o.getTypeOf(t);return h[n][e](t)},o.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&t.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(e){for(var t,n="",r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},o.delay=function(e,t,n){r(function(){e.apply(n||null,t||[])})},o.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},o.extend=function(){for(var e,t={},n=0;n<arguments.length;n++)for(e in arguments[n])arguments[n].hasOwnProperty(e)&&"u"<_typeof(t[e])&&(t[e]=arguments[n][e]);return t},o.prepareContent=function(n,e,r,i,a){return c.Promise.resolve(e).then(function(r){return s.blob&&(r instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(r)))&&("undefined"==typeof FileReader?"undefined":_typeof(FileReader))<"u"?new c.Promise(function(t,n){var e=new FileReader;e.onload=function(e){t(e.target.result)},e.onerror=function(e){n(e.target.error)},e.readAsArrayBuffer(r)}):r}).then(function(e){var t=o.getTypeOf(e);return t?("arraybuffer"===t?e=o.transformTo("uint8array",e):"string"===t&&(a?e=u.decode(e):r&&!0!==i&&(e=l(t=e,new(s.uint8array?Uint8Array:Array)(t.length)))),e):c.Promise.reject(new Error("Can't read the data of '"+n+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}}),C=t(function(e,t){function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){var e;return!(!this.isPaused||this.isFinished||(e=this.isPaused=!1,this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),e))},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n}),A=t(function(i){for(var e,u=E(),c=p(),l=v(),t=C(),h=new Array(256),e=0;e<256;e++)h[e]=252<=e?6:248<=e?5:240<=e?4:224<=e?3:192<=e?2:1;h[254]=h[254]=1;function n(){t.call(this,"utf-8 decode"),this.leftOver=null}function r(){t.call(this,"utf-8 encode")}i.utf8encode=function(e){if(c.nodebuffer)return l.newBufferFrom(e,"utf-8");for(var t,n,r,i,a=e,o=a.length,s=0,u=0;u<o;u++)55296==(64512&(n=a.charCodeAt(u)))&&u+1<o&&56320==(64512&(r=a.charCodeAt(u+1)))&&(n=65536+(n-55296<<10)+(r-56320),u++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new(c.uint8array?Uint8Array:Array)(s),u=i=0;i<s;u++)55296==(64512&(n=a.charCodeAt(u)))&&u+1<o&&56320==(64512&(r=a.charCodeAt(u+1)))&&(n=65536+(n-55296<<10)+(r-56320),u++),n<128?t[i++]=n:(n<2048?t[i++]=192|n>>>6:(n<65536?t[i++]=224|n>>>12:(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63),t[i++]=128|n>>>6&63),t[i++]=128|63&n);return t},i.utf8decode=function(e){if(c.nodebuffer)return u.transformTo("nodebuffer",e).toString("utf-8");for(var t,n,r=e=u.transformTo(c.uint8array?"uint8array":"array",e),i=r.length,a=new Array(2*i),o=0,s=0;s<i;)if((t=r[s++])<128)a[o++]=t;else if(4<(n=h[t]))a[o++]=65533,s+=n-1;else{for(t&=2===n?31:3===n?15:7;1<n&&s<i;)t=t<<6|63&r[s++],n--;1<n?a[o++]=65533:t<65536?a[o++]=t:(t-=65536,a[o++]=55296|t>>10&1023,a[o++]=56320|1023&t)}return a.length!==o&&(a.subarray?a=a.subarray(0,o):a.length=o),u.applyFromCharCode(a)},u.inherits(n,t),n.prototype.processChunk=function(e){var t=u.transformTo(c.uint8array?"uint8array":"array",e.data),n=(this.leftOver&&this.leftOver.length&&(c.uint8array?(n=t,(t=new Uint8Array(n.length+this.leftOver.length)).set(this.leftOver,0),t.set(n,this.leftOver.length)):t=this.leftOver.concat(t),this.leftOver=null),((e,t)=>{for(var n=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+h[e[n]]>t?n:t})(t)),r=t;n!==t.length&&(c.uint8array?(r=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(r=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:i.utf8decode(r),meta:e.meta})},n.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=n,u.inherits(r,t),r.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=r}),$=t(function(e,t){var n=C(),r=E();function i(e){n.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(i,n),i.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=i}),ee=t(function(e,t){var i=o().Readable;function n(e,t,n){i.call(this,t),this._helper=e;var r=this;e.on("data",function(e,t){r.push(e)||r._helper.pause(),n&&n(t)}).on("error",function(e){r.emit("error",e)}).on("end",function(){r.push(null)})}E().inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n}),x=t(function(e,t){var u=E(),i=$(),a=C(),c=g(),n=p(),r=m(),o=null;if(n.nodestream)try{o=ee()}catch(e){}function s(e,s){return new r.Promise(function(t,n){var r=[],i=e._internalType,a=e._outputType,o=e._mimeType;e.on("data",function(e,t){r.push(e),s&&s(t)}).on("error",function(e){r=[],n(e)}).on("end",function(){try{var e=((e,t,n)=>{switch(e){case"blob":return u.newBlob(u.transformTo("arraybuffer",t),n);case"base64":return c.encode(t);default:return u.transformTo(e,t)}})(a,((e,t)=>{for(var n=0,r=null,i=0,a=0;a<t.length;a++)i+=t[a].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(r=new Uint8Array(i),a=0;a<t.length;a++)r.set(t[a],n),n+=t[a].length;return r;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}})(i,r),o);t(e)}catch(e){n(e)}r=[]}).resume()})}function l(e,t,n){var r=t;switch(t){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=t,this._mimeType=n,u.checkSupport(r),this._worker=e.pipe(new i(r)),e.lock()}catch(e){this._worker=new a("error"),this._worker.error(e)}}l.prototype={accumulate:function(e){return s(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){u.delay(t,arguments,n)}),this},resume:function(){return u.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(u.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new o(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=l}),O=t(function(e){e.base64=!1,e.binary=!1,e.dir=!1,e.createFolders=!0,e.date=null,e.compression=null,e.compressionOptions=null,e.comment=null,e.unixPermissions=null,e.dosPermissions=null}),te=t(function(e,t){var n=E(),r=C();function i(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(i,r),i.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished)||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0)},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=i}),l=t(function(e,t){var n=E();var s=(()=>{for(var e=[],t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})();t.exports=function(e,t){return"u"<_typeof(e)||!e.length?0:("string"!==n.getTypeOf(e)?(e,t,n,r)=>{var i=s,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e}:(e,t,n,r)=>{var i=s,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t.charCodeAt(o))];return-1^e})(0|t,e,e.length,0)}}),ne=t(function(e,t){var n=C(),r=l();function i(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}E().inherits(i,n),i.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=i}),re=t(function(e,t){var n=E(),r=C();function i(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(i,r),i.prototype.processChunk=function(e){var t;e&&(t=this.streamInfo[this.propName]||0,this.streamInfo[this.propName]=t+e.data.length),r.prototype.processChunk.call(this,e)},t.exports=i}),B=t(function(e,t){var n=m(),r=te(),i=ne(),a=re();function o(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,n){return e.pipe(new i).pipe(new a("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o}),ie=t(function(e,t){for(var n,a=x(),r=te(),o=A(),i=B(),s=C(),u=function(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}},c=(u.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(n=e.toLowerCase())||"text"===n,i=("binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker(),!this._dataBinary);i&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!i&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new s("error")).error(e)}return new a(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){var n;return this._data instanceof i&&this._data.compression.magic===e.magic?this._data.getCompressedWorker():(n=this._decompressWorker(),this._dataBinary||(n=n.pipe(new o.Utf8EncodeWorker)),i.createWorkerFrom(n,e,t))},_decompressWorker:function(){return this._data instanceof i?this._data.getContentWorker():this._data instanceof s?this._data:new r(this._data)}},["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"]),l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},n=0;n<c.length;n++)u.prototype[c[n]]=l;t.exports=u}),J=t(function(t){var e=("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u"&&("undefined"==typeof Uint16Array?"undefined":_typeof(Uint16Array))<"u"&&("undefined"==typeof Int32Array?"undefined":_typeof(Int32Array))<"u";t.assign=function(e){for(var t,n,r=Array.prototype.slice.call(arguments,1);r.length;){var i=r.shift();if(i){if("object"!=_typeof(i))throw new TypeError(i+"must be non-object");for(var a in i)t=i,n=a,Object.prototype.hasOwnProperty.call(t,n)&&(e[a]=i[a])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){for(var t,n,r,i=0,a=0,o=e.length;a<o;a++)i+=e[a].length;for(r=new Uint8Array(i),a=t=0,o=e.length;a<o;a++)n=e[a],r.set(n,t),t+=n.length;return r}},r={arraySet:function(e,t,n,r,i){for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,n)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,r))},t.setTyped(e)}),ae=t(function(e){var a=J(),l=0,h=1;function t(e){for(var t=e.length;0<=--t;)e[t]=0}var s,u,c,f=29,d=256,p=d+1+f,g=30,m=19,C=2*p+1,A=15,r=16,j=7,_=256,y=16,v=17,b=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],H=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],E=new Array(2*(p+2)),x=(t(E),new Array(2*g)),O=(t(x),new Array(512)),B=(t(O),new Array(256)),D=(t(B),new Array(f)),I=(t(D),new Array(g));function T(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function F(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function P(e){return e<256?O[e]:O[256+(e>>>7)]}function i(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function R(e,t,n){e.bi_valid>r-n?(e.bi_buf|=t<<e.bi_valid&65535,i(e,e.bi_buf),e.bi_buf=t>>r-e.bi_valid,e.bi_valid+=n-r):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function z(e,t,n){R(e,n[2*t],n[2*t+1])}function U(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function M(e,t,n){for(var r,i=new Array(A+1),a=0,o=1;o<=A;o++)i[o]=a=a+n[o-1]<<1;for(r=0;r<=t;r++){var s=e[2*r+1];0!==s&&(e[2*r]=U(i[s]++,s))}}function W(e){for(var t=0;t<p;t++)e.dyn_ltree[2*t]=0;for(t=0;t<g;t++)e.dyn_dtree[2*t]=0;for(t=0;t<m;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*_]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function q(e){8<e.bi_valid?i(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function o(e,t,n,r){var i=2*t,a=2*n;return e[i]<e[a]||e[i]===e[a]&&r[t]<=r[n]}function N(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&o(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!o(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function G(e,t,n){var r,i,a,o,s=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0==r?z(e,i,t):(z(e,(a=B[i])+d+1,t),0!==(o=w[a])&&R(e,i-=D[a],o),z(e,a=P(--r),n),0!==(o=k[a])&&R(e,r-=I[a],o)),s<e.last_lit;);z(e,_,t)}function L(e,t){var n,r,i,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=C,n=0;n<u;n++)0!==a[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):a[2*n+1]=0;for(;e.heap_len<2;)a[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=c,n=e.heap_len>>1;1<=n;n--)N(e,a,n);for(i=u;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,N(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1];for(var l,h,f,d,p,g=e,m=t.dyn_tree,_=t.max_code,y=t.stat_desc.static_tree,v=t.stat_desc.has_stree,b=t.stat_desc.extra_bits,w=t.stat_desc.extra_base,k=t.stat_desc.max_length,S=0,E=0;E<=A;E++)g.bl_count[E]=0;for(m[2*g.heap[g.heap_max]+1]=0,l=g.heap_max+1;l<C;l++)k<(E=m[2*m[2*(h=g.heap[l])+1]+1]+1)&&(E=k,S++),m[2*h+1]=E,_<h||(g.bl_count[E]++,d=0,w<=h&&(d=b[h-w]),p=m[2*h],g.opt_len+=p*(E+d),!v)||(g.static_len+=p*(y[2*h+1]+d));if(0!==S){do{for(E=k-1;0===g.bl_count[E];)E--}while(g.bl_count[E]--,g.bl_count[E+1]+=2,g.bl_count[k]--,0<(S-=2));for(E=k;0!==E;E--)for(h=g.bl_count[E];0!==h;)_<(f=g.heap[--l])||(m[2*f+1]!==E&&(g.opt_len+=(E-m[2*f+1])*m[2*f],m[2*f+1]=E),h--)}M(a,c,e.bl_count)}function Z(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++s<u&&i===o||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[2*y]++):s<=10?e.bl_tree[2*v]++:e.bl_tree[2*b]++,a=i,c=(s=0)===o?(u=138,3):i===o?(u=6,3):(u=7,4))}function V(e,t,n){var r,i,a=-1,o=t[1],s=0,u=7,c=4;for(0===o&&(u=138,c=3),r=0;r<=n;r++)if(i=o,o=t[2*(r+1)+1],!(++s<u&&i===o)){if(s<c)for(;z(e,i,e.bl_tree),0!=--s;);else 0!==i?(i!==a&&(z(e,i,e.bl_tree),s--),z(e,y,e.bl_tree),R(e,s-3,2)):s<=10?(z(e,v,e.bl_tree),R(e,s-3,3)):(z(e,b,e.bl_tree),R(e,s-11,7));a=i,c=(s=0)===o?(u=138,3):i===o?(u=6,3):(u=7,4)}}t(I);var K=!1;function Y(e,t,n,r){R(e,0+(r?1:0),3),r=t,t=n,n=!0,q(e=e),n&&(i(e,t),i(e,~t)),a.arraySet(e.pending_buf,e.window,r,t,e.pending),e.pending+=t}e._tr_init=function(e){if(!K){for(var t,n,r,i=new Array(A+1),a=0,o=0;o<f-1;o++)for(D[o]=a,t=0;t<1<<w[o];t++)B[a++]=o;for(B[a-1]=o,o=r=0;o<16;o++)for(I[o]=r,t=0;t<1<<k[o];t++)O[r++]=o;for(r>>=7;o<g;o++)for(I[o]=r<<7,t=0;t<1<<k[o]-7;t++)O[256+r++]=o;for(n=0;n<=A;n++)i[n]=0;for(t=0;t<=143;)E[2*t+1]=8,t++,i[8]++;for(;t<=255;)E[2*t+1]=9,t++,i[9]++;for(;t<=279;)E[2*t+1]=7,t++,i[7]++;for(;t<=287;)E[2*t+1]=8,t++,i[8]++;for(M(E,p+1,i),t=0;t<g;t++)x[2*t+1]=5,x[2*t]=U(t,5);s=new T(E,w,d+1,p,A),u=new T(x,k,0,g,A),c=new T(new Array(0),H,0,m,j),K=!0}e.l_desc=new F(e.dyn_ltree,s),e.d_desc=new F(e.dyn_dtree,u),e.bl_desc=new F(e.bl_tree,c),e.bi_buf=0,e.bi_valid=0,W(e)},e._tr_stored_block=Y,e._tr_flush_block=function(e,t,n,r){var i,a,o,s=0;if(0<e.level?(2===e.strm.data_type&&(e.strm.data_type=(e=>{for(var t=4093624447,n=0;n<=31;n++,t>>>=1)if(1&t&&0!==e.dyn_ltree[2*n])return l;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(n=32;n<d;n++)if(0!==e.dyn_ltree[2*n])return h;return l})(e)),L(e,e.l_desc),L(e,e.d_desc),s=(e=>{var t;for(Z(e,e.dyn_ltree,e.l_desc.max_code),Z(e,e.dyn_dtree,e.d_desc.max_code),L(e,e.bl_desc),t=m-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),(a=e.static_len+3+7>>>3)<=(i=e.opt_len+3+7>>>3)&&(i=a)):i=a=n+5,n+4<=i&&-1!==t)Y(e,t,n,r);else if(4===e.strategy||a===i)R(e,2+(r?1:0),3),G(e,E,x);else{R(e,4+(r?1:0),3);var u=e,c=(t=e.l_desc.max_code+1,n=e.d_desc.max_code+1,s+1);for(R(u,t-257,5),R(u,n-1,5),R(u,c-4,4),o=0;o<c;o++)R(u,u.bl_tree[2*S[o]+1],3);V(u,u.dyn_ltree,t-1),V(u,u.dyn_dtree,n-1),G(e,e.dyn_ltree,e.dyn_dtree)}W(e),r&&q(e)},e._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(B[n]+d+1)]++,e.dyn_dtree[2*P(t)]++),e.last_lit===e.lit_bufsize-1},e._tr_align=function(e){R(e,2,3),z(e,_,E),16===(e=e).bi_valid?(i(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}}),oe=t(function(e,t){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==n;){for(n-=o=2e3<n?2e3:n;a=a+(i=i+t[r++]|0)|0,--o;);i%=65521,a%=65521}return i|a<<16|0}}),se=t(function(e,t){var s=(()=>{for(var e=[],t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})();t.exports=function(e,t,n,r){var i=s,a=r+n;e^=-1;for(var o=r;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e}}),Z=t(function(e,t){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}}),ue=t(function(e){var s,h=J(),u=ae(),f=oe(),d=se(),z=Z(),c=0,l=4,p=0,g=-2,N=-1,L=4,j=2,m=8,H=9,t=286,U=30,M=19,W=2*t+1,q=15,_=3,y=258,v=y+_+1,b=42,w=113,k=1,S=2,E=3,C=4;function A(e,t){return e.msg=z[t],t}function x(e){return(e<<1)-(4<e?9:0)}function O(e){for(var t=e.length;0<=--t;)e[t]=0}function B(e){var t=e.state,n=t.pending;0!==(n=e.avail_out<n?e.avail_out:n)&&(h.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending)&&(t.pending_out=0)}function D(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,B(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function T(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function a(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.w_size-v<e.strstart?e.strstart-(e.w_size-v):0,c=e.window,l=e.w_mask,h=e.prev,f=e.strstart+y,d=c[a+o-1],p=c[a+o];e.good_match<=e.prev_length&&(i>>=2),e.lookahead<s&&(s=e.lookahead);do{if(c[(n=t)+o]===p&&c[n+o-1]===d&&c[n]===c[a]&&c[++n]===c[a+1]){for(a+=2,n++;c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&c[++a]===c[++n]&&a<f;);if(r=y-(f-a),a=f-y,o<r){if(e.match_start=t,s<=(o=r))break;d=c[a+o-1],p=c[a+o]}}}while((t=h[t&l])>u&&0!=--i);return o<=e.lookahead?o:e.lookahead}function F(e){var t,n,r,i,a,o,s,u,c,l=e.w_size;do{if(u=e.window_size-e.lookahead-e.strstart,l+(l-v)<=e.strstart){for(h.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=n=e.hash_size;r=e.head[--t],e.head[t]=l<=r?r-l:0,--n;);for(t=n=l;r=e.prev[--t],e.prev[t]=l<=r?r-l:0,--n;);u+=l}if(0===e.strm.avail_in)break;if(o=e.window,s=e.strstart+e.lookahead,u=u,c=void 0,c=(a=e.strm).avail_in,n=0===(c=u<c?u:c)?0:(a.avail_in-=c,h.arraySet(o,a.input,a.next_in,c,s),1===a.state.wrap?a.adler=f(a.adler,o,c,s):2===a.state.wrap&&(a.adler=d(a.adler,o,c,s)),a.next_in+=c,a.total_in+=c,c),e.lookahead+=n,_<=e.lookahead+e.insert)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<<e.hash_shift^e.window[i+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[i+_-1])&e.hash_mask,e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<_)););}while(e.lookahead<v&&0!==e.strm.avail_in)}function n(e,t){for(var n,r;;){if(e.lookahead<v){if(F(e),e.lookahead<v&&t===c)return k;if(0===e.lookahead)break}if(n=0,_<=e.lookahead&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-v&&(e.match_length=a(e,n)),_<=e.match_length)if(r=u._tr_tally(e,e.strstart-e.match_start,e.match_length-_),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=_){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(D(e,!1),0===e.strm.avail_out))return k}return e.insert=e.strstart<_-1?e.strstart:_-1,t===l?(D(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?k:S}function r(e,t){for(var n,r,i;;){if(e.lookahead<v){if(F(e),e.lookahead<v&&t===c)return k;if(0===e.lookahead)break}if(n=0,_<=e.lookahead&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=_-1,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-v&&(e.match_length=a(e,n),e.match_length<=5)&&(1===e.strategy||e.match_length===_&&4096<e.strstart-e.match_start)&&(e.match_length=_-1),_<=e.prev_length&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-_,r=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-_),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+_-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=_-1,e.strstart++,r&&(D(e,!1),0===e.strm.avail_out))return k}else if(e.match_available){if((r=u._tr_tally(e,0,e.window[e.strstart-1]))&&D(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return k}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=u._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<_-1?e.strstart:_-1,t===l?(D(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?k:S}function i(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function G(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=m,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new h.Buf16(2*W),this.dyn_dtree=new h.Buf16(2*(2*U+1)),this.bl_tree=new h.Buf16(2*(2*M+1)),O(this.dyn_ltree),O(this.dyn_dtree),O(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new h.Buf16(q+1),this.heap=new h.Buf16(2*t+1),O(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new h.Buf16(2*t+1),O(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function o(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=j,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?b:w,e.adler=2===t.wrap?0:1,t.last_flush=c,u._tr_init(t),p):A(e,g)}function P(e){var t=o(e);return t===p&&((e=e.state).window_size=2*e.w_size,O(e.head),e.max_lazy_match=s[e.level].max_lazy,e.good_match=s[e.level].good_length,e.nice_match=s[e.level].nice_length,e.max_chain_length=s[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=_-1,e.match_available=0,e.ins_h=0),t}function R(e,t,n,r,i,a){if(!e)return g;var o=1;if(t===N&&(t=6),r<0?(o=0,r=-r):15<r&&(o=2,r-=16),i<1||H<i||n!==m||r<8||15<r||t<0||9<t||a<0||L<a)return A(e,g);8===r&&(r=9);var s=new G;return(e.state=s).strm=e,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+_-1)/_),s.window=new h.Buf8(2*s.w_size),s.head=new h.Buf16(s.hash_size),s.prev=new h.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new h.Buf8(s.pending_buf_size),s.d_buf=+s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=n,P(e)}s=[new i(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(F(e),0===e.lookahead&&t===c)return k;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,D(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-v&&(D(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===l?(D(e,!0),0===e.strm.avail_out?E:C):(e.strstart>e.block_start&&(D(e,!1),e.strm.avail_out),k)}),new i(4,4,8,4,n),new i(4,5,16,8,n),new i(4,6,32,32,n),new i(4,4,16,16,r),new i(8,16,32,32,r),new i(8,16,128,128,r),new i(8,32,128,256,r),new i(32,128,258,1024,r),new i(32,258,258,4096,r)],e.deflateInit=function(e,t){return R(e,t,m,15,8,0)},e.deflateInit2=R,e.deflateReset=P,e.deflateResetKeep=o,e.deflateSetHeader=function(e,t){return e&&e.state&&2===e.state.wrap?(e.state.gzhead=t,p):g},e.deflate=function(e,t){var n,r,i,a;if(!e||!e.state||5<t||t<0)return e?A(e,g):g;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&t!==l)return A(e,0===e.avail_out?-5:g);if(r.strm=e,n=r.last_flush,r.last_flush=t,r.status===b&&(2===r.wrap?(e.adler=0,I(r,31),I(r,139),I(r,8),r.gzhead?(I(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),I(r,255&r.gzhead.time),I(r,r.gzhead.time>>8&255),I(r,r.gzhead.time>>16&255),I(r,r.gzhead.time>>24&255),I(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),I(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(I(r,255&r.gzhead.extra.length),I(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=d(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(I(r,0),I(r,0),I(r,0),I(r,0),I(r,0),I(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),I(r,3),r.status=w)):(o=m+(r.w_bits-8<<4)<<8,o|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(o|=32),o+=31-o%31,r.status=w,T(r,o),0!==r.strstart&&(T(r,e.adler>>>16),T(r,65535&e.adler)),e.adler=1)),69===r.status)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),B(e),i=r.pending,r.pending!==r.pending_buf_size));)I(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),B(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}}while(a=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,I(r,a),0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),B(e),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}}while(a=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,I(r,a),0!==a);r.gzhead.hcrc&&r.pending>i&&(e.adler=d(e.adler,r.pending_buf,r.pending-i,i)),0===a&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&B(e),r.pending+2<=r.pending_buf_size&&(I(r,255&e.adler),I(r,e.adler>>8&255),e.adler=0,r.status=w)):r.status=w),0!==r.pending){if(B(e),0===e.avail_out)return r.last_flush=-1,p}else if(0===e.avail_in&&x(t)<=x(n)&&t!==l)return A(e,-5);if(666===r.status&&0!==e.avail_in)return A(e,-5);if(0!==e.avail_in||0!==r.lookahead||t!==c&&666!==r.status){var o=2===r.strategy?((e,t)=>{for(var n;;){if(0===e.lookahead&&(F(e),0===e.lookahead)){if(t===c)return k;break}if(e.match_length=0,n=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(D(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===l?(D(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?k:S})(r,t):3===r.strategy?((e,t)=>{for(var n,r,i,a,o=e.window;;){if(e.lookahead<=y){if(F(e),e.lookahead<=y&&t===c)return k;if(0===e.lookahead)break}if(e.match_length=0,_<=e.lookahead&&0<e.strstart&&(r=o[i=e.strstart-1])===o[++i]&&r===o[++i]&&r===o[++i]){for(a=e.strstart+y;r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a;);e.match_length=y-(a-i),e.lookahead<e.match_length&&(e.match_length=e.lookahead)}if(_<=e.match_length?(n=u._tr_tally(e,1,e.match_length-_),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(D(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===l?(D(e,!0),0===e.strm.avail_out?E:C):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?k:S})(r,t):s[r.level].func(r,t);if(o!==E&&o!==C||(r.status=666),o===k||o===E)return 0===e.avail_out&&(r.last_flush=-1),p;if(o===S&&(1===t?u._tr_align(r):5!==t&&(u._tr_stored_block(r,0,0,!1),3===t)&&(O(r.head),0===r.lookahead)&&(r.strstart=0,r.block_start=0,r.insert=0),B(e),0===e.avail_out))return r.last_flush=-1,p}return t!==l||!(r.wrap<=0)&&(2===r.wrap?(I(r,255&e.adler),I(r,e.adler>>8&255),I(r,e.adler>>16&255),I(r,e.adler>>24&255),I(r,255&e.total_in),I(r,e.total_in>>8&255),I(r,e.total_in>>16&255),I(r,e.total_in>>24&255)):(T(r,e.adler>>>16),T(r,65535&e.adler)),B(e),0<r.wrap&&(r.wrap=-r.wrap),0!==r.pending)?p:1},e.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==b&&69!==t&&73!==t&&91!==t&&103!==t&&t!==w&&666!==t?A(e,g):(e.state=null,t===w?A(e,-3):p):g},e.deflateSetDictionary=function(e,t){var n,r,i,a,o,s,u,c=t.length;if(!e||!e.state||2===(a=(n=e.state).wrap)||1===a&&n.status!==b||n.lookahead)return g;for(1===a&&(e.adler=f(e.adler,t,c,0)),n.wrap=0,c>=n.w_size&&(0===a&&(O(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new h.Buf8(n.w_size),h.arraySet(u,t,c-n.w_size,n.w_size,0),t=u,c=n.w_size),u=e.avail_in,o=e.next_in,s=e.input,e.avail_in=c,e.next_in=0,e.input=t,F(n);n.lookahead>=_;){for(r=n.strstart,i=n.lookahead-(_-1);n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+_-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--i;);n.strstart=r,n.lookahead=_-1,F(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=_-1,n.match_available=0,e.next_in=o,e.input=s,e.avail_in=u,n.wrap=a,p},e.deflateInfo="pako deflate (from Nodeca project)"}),ce=t(function(e){var u=J(),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var t,c=new u.Buf8(256),t=0;t<256;t++)c[t]=252<=t?6:248<=t?5:240<=t?4:224<=t?3:192<=t?2:1;function l(e,t){if(t<65534&&(e.subarray&&a||!e.subarray&&i))return String.fromCharCode.apply(null,u.shrinkBuf(e,t));for(var n="",r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n}c[254]=c[254]=1,e.string2buf=function(e){for(var t,n,r,i,a=e.length,o=0,s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),o+=n<128?1:n<2048?2:n<65536?3:4;for(t=new u.Buf8(o),s=i=0;i<o;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),n<128?t[i++]=n:(n<2048?t[i++]=192|n>>>6:(n<65536?t[i++]=224|n>>>12:(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63),t[i++]=128|n>>>6&63),t[i++]=128|63&n);return t},e.buf2binstring=function(e){return l(e,e.length)},e.binstring2buf=function(e){for(var t=new u.Buf8(e.length),n=0,r=t.length;n<r;n++)t[n]=e.charCodeAt(n);return t},e.buf2string=function(e,t){for(var n,r,i=t||e.length,a=new Array(2*i),o=0,s=0;s<i;)if((n=e[s++])<128)a[o++]=n;else if(4<(r=c[n]))a[o++]=65533,s+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&s<i;)n=n<<6|63&e[s++],r--;1<r?a[o++]=65533:n<65536?a[o++]=n:(n-=65536,a[o++]=55296|n>>10&1023,a[o++]=56320|1023&n)}return l(a,o)},e.utf8border=function(e,t){for(var n=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=n&&128==(192&e[n]);)n--;return!(n<0||0===n)&&n+c[e[n]]>t?n:t}}),le=t(function(e,t){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}),he=t(function(e){var o=ue(),s=J(),u=ce(),n=Z(),r=le(),c=Object.prototype.toString;function i(e){if(!(this instanceof i))return new i(e);this.options=s.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});e=this.options;if(e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,(this.strm.avail_out=0)!==(t=o.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy)))throw new Error(n[t]);if(e.header&&o.deflateSetHeader(this.strm,e.header),e.dictionary){var t,e="string"==typeof e.dictionary?u.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary;if(0!==(t=o.deflateSetDictionary(this.strm,e)))throw new Error(n[t]);this._dict_set=!0}}function a(e,t){t=new i(t);if(t.push(e,!0),t.err)throw t.msg||n[t.err];return t.result}i.prototype.push=function(e,t){var n,r,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=u.string2buf(e):"[object ArrayBuffer]"===c.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new s.Buf8(a),i.next_out=0,i.avail_out=a),1!==(n=o.deflate(i,r))&&0!==n)return this.onEnd(n),!(this.ended=!0)}while(0!==i.avail_out&&(0!==i.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(u.buf2binstring(s.shrinkBuf(i.output,i.next_out))):this.onData(s.shrinkBuf(i.output,i.next_out))),(0<i.avail_in||0===i.avail_out)&&1!==n);return 4===r?(n=o.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):(2===r&&(this.onEnd(0),i.avail_out=0),!0)},i.prototype.onData=function(e){this.chunks.push(e)},i.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.Deflate=i,e.deflate=a,e.deflateRaw=function(e,t){return(t=t||{}).raw=!0,a(e,t)},e.gzip=function(e,t){return(t=t||{}).gzip=!0,a(e,t)}}),fe=t(function(e,t){t.exports=function(e,t){var n,r,i,a,o,s,u=e.state,c=e.next_in,l=e.input,h=c+(e.avail_in-5),f=e.next_out,d=e.output,p=f-(t-e.avail_out),g=f+(e.avail_out-257),m=u.dmax,_=u.wsize,y=u.whave,v=u.wnext,b=u.window,w=u.hold,k=u.bits,S=u.lencode,E=u.distcode,C=(1<<u.lenbits)-1,A=(1<<u.distbits)-1;e:do{for(k<15&&(w+=l[c++]<<k,k+=8,w+=l[c++]<<k,k+=8),n=S[w&C];;){if(w>>>=r=n>>>24,k-=r,0===(r=n>>>16&255))d[f++]=65535&n;else{if(!(16&r)){if(0==(64&r)){n=S[(65535&n)+(w&(1<<r)-1)];continue}if(32&r){u.mode=12;break e}e.msg="invalid literal/length code",u.mode=30;break e}for(i=65535&n,(r&=15)&&(k<r&&(w+=l[c++]<<k,k+=8),i+=w&(1<<r)-1,w>>>=r,k-=r),k<15&&(w+=l[c++]<<k,k+=8,w+=l[c++]<<k,k+=8),n=E[w&A];;){if(w>>>=r=n>>>24,k-=r,!(16&(r=n>>>16&255))){if(0==(64&r)){n=E[(65535&n)+(w&(1<<r)-1)];continue}e.msg="invalid distance code",u.mode=30;break e}if(a=65535&n,k<(r&=15)&&(w+=l[c++]<<k,(k+=8)<r)&&(w+=l[c++]<<k,k+=8),m<(a+=w&(1<<r)-1)){e.msg="invalid distance too far back",u.mode=30;break e}if(w>>>=r,k-=r,(r=f-p)<a){if(y<(r=a-r)&&u.sane){e.msg="invalid distance too far back",u.mode=30;break e}if(s=b,(o=0)===v){if(o+=_-r,r<i){for(i-=r;d[f++]=b[o++],--r;);o=f-a,s=d}}else if(v<r){if(o+=_+v-r,(r-=v)<i){for(i-=r;d[f++]=b[o++],--r;);if(o=0,v<i){for(i-=r=v;d[f++]=b[o++],--r;);o=f-a,s=d}}}else if(o+=v-r,r<i){for(i-=r;d[f++]=b[o++],--r;);o=f-a,s=d}for(;2<i;)d[f++]=s[o++],d[f++]=s[o++],d[f++]=s[o++],i-=3;i&&(d[f++]=s[o++],1<i)&&(d[f++]=s[o++])}else{for(o=f-a;d[f++]=d[o++],d[f++]=d[o++],d[f++]=d[o++],2<(i-=3););i&&(d[f++]=d[o++],1<i)&&(d[f++]=d[o++])}break}}break}}while(c<h&&f<g);w&=(1<<(k-=(i=k>>3)<<3))-1,e.next_in=c-=i,e.next_out=f,e.avail_in=c<h?h-c+5:5-(c-h),e.avail_out=f<g?g-f+257:257-(f-g),u.hold=w,u.bits=k}}),de=t(function(e,t){var P=J(),R=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],z=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],N=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],L=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,r,i,a,o,s){for(var u,c,l,h,f,d,p,g,m,_=s.bits,y=0,v=0,b=0,w=0,k=0,S=0,E=0,C=0,A=0,x=0,O=null,B=0,D=new P.Buf16(16),I=new P.Buf16(16),T=null,F=0,y=0;y<=15;y++)D[y]=0;for(v=0;v<r;v++)D[t[n+v]]++;for(k=_,w=15;1<=w&&0===D[w];w--);if(w<k&&(k=w),0===w)i[a++]=20971520,i[a++]=20971520,s.bits=1;else{for(b=1;b<w&&0===D[b];b++);for(k<b&&(k=b),y=C=1;y<=15;y++)if((C=(C<<1)-D[y])<0)return-1;if(0<C&&(0===e||1!==w))return-1;for(I[1]=0,y=1;y<15;y++)I[y+1]=I[y]+D[y];for(v=0;v<r;v++)0!==t[n+v]&&(o[I[t[n+v]]++]=v);if(d=0===e?(O=T=o,19):1===e?(O=R,B-=257,T=z,F-=257,256):(O=N,T=L,-1),y=b,f=a,E=v=x=0,l=-1,h=(A=1<<(S=k))-1,1===e&&852<A||2===e&&592<A)return 1;for(;;){for(m=o[v]<d?(g=0,o[v]):o[v]>d?(g=T[F+o[v]],O[B+o[v]]):(g=96,0),u=1<<(p=y-E),b=c=1<<S;i[f+(x>>E)+(c-=u)]=p<<24|g<<16|m|0,0!==c;);for(u=1<<y-1;x&u;)u>>=1;if(0!==u?x=(x&u-1)+u:x=0,v++,0==--D[y]){if(y===w)break;y=t[n+o[v]]}if(k<y&&(x&h)!==l){for(f+=b,C=1<<(S=y-(E=0===E?k:E));S+E<w&&!((C-=D[S+E])<=0);)S++,C<<=1;if(A+=1<<S,1===e&&852<A||2===e&&592<A)return 1;i[l=x&h]=k<<24|S<<16|f-a|0}}0!==x&&(i[f+x]=y-E<<24|64<<16|0),s.bits=k}return 0}}),pe=t(function(e){var I=J(),T=oe(),F=se(),P=fe(),R=de(),z=1,N=2,L=0,j=-2,H=1,n=852,r=592;function U(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=H,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(r),t.sane=1,t.back=-1,L):j}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):j}function s(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t))?j:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,o(e))}function t(e,t){var n;return e?(n=new i,(e.state=n).window=null,(n=s(e,t))!==L&&(e.state=null),n):j}var M,W,q=!0;function G(e,t,n,r){var i,e=e.state;return null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new I.Buf8(e.wsize)),e.wsize<=r?(I.arraySet(e.window,t,n-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(r<(i=e.wsize-e.wnext)&&(i=r),I.arraySet(e.window,t,n-r,i,e.wnext),(r-=i)?(I.arraySet(e.window,t,n-r,r,0),e.wnext=r,e.whave=e.wsize):(e.wnext+=i,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=i))),0}e.inflateReset=o,e.inflateReset2=s,e.inflateResetKeep=a,e.inflateInit=function(e){return t(e,15)},e.inflateInit2=t,e.inflate=function(e,t){var n,r,i,a,o,s,u,c,l,h,f,d,p,g,m,_,y,v,b,w,k,S,E,C,A=0,x=new I.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return j;12===(n=e.state).mode&&(n.mode=13),o=e.next_out,i=e.output,a=e.next_in,r=e.input,c=n.hold,l=n.bits,h=s=e.avail_in,f=u=e.avail_out,S=L;e:for(;;)switch(n.mode){case H:if(0===n.wrap)n.mode=13;else{for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(2&n.wrap&&35615===c)x[n.check=0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0),l=c=0,n.mode=2;else if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31)e.msg="incorrect header check",n.mode=30;else if(8!=(15&c))e.msg="unknown compression method",n.mode=30;else{if(l-=4,k=8+(15&(c>>>=4)),0===n.wbits)n.wbits=k;else if(k>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<k,e.adler=n.check=1,n.mode=512&c?10:12,l=c=0}}break;case 2:for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(n.flags=c,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0)),l=c=0,n.mode=3;case 3:for(;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.head&&(n.head.time=c),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,x[2]=c>>>16&255,x[3]=c>>>24&255,n.check=F(n.check,x,4,0)),l=c=0,n.mode=4;case 4:for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0)),l=c=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&(x[0]=255&c,x[1]=c>>>8&255,n.check=F(n.check,x,2,0)),l=c=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((d=s<(d=n.length)?s:d)&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),I.arraySet(n.head.extra,r,a,d,k)),512&n.flags&&(n.check=F(n.check,r,d,a)),s-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;for(d=0;k=r[a+d++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k)),k&&d<s;);if(512&n.flags&&(n.check=F(n.check,r,d,a)),s-=d,a+=d,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===s)break e;for(d=0;k=r[a+d++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k)),k&&d<s;);if(512&n.flags&&(n.check=F(n.check,r,d,a)),s-=d,a+=d,k)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;l<16;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(c!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}l=c=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}e.adler=n.check=U(c),l=c=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=l,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last)c>>>=7&l,l-=7&l,n.mode=27;else{for(;l<3;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}switch(n.last=1&c,--l,3&(c>>>=1)){case 0:n.mode=14;break;case 1:B=D=void 0;var B,D=n;if(q){for(M=new I.Buf32(512),W=new I.Buf32(32),B=0;B<144;)D.lens[B++]=8;for(;B<256;)D.lens[B++]=9;for(;B<280;)D.lens[B++]=7;for(;B<288;)D.lens[B++]=8;for(R(z,D.lens,0,288,M,0,D.work,{bits:9}),B=0;B<32;)D.lens[B++]=5;R(N,D.lens,0,32,W,0,D.work,{bits:5}),q=!1}if(D.lencode=M,D.lenbits=9,D.distcode=W,D.distbits=5,n.mode=20,6!==t)break;c>>>=2,l-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}c>>>=2,l-=2}break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&c,l=c=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(d=n.length){if(0===(d=u<(d=s<d?s:d)?u:d))break e;I.arraySet(i,r,a,d,o),s-=d,a+=d,u-=d,o+=d,n.length-=d}else n.mode=12;break;case 17:for(;l<14;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(n.nlen=257+(31&c),c>>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;l<3;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.lens[O[n.have++]]=7&c,c>>>=3,l-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},S=R(0,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;_=(A=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,y=65535&A,!((m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(y<16)c>>>=m,l-=m,n.lens[n.have++]=y;else{if(16===y){for(C=m+2;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(c>>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}k=n.lens[n.have-1],d=3+(3&c),c>>>=2,l-=2}else if(17===y){for(C=m+3;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}k=0,d=3+(7&(c>>>=m)),c>>>=3,l=l-m-3}else{for(C=m+7;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}k=0,d=11+(127&(c>>>=m)),c>>>=7,l=l-m-7}if(n.have+d>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;d--;)n.lens[n.have++]=k}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,E={bits:n.lenbits},S=R(z,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,S){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},S=R(N,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,S){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=s&&258<=u){e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=l,P(e,f),o=e.next_out,i=e.output,u=e.avail_out,a=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;_=(A=n.lencode[c&(1<<n.lenbits)-1])>>>16&255,y=65535&A,!((m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(_&&0==(240&_)){for(v=m,b=_,w=y;_=(A=n.lencode[w+((c&(1<<v+b)-1)>>v)])>>>16&255,y=65535&A,!(v+(m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=m,l-=m,n.back+=m,n.length=y,0===_){n.mode=26;break}if(32&_){n.back=-1,n.mode=12;break}if(64&_){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&_,n.mode=22;case 22:if(n.extra){for(C=n.extra;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;_=(A=n.distcode[c&(1<<n.distbits)-1])>>>16&255,y=65535&A,!((m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(0==(240&_)){for(v=m,b=_,w=y;_=(A=n.distcode[w+((c&(1<<v+b)-1)>>v)])>>>16&255,y=65535&A,!(v+(m=A>>>24)<=l);){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}c>>>=v,l-=v,n.back+=v}if(c>>>=m,l-=m,n.back+=m,64&_){e.msg="invalid distance code",n.mode=30;break}n.offset=y,n.extra=15&_,n.mode=24;case 24:if(n.extra){for(C=n.extra;l<C;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===u)break e;if(n.offset>(d=f-u)){if((d=n.offset-d)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}p=d>n.wnext?(d-=n.wnext,n.wsize-d):n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=o-n.offset,d=n.length;for(u-=d=u<d?u:d,n.length-=d;i[o++]=g[p++],--d;);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;i[o++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(0===s)break e;s--,c|=r[a++]<<l,l+=8}if(f-=u,e.total_out+=f,n.total+=f,f&&(e.adler=n.check=(n.flags?F:T)(n.check,i,f,o-f)),f=u,(n.flags?c:U(c))!==n.check){e.msg="incorrect data check",n.mode=30;break}l=c=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;l<32;){if(0===s)break e;s--,c+=r[a++]<<l,l+=8}if(c!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}l=c=0}n.mode=29;case 29:S=1;break e;case 30:S=-3;break e;case 31:return-4;default:return j}return e.next_out=o,e.avail_out=u,e.next_in=a,e.avail_in=s,n.hold=c,n.bits=l,(n.wsize||f!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&G(e,e.output,e.next_out,f-e.avail_out)?(n.mode=31,-4):(h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,n.total+=f,n.wrap&&f&&(e.adler=n.check=(n.flags?F:T)(n.check,i,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),S=(0==h&&0===f||4===t)&&S===L?-5:S)},e.inflateEnd=function(e){var t;return e&&e.state?((t=e.state).window&&(t.window=null),e.state=null,L):j},e.inflateGetHeader=function(e,t){return e&&e.state&&0!=(2&(e=e.state).wrap)?((e.head=t).done=!1,L):j},e.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state&&(0===(n=e.state).wrap||11===n.mode)?11===n.mode&&T(1,t,r,0)!==n.check?-3:G(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,L):j},e.inflateInfo="pako inflate (from Nodeca project)"}),ge=t(function(e,t){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}}),me=t(function(e,t){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}),_e=t(function(e){var h=pe(),f=J(),d=ce(),p=ge(),n=Z(),r=le(),i=me(),g=Object.prototype.toString;function a(e){if(!(this instanceof a))return new a(e);this.options=f.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options,e=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits)&&(t.windowBits=-15),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r,this.strm.avail_out=0,h.inflateInit2(this.strm,t.windowBits));if(e!==p.Z_OK)throw new Error(n[e]);if(this.header=new i,h.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=d.string2buf(t.dictionary):"[object ArrayBuffer]"===g.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(e=h.inflateSetDictionary(this.strm,t.dictionary))!==p.Z_OK)throw new Error(n[e])}function o(e,t){t=new a(t);if(t.push(e,!0),t.err)throw t.msg||n[t.err];return t.result}a.prototype.push=function(e,t){var n,r,i,a,o,s=this.strm,u=this.options.chunkSize,c=this.options.dictionary,l=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?p.Z_FINISH:p.Z_NO_FLUSH,"string"==typeof e?s.input=d.binstring2buf(e):"[object ArrayBuffer]"===g.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new f.Buf8(u),s.next_out=0,s.avail_out=u),(n=(n=h.inflate(s,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&c?h.inflateSetDictionary(this.strm,c):n)===p.Z_BUF_ERROR&&!0===l&&(n=p.Z_OK,l=!1),n!==p.Z_STREAM_END&&n!==p.Z_OK)return this.onEnd(n),!(this.ended=!0)}while(!s.next_out||0!==s.avail_out&&n!==p.Z_STREAM_END&&(0!==s.avail_in||r!==p.Z_FINISH&&r!==p.Z_SYNC_FLUSH)||("string"===this.options.to?(i=d.utf8border(s.output,s.next_out),a=s.next_out-i,o=d.buf2string(s.output,i),s.next_out=a,s.avail_out=u-a,a&&f.arraySet(s.output,s.output,i,a,0),this.onData(o)):this.onData(f.shrinkBuf(s.output,s.next_out))),0===s.avail_in&&0===s.avail_out&&(l=!0),(0<s.avail_in||0===s.avail_out)&&n!==p.Z_STREAM_END);return(r=n===p.Z_STREAM_END?p.Z_FINISH:r)===p.Z_FINISH?(n=h.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===p.Z_OK):(r===p.Z_SYNC_FLUSH&&(this.onEnd(p.Z_OK),s.avail_out=0),!0)},a.prototype.onData=function(e){this.chunks.push(e)},a.prototype.onEnd=function(e){e===p.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=f.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.Inflate=a,e.inflate=o,e.inflateRaw=function(e,t){return(t=t||{}).raw=!0,o(e,t)},e.ungzip=o}),ye=t(function(e,t){var n={};(0,J().assign)(n,he(),_e(),ge()),t.exports=n}),ve=t(function(e){var t=("undefined"==typeof Uint8Array?"undefined":_typeof(Uint8Array))<"u"&&("undefined"==typeof Uint16Array?"undefined":_typeof(Uint16Array))<"u"&&("undefined"==typeof Uint32Array?"undefined":_typeof(Uint32Array))<"u",n=ye(),r=E(),i=C(),a=t?"uint8array":"array";function o(e,t){i.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}e.magic="\b\0",r.inherits(o,i),o.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,e.data),!1)},o.prototype.flush=function(){i.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this._pako=null},o.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},e.compressWorker=function(e){return new o("Deflate",e)},e.uncompressWorker=function(){return new o("Inflate",{})}}),be=t(function(e){var t=C();e.STORE={magic:"\0\0",compressWorker:function(e){return new t("STORE compression")},uncompressWorker:function(){return new t("STORE decompression")}},e.DEFLATE=ve()}),we=t(function(e){e.LOCAL_FILE_HEADER="PK",e.CENTRAL_FILE_HEADER="PK",e.CENTRAL_DIRECTORY_END="PK",e.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",e.ZIP64_CENTRAL_DIRECTORY_END="PK",e.DATA_DESCRIPTOR="PK\b"}),ke=t(function(e,t){function y(e,t){for(var n="",r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function r(e,t,n,r,i,a){var o=e.file,s=e.compression,u=a!==b.utf8encode,c=v.transformTo("string",a(o.name)),l=v.transformTo("string",b.utf8encode(o.name)),h=o.comment,a=v.transformTo("string",a(h)),f=v.transformTo("string",b.utf8encode(h)),d=l.length!==o.name.length,h=f.length!==h.length,p="",g=o.dir,m=o.date,_={crc32:0,compressedSize:0,uncompressedSize:0},n=(t&&!n||(_.crc32=e.crc32,_.compressedSize=e.compressedSize,_.uncompressedSize=e.uncompressedSize),0),e=(t&&(n|=8),u||!d&&!h||(n|=2048),0),t=0,m=(g&&(e|=16),"UNIX"===i?(t=798,e|=(u=o.unixPermissions,i=g,(65535&(u?u:i?16893:33204))<<16)):(t=20,e|=63&(o.dosPermissions||0)),g=m.getUTCHours(),g<<=6,g=(g=(g|m.getUTCMinutes())<<5)|m.getUTCSeconds()/2,u=m.getUTCFullYear()-1980,u=(u=((u<<=4)|m.getUTCMonth()+1)<<5)|m.getUTCDate(),d&&(i=y(1,1)+y(w(c),4)+l,p+="up"+y(i.length,2)+i),h&&(o=y(1,1)+y(w(a),4)+f,p+="uc"+y(o.length,2)+o),""),m=(m=(m=(m=(m=(m=(m=(m=(m=(m+="\n\0")+y(n,2))+s.magic)+y(g,2))+y(u,2))+y(_.crc32,4))+y(_.compressedSize,4))+y(_.uncompressedSize,4))+y(c.length,2))+y(p.length,2);return{fileRecord:k.LOCAL_FILE_HEADER+m+c+p,dirRecord:k.CENTRAL_FILE_HEADER+y(t,2)+m+y(a.length,2)+"\0\0\0\0"+y(e,4)+y(r,4)+c+p+a}}var v=E(),i=C(),b=A(),w=l(),k=we();function n(e,t,n,r){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}v.inherits(n,i),n.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},n.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;t?(e=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName),this.push({data:e.fileRecord,meta:{percent:0}})):this.accumulate=!0},n.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:(t=e,k.DATA_DESCRIPTOR+y(t.crc32,4)+y(t.compressedSize,4)+y(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},n.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,n=((e,t,n,r,i)=>(i=v.transformTo("string",i(r)),k.CENTRAL_DIRECTORY_END+"\0\0\0\0"+y(e,2)+y(e,2)+y(t,4)+y(n,4)+y(i.length,2)+i))(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},n.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},n.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},n.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},n.prototype.error=function(e){var t=this._sources;if(!i.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},n.prototype.lock=function(){i.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=n}),Se=t(function(e){var c=be(),n=ke();e.generateWorker=function(e,o,t){var s=new n(o.streamFiles,t,o.platform,o.encodeFileName),u=0;try{e.forEach(function(e,t){u++;var n=((e,t)=>{if(t=c[e=e||t])return t;throw new Error(e+" is not a valid compression method !")})(t.options.compression,o.compression),r=t.options.compressionOptions||o.compressionOptions||{},i=t.dir,a=t.date;t._compressWorker(n,r).withStreamInfo("file",{name:e,dir:i,date:a,comment:t.comment||"",unixPermissions:t.unixPermissions,dosPermissions:t.dosPermissions}).pipe(s)}),s.entriesCount=u}catch(e){s.error(e)}return s}}),Ee=t(function(e,t){var n=E(),r=C();function i(e,t){r.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(i,r),i.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},i.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=i}),Ce=t(function(e,t){function o(e){var t=(e="/"===e.slice(-1)?e.substring(0,e.length-1):e).lastIndexOf("/");return 0<t?e.substring(0,t):""}function s(e,t){return t=_typeof(t)<"u"?t:l.createFolders,e=_(e),this.files[e]||m.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]}var i=A(),u=E(),c=C(),a=x(),l=O(),h=B(),f=ie(),d=Se(),p=v(),g=Ee(),m=function(e,t,n){var r=u.getTypeOf(t),i=u.extend(n||{},l),a=(i.date=i.date||new Date,null!==i.compression&&(i.compression=i.compression.toUpperCase()),"string"==typeof i.unixPermissions&&(i.unixPermissions=parseInt(i.unixPermissions,8)),i.unixPermissions&&16384&i.unixPermissions&&(i.dir=!0),i.dosPermissions&&16&i.dosPermissions&&(i.dir=!0),i.dir&&(e=_(e)),i.createFolders&&(a=o(e))&&s.call(this,a,!0),"string"===r&&!1===i.binary&&!1===i.base64);(!n||"u"<_typeof(n.binary))&&(i.binary=!a);(t instanceof h&&0===t.uncompressedSize||i.dir||!t||0===t.length)&&(i.base64=!1,i.binary=!0,t="",i.compression="STORE");r=null,r=t instanceof h||t instanceof c?t:p.isNode&&p.isStream(t)?new g(e,t):u.prepareContent(e,t,i.binary,i.optimizedBinaryString,i.base64),n=new f(e,r,i);this.files[e]=n},_=function(e){return"/"!==e.slice(-1)&&(e+="/"),e};function y(e){return"[object RegExp]"===Object.prototype.toString.call(e)}t.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)r=this.files[t],n=t.slice(this.root.length,t.length),n&&t.slice(0,this.root.length)===this.root&&e(n,r)},filter:function(n){var r=[];return this.forEach(function(e,t){n(e,t)&&r.push(t)}),r},file:function(e,t,n){var r,i;return 1===arguments.length?y(e)?(r=e,this.filter(function(e,t){return!t.dir&&r.test(e)})):(i=this.files[this.root+e])&&!i.dir?i:null:(e=this.root+e,m.call(this,e,t,n),this)},folder:function(n){var e,t;return n?y(n)?this.filter(function(e,t){return t.dir&&n.test(e)}):(e=this.root+n,e=s.call(this,e),(t=this.clone()).root=e.name,t):this},remove:function(n){n=this.root+n;var e=this.files[n];if(e||("/"!==n.slice(-1)&&(n+="/"),e=this.files[n]),e&&!e.dir)delete this.files[n];else for(var t=this.filter(function(e,t){return t.name.slice(0,n.length)===n}),r=0;r<t.length;r++)delete this.files[t[r].name];return this},generate:function(e){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t={};try{if((t=u.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=t.type.toLowerCase(),t.compression=t.compression.toUpperCase(),"binarystring"===t.type&&(t.type="string"),!t.type)throw new Error("No output type specified.");u.checkSupport(t.type),"darwin"!==t.platform&&"freebsd"!==t.platform&&"linux"!==t.platform&&"sunos"!==t.platform||(t.platform="UNIX"),"win32"===t.platform&&(t.platform="DOS");var n=t.comment||this.comment||"",r=d.generateWorker(this,t,n)}catch(e){(r=new c("error")).error(e)}return new a(r,t.type||"string",t.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}}}),Ae=t(function(e,t){var n=E();function r(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(e){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r}),xe=t(function(e,t){var n=Ae();function r(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}E().inherits(r,n),r.prototype.byteAt=function(e){return this.data[this.zero+e]},r.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===n&&this.data[a+2]===r&&this.data[a+3]===i)return a-this.zero;return-1},r.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),e=e.charCodeAt(3),i=this.readData(4);return t===i[0]&&n===i[1]&&r===i[2]&&e===i[3]},r.prototype.readData=function(e){var t;return this.checkOffset(e),0===e?[]:(t=this.data.slice(this.zero+this.index,this.zero+this.index+e),this.index+=e,t)},t.exports=r}),Oe=t(function(e,t){var n=Ae();function r(e){n.call(this,e)}E().inherits(r,n),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r}),Be=t(function(e,t){var n=xe();function r(e){n.call(this,e)}E().inherits(r,n),r.prototype.readData=function(e){var t;return this.checkOffset(e),0===e?new Uint8Array(0):(t=this.data.subarray(this.zero+this.index,this.zero+this.index+e),this.index+=e,t)},t.exports=r}),De=t(function(e,t){var n=Be();function r(e){n.call(this,e)}E().inherits(r,n),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r}),Ie=t(function(e,t){var n=E(),r=p(),i=xe(),a=Oe(),o=De(),s=Be();t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new o(e):r.uint8array?new s(n.transformTo("uint8array",e)):new i(n.transformTo("array",e)):new a(e)}}),Te=t(function(e,t){var n=Ie(),r=E(),i=B(),a=l(),o=A(),s=be(),u=p();function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t;if(e.skip(22),this.fileNameLength=e.readInt(2),t=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(t),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=(e=>{for(var t in s)if(s.hasOwnProperty(t)&&s[t].magic===e)return s[t];return null})(this.compressionMethod)))throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){var t;this.extraFields[1]&&(t=n(this.extraFields[1].value),this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS)&&(this.diskNumberStart=t.readInt(4))},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[t]={id:t,length:n,value:r};e.setIndex(i)},handleUTF8:function(){var e,t=u.uint8array?"uint8array":"array";this.useUTF8()?(this.fileNameStr=o.utf8decode(this.fileName),this.fileCommentStr=o.utf8decode(this.fileComment)):(null!==(e=this.findExtraFieldUnicodePath())?this.fileNameStr=e:(e=r.transformTo(t,this.fileName),this.fileNameStr=this.loadOptions.decodeFileName(e)),null!==(e=this.findExtraFieldUnicodeComment())?this.fileCommentStr=e:(e=r.transformTo(t,this.fileComment),this.fileCommentStr=this.loadOptions.decodeFileName(e)))},findExtraFieldUnicodePath:function(){var e,t=this.extraFields[28789];return!t||1!==(e=n(t.value)).readInt(1)||a(this.fileName)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))},findExtraFieldUnicodeComment:function(){var e,t=this.extraFields[25461];return!t||1!==(e=n(t.value)).readInt(1)||a(this.fileComment)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))}},t.exports=c}),Fe=t(function(e,t){var n=Ie(),r=E(),i=we(),a=Te(),o=(A(),p());function s(e){this.files=[],this.loadOptions=e}s.prototype={checkSignature:function(e){var t;if(!this.reader.readAndCheckSignature(e))throw this.reader.index-=4,t=this.reader.readString(4),new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(t)+", expected "+r.pretty(e)+")")},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);e=this.reader.readString(4)===t;return this.reader.setIndex(n),e},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=o.uint8array?"uint8array":"array",t=r.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(t)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){for(var e,t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(e=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(e<0)throw!this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(e);var t=e;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}e=this.centralDirOffset+this.centralDirSize,e=t-(e=this.zip64?e+20+(12+this.zip64EndOfCentralSize):e);if(0<e)this.isSignature(t,i.CENTRAL_FILE_HEADER)||(this.reader.zero=e);else if(e<0)throw new Error("Corrupted zip: missing "+Math.abs(e)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=s}),Pe=t(function(e,t){var n=E(),o=m(),r=A(),s=Fe(),u=ne(),c=v();t.exports=function(e,i){var a=this;return i=n.extend(i||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),c.isNode&&c.isStream(e)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",e,!0,i.optimizedBinaryString,i.base64).then(function(e){var t=new s(i);return t.load(e),t}).then(function(e){var t=[o.Promise.resolve(e)],n=e.files;if(i.checkCRC32)for(var r=0;r<n.length;r++)t.push((r=>new o.Promise(function(e,t){var n=r.decompressed.getContentWorker().pipe(new u);n.on("error",function(e){t(e)}).on("end",function(){n.streamInfo.crc32!==r.decompressed.crc32?t(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()}))(n[r]));return o.Promise.all(t)}).then(function(e){for(var e=e.shift(),t=e.files,n=0;n<t.length;n++){var r=t[n];a.file(r.fileNameStr,r.decompressed,{binary:!0,optimizedBinaryString:!0,date:r.date,dir:r.dir,comment:r.fileCommentStr.length?r.fileCommentStr:null,unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions,createFolders:i.createFolders})}return e.zipComment.length&&(a.comment=e.zipComment),a})}}),Re=t(function(e,t){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e,t=new n;for(e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(n.prototype=Ce()).loadAsync=Pe(),n.support=p(),n.defaults=O(),n.version="3.7.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=m(),t.exports=n}),u={},ze=u,Ne={Command:function(){return Le},jszip:function(){return je.default}};for(i in Ne)s(ze,i,{get:Ne[i],enumerable:!0});e.exports=(e=u,r(s({},"__esModule",{value:!0}),e));var u=n(M(),1).default,Le=(u.program,u.Command),je=n(Re())}),Qt=Lt(function(e,t){var n,r,i="rpk",a="quickApp";t.exports={MAX_SIZE_SSPK:2097152,MAX_SIZE_SPK:20971520,SIGN_MAGIC:"RPK Sig Block 42",SIGN_MAGIC_APK:"APK Sig Block 42",SIGN_TYPE_FULL_PACKAGE:16777473,SIGN_TYPE_FULL_PACKAGE_APK:1896449818,SIGN_TYPE_FILE_LIST:16777729,CRYPT_TYPE_RSA_SHA256:513,SIGN_HEADER:[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32],BEGIN_TAG:165,JOINT_TAG:90,CERT_HEAD:"-----BEGIN CERTIFICATE-----\n",CERT_END:"\n-----END CERTIFICATE-----",RPK:".rpk",SRPK:".srpk",RPKS:".rpks",setSignType:function(e){return i=e},isApkSign:function(){return"apk"===i},setDssHost:function(e){return n=e},setDssKey:function(e){return r=e},setDssKeyId:function(e){return a=e},getDssHost:function(){return n},getDssKey:function(){return r},getDssKeyId:function(){return a},setDssConfig:function(e){n=e.dssHost,r=e.dssKey}}}),Ye=Lt(function(e,t){var c=Qt(),l=22,h=67324752,f=33639248,d=101010256,p=16;t.exports={parserZip:function(e,t){var n,r,i,a,o,s,u={tag:!1,length:e.length,sections:{header:null,central:null,footer:null}};return u.sections.footer=(e=>{var t={tag:!1};if(e&&!(e.length<l))for(var n=e.length-l;0<=n;n--)if(d===e.readInt32LE(n)){t.tag=!0,t.startIndex=n,t.len=e.length-n,t.previous=e.readInt32LE(n+p);break}return t})(e),u.sections.footer.tag&&(u.sections.central=(i=e,a=u.sections.footer.previous,o=u.sections.footer.startIndex-u.sections.footer.previous,s={tag:!1},!i||i.length<a||f===i.readInt32LE(a)&&(s.tag=!0,s.startIndex=a,s.len=o,s.previous=i.readInt32LE(a+42)),s),u.sections.central.tag)&&(o=u.sections.central.previous,i=u.sections.central.startIndex-u.sections.central.previous,t&&(u.sections.sign=(a=o,s={tag:!1},!(t=e)||t.length<a||(a=c.isApkSign()?c.SIGN_MAGIC_APK:c.SIGN_MAGIC,0<(a=t.indexOf(a))&&(n=t.readInt32LE(a-8),r=a+16-n-8,t.readInt32LE(r)===n)&&(s.tag=!0,s.len=n,s.startIndex=a+16,s.previous=r)),s),o=0,i=u.sections.sign.startIndex-u.sections.sign.len-8),u.sections.header=(t=o,n=i,a={tag:!1},!(r=e)||r.length<t||h===r.readInt32LE(t)&&(a.tag=!0,a.startIndex=t,a.len=n,a.previous=-1),a),u.sections.header.tag&&(u.tag=!0)),u},checkZipBuffer:function(e,t){return!e||e.length<=4?(console.log("### Sign Failed, cannot open file: ",t),!1):h===e.readInt32LE(0)||(console.log("### Sign Failed, zip file error: ",t),!1)}}}),rn=Lt(function(e,t){var s,n={decode:function(e){if(void 0===s){var t="= \f\n\r\t \u2028\u2029";for(s=[],a=0;a<64;++a)s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a)]=a;for(a=0;a<t.length;++a)s[t.charAt(a)]=-1}for(var n=[],r=0,i=0,a=0;a<e.length;++a){var o=e.charAt(a);if("="===o)break;if(-1!==(o=s[o])){if(void 0===o)throw"Illegal character at offset "+a;r|=o,4<=++i?(n[n.length]=r>>16,n[n.length]=r>>8&255,n[n.length]=255&r,i=r=0):r<<=6}}switch(i){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:n[n.length]=r>>10;break;case 3:n[n.length]=r>>16,n[n.length]=r>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z\d+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z\d+\/=\s]+)====/,unarmor:function(e){var t=n.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw"RegExp out of sync";e=t[2]}return n.decode(e)}};t.exports=n}),an=Lt(function(e,t){var u,n={decode:function(e){if(void 0===u){var t="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(u=[],o=0;o<16;++o)u[t.charAt(o)]=o;for(t=t.toLowerCase(),o=10;o<16;++o)u[t.charAt(o)]=o;for(o=0;o<n.length;++o)u[n.charAt(o)]=-1}for(var r=[],i=0,a=0,o=0;o<e.length;++o){var s=e.charAt(o);if("="===s)break;if(-1!==(s=u[s])){if(void 0===s)throw"Illegal character at offset "+o;i|=s,2<=++a?(r[r.length]=i,a=i=0):i<<=4}}if(a)throw"Hex encoding incomplete: 4 bits missing";return r}};t.exports=n}),hn=Lt(function(e,t){var n={};n.digest=function(e,t){void 0===t&&(t=0);var n;t^=-1;for(var r=0,i=e.length;r<i;r++)n=255&(t^e.charCodeAt(r)),t=t>>>8^"0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substr(9*n,8);return-1^t},t.exports=n}),Je=Lt(function(e,t){var n=rn(),r=an(),i=hn();t.exports={Base64:n,Hex:r,CRC32:i}}),Qe=Lt(function(e,t){var s=require("crypto"),u=require("http"),c=Qt(),l=require("js-base64").encodeURL;var h={"Content-Type":"application/json"};function i(e){var t,n,r,i={version:"1",payload:l(e),paddingMode:"1"},e=(new Date).getTime(),a=(h.Authorization=(t=i,n=(new Date).getTime(),t="POST&"+new URL(c.getDssHost()).pathname+"&&"+JSON.stringify(t)+"&appid="+c.getDssKeyId()+"&timestamp="+n,r=c.getDssKey(),r=s.createHmac("sha256",r).update(t).digest("base64"),"CLOUDSOA-HMAC-SHA256 appid=".concat(c.getDssKeyId(),", timestamp=").concat(n,', signature="').concat(r,'"')),h["X-Request-ID"]=e,new URL(c.getDssHost())),o=a.pathname;return new Promise(function(n){var e=u.request({host:a.hostname,port:8108,method:"POST",path:o,headers:h},function(e){var t="";e.on("data",function(e){t+=e}),e.on("end",function(){n(JSON.parse(t))})});e.on("error",function(e){console.error("sign request error: ".concat(e.message))}),e.write(JSON.stringify(i)),e.end()})}function r(e){return n.apply(this,arguments)}function n(){return(n=_asyncToGenerator(_regenerator().m(function e(t){var n,r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i(t);case 1:return n=e.v,console.log(n),r={},e.a(2,(n&&0===n.status?(r.cert=n.result.cert,r.signature=n.result.signature):console.error("sign request error:"+(n?n.result.errMsg:"")),r))}},e)}))).apply(this,arguments)}function a(e){var t;if(e)return t=(e=e.replace(/-/g,"+").replace(/_/g,"/")).length%4,e+"====".substring(0,t)}function o(){return(o=_asyncToGenerator(_regenerator().m(function e(t){var n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return c.setDssConfig(t),e.n=1,r("abc");case 1:return n=e.v,n=a(n.cert).replace(/(.{64})/g,"$1\n"),e.a(2,c.CERT_HEAD+n+c.CERT_END)}},e)}))).apply(this,arguments)}t.exports={getSignDigestOnline:r,Base64UrlToBase64:a,setOnlineParam:function(e,t){c.setDssKey(e),c.setDssHost(t)},generateCertificate:function(e){return o.apply(this,arguments)}}}),rr=Lt(function(e,t){var v=Qt(),f=Ye(),n=require("js-base64"),o=n.encode,d=n.Base64,s=require("http"),r=require("fs"),p=require("crypto"),a=Je(),g=Qe(),u="Rsagen",c="Rsagen-V3.0.1.20190615",l="Normal",h="NONEWITHRSA",m="signData";function _(e,t){var n=t.startIndex,e=e.slice(n,t.startIndex+t.len),n=Buffer.alloc(5+t.len);n[0]=v.BEGIN_TAG,n.writeInt32LE(e.length,1),e.copy(n,5),t.sign=D(n)}function y(e){function t(e){e.copy(r,i),i+=e.length}var e=e.sections,n=e.header.sign.length+e.central.sign.length+e.footer.sign.length+5,r=Buffer.alloc(n),i=0;return r.writeInt8(v.JOINT_TAG,0),r.writeInt32LE(3,1),i+=5,t(e.header.sign),t(e.central.sign),t(e.footer.sign),D(r)}function b(e,t){var r={keyId:t.keyId,clientType:u,clientVersion:c,algorithmType:l,userName:t.userName,unSignData:o(e),passwordDigest:t.passwordDigest,algorithm:h,outFileNameArray:[m],encryptPassword:t.encryptPassword},i=new URL(t.host),a=i.pathname;return new Promise(function(n){var e=s.request({host:i.hostname,method:"POST",path:a,headers:{"Content-Type":"application/json"}},function(e){var t="";e.on("data",function(e){t+=e}),e.on("end",function(){n(JSON.parse(t))})});e.on("error",function(e){console.error("problem with request: ".concat(e.message))}),e.write(JSON.stringify(r)),e.end()})}function w(e){var t=Buffer.from(v.SIGN_HEADER),e=D(e),n=Buffer.alloc(e.length+t.length),r=0;return t.copy(n,0),r+=t.length,e.copy(n,r),n}function k(e){var t=Buffer.alloc(e.length+12);return t.writeInt32LE(e.length+8,0),t.writeInt32LE(v.CRYPT_TYPE_RSA_SHA256,4),t.writeInt32LE(e.length,8),e.copy(t,12),{len:t.length,buffer:t}}function S(e,t){var n={len:12,digests:{size:0,data:[]},certs:{size:0,data:[]},additional:0};return n.digests.data.push(e),n.digests.size+=e.len,n.len+=e.len,n.certs.data.push(t),n.certs.size+=t.len,n.len+=t.len,n}function E(){return(E=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if((r={len:16+n.cert.pemBuffer.length,size:12+n.cert.pemBuffer.length,signdata:{size:0,buffer:null},signatures:{size:0,data:[]},pubkey:{size:n.cert.pemBuffer.length,buffer:n.cert.pemBuffer}}).signdata.buffer=A(t),r.signdata.size=t.len,r.size+=t.len,r.len+=t.len,v.isApkSign())return e.n=1,g.getSignDigestOnline(r.signdata.buffer);e.n=2;break;case 1:i=e.v,i=Buffer.from(d.toUint8Array(i.signature)),e.n=8;break;case 2:if("dss"===n.type)return e.n=3,g.getSignDigestOnline(r.signdata.buffer);e.n=4;break;case 3:a=e.v,i=Buffer.from(d.toUint8Array(a.signature)),e.n=8;break;case 4:if(n.signOnline)return a=w(r.signdata.buffer),e.n=5,b(a,n.onlineConfig);e.n=7;break;case 5:if((o=e.v).success){e.n=6;break}throw new Error(o.message);case 6:i=Buffer.from(d.toUint8Array(o.data.signData)),e.n=8;break;case 7:(s=p.createSign("RSA-SHA256")).update(r.signdata.buffer),i=s.sign(n.privateKey);case 8:return s={len:i.length+12,size:i.length+8,id:v.CRYPT_TYPE_RSA_SHA256,buffer:i},e.a(2,(r.signatures.data.push(s),r.signatures.size+=s.len,r.size+=s.len,r.len+=s.len,r))}},e)}))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if((i={len:4+n.len,size:n.len,data:[]}).data.push(n),a=v.isApkSign()?v.SIGN_TYPE_FULL_PACKAGE_APK:v.SIGN_TYPE_FULL_PACKAGE,(i={len:32+(a={len:i.len+12,size:i.len+4,id:a,value:i}).len,size:24+a.len,data:[]}).data.push(a),t.files&&!v.isApkSign())return e.n=1,function(){return O.apply(this,arguments)}(t.files,r);e.n=2;break;case 1:(a=e.v)&&((o={len:4+a.length,size:a.length,data:[]}).data.push(a),o={len:o.len+12,size:o.len+4,id:v.SIGN_TYPE_FILE_LIST,value:o},i.data.push(o),i.size+=o.len,i.len+=o.len);case 2:return e.a(2,i)}},e)}))).apply(this,arguments)}function A(e){var t=Buffer.alloc(e.len),n=0;return t.writeInt32LE(e.digests.size,n),n+=4,e.digests.data.forEach(function(e){e.buffer.copy(t,n),n+=e.len}),t.writeInt32LE(e.certs.size,n),n+=4,e.certs.data.forEach(function(e){e.buffer.copy(t,n),n+=e.len}),t.writeInt32LE(e.additional,n),t}function x(e){var i={len:8,size:4,digests:[],sign:null};return e.forEach(function(e){var t=a.CRC32.digest(e.name.toString()),n=6+e.hash.length,r=Buffer.alloc(n);r.writeInt32LE(t,0),r.writeInt16LE(e.hash.length,4),e.hash.copy(r,6),i.digests.push(r),i.size+=n,i.len+=n}),i}function O(){return(O=_asyncToGenerator(_regenerator().m(function e(i,a){var o,s,u,c,l,h,f;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:o=x(i),s=Buffer.alloc(o.size),u=0,o.digests.forEach(function(e){e.copy(s,u),u+=e.length}),a.sign?(console.log("sign files, use remote sign"),c=a.sign,e.n=7):e.n=1;break;case 1:if("dss"===a.type)return e.n=2,g.getSignDigestOnline(s);e.n=3;break;case 2:l=e.v,c=Buffer.from(d.toUint8Array(l.signature)),e.n=7;break;case 3:if(a.signOnline)return l=w(s),e.n=4,b(l,a.onlineConfig);e.n=6;break;case 4:if((h=e.v).success){e.n=5;break}throw new Error(h.message);case 5:c=Buffer.from(d.toUint8Array(h.data.signData)),e.n=7;break;case 6:(f=p.createSign("RSA-SHA256")).update(s),c=f.sign(a.privateKey);case 7:return e.a(2,(o.digests=s.slice(),o.sign={len:12+c.length,size:8+c.length,id:v.CRYPT_TYPE_RSA_SHA256,data:c},o.len+=o.sign.len,t=o,r=n=void 0,n=Buffer.alloc(t.len),r=0,n.writeInt32LE(t.size,0),r+=4,t.digests.copy(n,4),r+=t.digests.length,n.writeInt32LE(t.sign.size,r),r+=4,n.writeInt32LE(t.sign.id,r),r+=4,n.writeInt32LE(t.sign.data.length,r),r+=4,t.sign.data.copy(n,r),n))}var t,n,r},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regenerator().m(function e(o,s,u){var c,l,h;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(f.checkZipBuffer(o)){e.n=1;break}return e.a(2,null);case 1:if((c=f.parserZip(o)).options={files:s},c.tag){e.n=2;break}return e.a(2,null);case 2:return Object.keys(c.sections).forEach(function(e){e=c.sections[e];_(o,e)}),l=y(c),l=k(l),l=S(l,u.cert.obj),e.n=3,function(){return E.apply(this,arguments)}(l,u);case 3:return l=e.v,e.n=4,function(){return C.apply(this,arguments)}(c.options,l,u);case 4:return h=e.v,e.a(2,(c.signchunk=(e=>{var t=Buffer.alloc(e.len),n=0,r=(t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(0,n),n+=4,v.isApkSign()?v.SIGN_TYPE_FULL_PACKAGE_APK:v.SIGN_TYPE_FULL_PACKAGE),e=(e.data.forEach(function(e){t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(0,n),n+=4,t.writeInt32LE(e.id,n),n+=4,t.writeInt32LE(e.value.size,n),n+=4,r===e.id?e.value.data.forEach(function(e){t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(e.signdata.size,n),n+=4,e.signdata.buffer.copy(t,n),n+=e.signdata.buffer.length,t.writeInt32LE(e.signatures.size,n),n+=4,e.signatures.data.forEach(function(e){t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(e.id,n),n+=4,t.writeInt32LE(e.buffer.length,n),n+=4,e.buffer.copy(t,n),n+=e.buffer.length}),t.writeInt32LE(e.pubkey.size,n),n+=4,e.pubkey.buffer.copy(t,n),n+=e.pubkey.buffer.length}):v.SIGN_TYPE_FILE_LIST===e.id&&e.value.data.forEach(function(e){e.copy(t,n),n+=e.length})}),t.writeInt32LE(e.size,n),n+=4,t.writeInt32LE(0,n),n+=4,v.isApkSign()?v.SIGN_MAGIC_APK:v.SIGN_MAGIC);return Buffer.from(e).copy(t,n),t})(h),t=o,n=c,a=i=r=void 0,r=Buffer.alloc(t.length+n.signchunk.length),i=0,a=n.sections,t.copy(r,0,a.header.startIndex,a.header.startIndex+a.header.len),i+=a.header.len,n.signchunk.copy(r,i),i+=n.signchunk.length,t.copy(r,i,a.central.startIndex,a.central.startIndex+a.central.len),i+=a.central.len,t.writeInt32LE(a.central.startIndex+n.signchunk.length,a.footer.startIndex+16),t.copy(r,i,a.footer.startIndex,a.footer.startIndex+a.footer.len),r))}var t,n,r,i,a},e)}))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(f.checkZipBuffer(t)){e.n=1;break}return e.a(2,null);case 1:if((i=f.parserZip(t)).options={files:n},i.tag){e.n=2;break}return e.a(2,null);case 2:return Object.keys(i.sections).forEach(function(e){e=i.sections[e];_(t,e)}),a=y(i),a=k(a),a=S(a,r.cert.obj),e.a(2,A(a))}},e)}))).apply(this,arguments)}function D(e){var t=p.createHash("SHA256");return t.update(e),t.digest()}function I(e,t){var n={};return n.size=e.readInt32LE(t),n.buffer=e.slice(t+=4,t+n.size),{obj:n,i:t+=n.size}}t.exports={hashFile:function(e){return D(r.readFileSync(e))},signZipResource:function(e,t,n){return i.apply(this,arguments)},getBufferSha256:D,getSignChunk:function(e,t){for(var n,r,i,a,o,s=(y=t.previous+8)+t.len,u=[],c={signDataBufList:[]},l=v.isApkSign()?v.SIGN_TYPE_FULL_PACKAGE_APK:v.SIGN_TYPE_FULL_PACKAGE;y<s;){a=y,void 0,(o={}).size=(h=e).readInt32LE(a),o.id=h.readInt32LE(a+=8),a+=4,o.value={},o.value.size=h.readInt32LE(a),o.value.data=[];var h={data:o,index:a+=4},f=h.data,d=(y=h.index)+f.value.size,p={};if(l===f.id)for(;y<d;){p.size=e.readInt32LE(y);var g=I(e,y+=4),m=(p.signdata=g.obj,y=g.i,c.signDataBufList.push(p.signdata.buffer),p.signatures={},p.signatures.size=e.readInt32LE(y),(y+=4)+p.signatures.size);for(p.signatures.data=[];y<m;){n=y,i=r=void 0,(r={}).size=(_=e).readInt32LE(n),r.id=_.readInt32LE(n+=4),i=_.readInt32LE(n+=4),r.buffer=_.slice(n+=4,n+i);var _={sData:r,index:n+=i},y=_.index;p.signatures.data.push(_.sData)}g=I(e,y);p.pubkey=g.obj,y=g.i,f.value.data.push(p)}else v.SIGN_TYPE_FILE_LIST===f.id&&(p=e.slice(y,y+f.value.size),f.value.data.push(p));u.push(f)}return c.data=u,c.size=t.size,c},getCertBuffer:function(e){var t,n;if(e)return e.signDataBufList&&0<e.signDataBufList.length?(n=e.signDataBufList[t=0].readInt32LE(0),n=e.signDataBufList[0].readInt32LE(t=t+(4+n)+4),e=e.signDataBufList[0].slice(t+=4,t+n),v.CERT_HEAD+e.toString("base64")+v.CERT_END):void 0;console.error("no sign chunk!")},getSignFilesObject:x,getSignData:function(e,t,n){return B.apply(this,arguments)}}}),Ce=Lt(function(e,t){var s=require("path"),p=require("fs"),g=require("crypto"),m=Pe().jszip,_=rr(),l=require("jsrsasign"),h=Je(),y=Ye(),v=rr(),f=Qe(),n=require("@atomicservice/ascf-base").getLogger,r=Qt(),i=r.SRPK,a=r.RPK,b=n("spk-sign-utils"),u="META-INF/CERT",o="hash.json",w={type:"nodebuffer",compression:"DEFLATE",compressionOptions:{level:9}};function c(){return(c=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r={},t.forEach(function(e){var t=e.fileBuildPath,e=e.fileContentDigest;return r[t]=e.toString("hex")}),(i=new m).file(o,JSON.stringify({algorithm:"SHA-256",digests:r})),e.n=1,i.generateAsync(w);case 1:return i=e.v,a={name:o,hash:_.getBufferSha256(i)},e.n=2,_.signZipResource(i,[a],n);case 2:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function k(){return d.apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=t.fileList,i=new m,a=r.map(function(e){return{name:e.fileBuildPath,hash:e.fileContentDigest}}),e.n=1,function(){return c.apply(this,arguments)}(r,n);case 1:return o=e.v,i.file(u,o),a.unshift({name:u,hash:_.getBufferSha256(o)}),o=Object.assign({},w),r.forEach(function(e){var t=e.fileBuildPath;i.file(t,e.fileContentBuffer)}),e.n=2,i.generateAsync(o);case 2:return o=e.v,e.n=3,_.signZipResource(o,a,n);case 3:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function S(){return(S=_asyncToGenerator(_regenerator().m(function e(t,n,r,i,a){var o,s,u,c,l,h,f,d,p;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,k(r,n);case 1:if(o=e.v,i.length){e.n=2;break}return e.a(2,{rpkBuffer:o});case 2:if(s=new m,u=[],c=Object.assign({},w),a.disableSubpackages&&"false"!==a.disableSubpackages){e.n=4;break}return h=i.map(function(e){return k(e,n)}),e.n=3,Promise.all(h).catch(function(){new Error("ERROR: Rpk sign failed!")});case 3:e.v.forEach(function(e,t){t="".concat(i[t].pkgName);e.length,s.file(t,e),u.push({name:t,hash:_.getBufferSha256(e)})}),e.n=6;break;case 4:return l=i[0],e.n=5,k(l,n).catch(function(){new Error("ERROR: Rpk sign failed!")});case 5:h=e.v,f="".concat(l.pkgName),h.length,s.file(f,h),u.push({name:f,hash:_.getBufferSha256(h)});case 6:return f="".concat(t).concat(r.pkgName),s.file(f,o),u.push({name:f,hash:_.getBufferSha256(o)}),e.n=7,s.generateAsync(c);case 7:return d=e.v,e.n=8,_.signZipResource(d,u,n);case 8:return d=e.v,p=o,e.a(2,{rpksBuffer:d,rpkBuffer:p})}},e)}))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=p.readFileSync(n),e.n=1,_.signZipResource(r,[],t);case 1:return r=e.v,e.a(2,{apkBuffer:r})}},e)}))).apply(this,arguments)}function C(e,t,n,r){e.fileList.push({fileBuildPath:t,fileContentBuffer:n,fileContentDigest:r})}function A(e){var t,n,r,i,a,o,s,e=e.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/);if(e)return o=e[1],s=parseInt(o),2===o.length&&(50<=s&&s<100?s=1900+s:0<=s&&s<50&&(s=2e3+s)),o=parseInt(e[2])-1,t=parseInt(e[3]),n=parseInt(e[4]),r=parseInt(e[5]),i=parseInt(e[6]),a=0,""!==(e=e[7])&&(e=(e.substr(1)+"00").substr(0,3),a=parseInt(e)),Date.UTC(s,o,t,n,r,i,a);throw new Error("Your certificate is Invalid.")}function x(e,t,n){return O.apply(this,arguments)}function O(){return(O=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a,o,s,u,c=arguments;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(i={signOnline:null!=r,privateKey:n,onlineConfig:r},(a=3<c.length&&void 0!==c[3]?c[3]:{})&&a.dssHost&&a.dssKey)return e.n=1,f.generateCertificate(a);e.n=2;break;case 1:t=e.v,i.type="dss";case 2:return(a=new l.X509).readCertPEM(t.toString()),o=l.KEYUTIL.getPEM(a.getPublicKey()),s=Buffer.from(h.Base64.unarmor(t)),u=Buffer.alloc(s.length+4),e.a(2,(u.writeInt32LE(s.length,0),s.copy(u,4),i.cert={content:t,obj:{len:u.length,buffer:u},pemBuffer:Buffer.from(h.Base64.unarmor(o))},i))}},e)}))).apply(this,arguments)}function B(e){var t=new l.X509,e=(t.readCertPEM(e),t.getSignatureValueHex()),t=Buffer.from(e,"hex").toString("base64"),e=v.getBufferSha256(t);return Buffer.from(e).toString("hex")}function D(){return(D=_asyncToGenerator(_regenerator().m(function e(a){var o,s,u,c,l,h,f,d;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(a&&p.existsSync(a)){e.n=1;break}throw new Error("No rpk file : "+a);case 1:if(o=p.readFileSync(a),y.checkZipBuffer(o)){e.n=2;break}throw new Error("Get File Certificate Error!");case 2:if((s=y.parserZip(o,!0)).sections.sign.tag){e.n=3;break}throw new Error("No sign block!");case 3:if(u=v.getSignChunk(o,s.sections.sign),c=v.getCertBuffer(u)){e.n=4;break}throw new Error("Get Certificate error!");case 4:return l=u.data[0].value.data[0].signatures.data[0].buffer,h=[],t=o,i=r=void 0,n=(n=s).sections,r=Buffer.alloc(n.header.len+n.central.len+n.footer.len),i=0,t.copy(r,0,n.header.startIndex,n.header.startIndex+n.header.len),i+=n.header.len,t.copy(r,i,n.central.startIndex,n.central.startIndex+n.central.len),i+=n.central.len,t.copy(r,i,n.footer.startIndex,n.footer.startIndex+n.footer.len),r.writeInt32LE(n.header.len,r.length-6),f=r,e.n=5,x(c);case 5:return d=e.v,e.n=6,_.getSignData(f,h,d);case 6:d=e.v,g.createVerify("RSA-SHA256").update(d).verify(c,l)||(b.error("Failed to verify the signature"),process.exit(-1));case 7:return e.a(2)}var t,n,r,i},e)}))).apply(this,arguments)}t.exports={generatePkgDef:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=[],n={pkgName:a,fileList:[]},r={pkgName:"base".concat(i),fileList:[]};return e.forEach(function(e){e=e.resource;t.push({pkgName:"".concat(e).concat(i),fileList:[],root:e})}),{mainPkg:n,subPkgs:e.length?[r].concat(t):[]}},addResourceToPkg:function(e,t,a,o){e.forEach(function(n){var r,e=p.readFileSync(s.join(t,n)),i=[n,e,_.getBufferSha256(e)];C.apply(void 0,[a].concat(i)),o.length&&(r=!0,o.slice(1).forEach(function(e){var t=n.split("/");t[0]===e.root&&(i[0]=t.slice(1).join("/"),C.apply(void 0,[e].concat(i)),r=!1)}),r)&&C.apply(void 0,[o[0]].concat(i))})},signPkgs:function(e,t,n,r,i){return S.apply(this,arguments)},DIGEST_PATH:u,getResources:function(e){return function n(r,i){var a=[],o=s.posix.join(r,i);return p.readdirSync(o).forEach(function(e){var t=s.posix.join(o,e),e=s.posix.join(i,e);p.statSync(t).isFile()?a.push(e):a=a.concat(n(r,e))}),a}(e,".").filter(function(e){return e!==u})},checkValidity:function(e){(t=new l.X509).readCertPEM(String(e));var e=A(t.getNotAfter()),t=A(t.getNotBefore()),n=Number(new Date);return{validityDays:Number(e-n)/864e5,isInvalid:0<Number(t)-n}},getSignInfo:x,getApkSignInfo:function(e){var t={signOnline:!1,onlineConfig:null},n=((n=new l.X509).readCertPEM(e.toString()),l.KEYUTIL.getPEM(n.getPublicKey())),r=Buffer.from(h.Base64.unarmor(e)),i=Buffer.alloc(r.length+4);return i.writeInt32LE(r.length,0),r.copy(i,4),t.cert={content:e,obj:{len:i.length,buffer:i},pemBuffer:Buffer.from(h.Base64.unarmor(n))},t},getSignedZipCertFp:function(e){return D.apply(this,arguments)},getCertFp:function(e){if(p.existsSync(e))return B(p.readFileSync(e).toString());console.error("error : certificate.pem is not exist!")},signFullApk:function(e,t){return E.apply(this,arguments)},getCertString:function(e){if(!e||!p.existsSync(e))throw new Error("No srpk file : "+e);if(e=p.readFileSync(e),!y.checkZipBuffer(e))throw new Error("Get File Certificate Error!");var t=y.parserZip(e,!0);if(!t.sections.sign.tag)throw new Error("No sign block!");if(e=v.getSignChunk(e,t.sections.sign),t=v.getCertBuffer(e))return B(t);throw new Error("Get Certificate error!")}}}),he=Lt(function(e,t){var h=require("path"),f=require("fs"),n=require("json5"),r=require("rimraf"),i=require("adm-zip"),a="src/main/resources/rawfile",o=(0,require("@atomicservice/ascf-base").getLogger)("utils"),s=require("child_process"),u=s.exec,c=s.spawnSync,d=Qt().RPKS;function l(e){var t,n=h.resolve(e,"build-profile.json5");if(!f.existsSync(n))return h.join(e,"entry");n=p(n);if(0<(null==n||null==(t=n.modules)?void 0:t.length))return h.join(e,n.modules[0].srcPath);throw new Error("getEntryPkgPath error, build-profile.json5 file modules is null")}function p(t){if(!f.existsSync(t))return{};var e={};try{e=n.parse(f.readFileSync(t,"utf-8").toString()||"{}")}catch(e){throw new Error("parse json file error at ".concat(t,":").concat(e.lineNumber,":").concat(e.columnNumber," "))}return e}var g=function(e){return Promise.all(e.map(function(t){if(f.existsSync(t))return new Promise(function(e){r.sync(t),e()})}))};function m(){return(m=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o,s,u,c,l;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:e.p=0,_(t,n),r=f.readdirSync(n,{withFileTypes:!0}),i=[],a=_createForOfIteratorHelper(r);try{for(a.s();!(o=a.n()).done;)s=o.value,u=h.resolve(h.join(n,s.name)),c="",c=s.name==="base".concat(d)?(_(u,n),h.resolve(h.join(n,"META-INF"))):(l=s.name.split(".")[0],_(u,h.resolve(n,l)),h.resolve(h.resolve(n,l,"META-INF"))),i.push(c),f.unlinkSync(u)}catch(e){a.e(e)}finally{a.f()}return e.n=1,g(i);case 1:e.n=3;break;case 2:throw e.p=2,e.v;case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function _(e,t){try{new i(e).extractAllTo(t,!0)}catch(e){o.error("adm-zip extraction failed. error: ",e)}}t.exports={RAWFILE_DIR:a,ASCF_BUILD:"ascf/ascf_build",ASCF_CONFIG_JSON:"ascf/ascf_src/ascf.config.json",P12_PATH:"sign/ascf-build.p12",QUICK_SERVICE_BUILD:"build/quick_service_build",DIST_PATH:"build/dist",getManifestData:function(e){return p(h.resolve(l(e),a,"manifest.json"))},getEntryPkgPath:l,readJsonFile:p,clearResource:g,copyDirectory:function e(t,n){var r;if(f.mkdirSync(n,{recursive:!0}),f.statSync(t).isFile())r=h.join(n,h.basename(t)),f.copyFileSync(t,r);else{var i,a=_createForOfIteratorHelper(f.readdirSync(t,{withFileTypes:!0}));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=h.resolve(h.join(t,o.name)),u=h.join(n,o.name);o.isDirectory()?e(s,u):f.copyFileSync(s,u)}}catch(e){a.e(e)}finally{a.f()}}},mkdirsSync:function e(t){if(!f.existsSync(t)){if(f.existsSync(h.dirname(t))||!e(h.dirname(t)))return f.mkdirSync(t);print("mkdirSync err : ".concat(t))}},formatHexString:function(e){if(64!==e.length)throw new Error("指纹格式错误");for(var t="",n=0;n<e.length;n+=2)t+=e.substr(n,2)+":";return t.slice(0,-1).toUpperCase()},extractspk:function(e,t){return m.apply(this,arguments)},deleteDirectory:function t(n){f.existsSync(n)&&(f.readdirSync(n).forEach(function(e){e=h.join(n,e),f.lstatSync(e).isDirectory()?t(e):f.unlinkSync(e)}),f.rmdirSync(n))},executeCommand:function(i){var a=/^mac verified ok/i;return new Promise(function(t,n){var e,r=u(i);null!=(e=r.stdout)&&e.on("data",function(e){o.debug(e)}),null!=(e=r.stderr)&&e.on("data",function(e){!e.match(a)&&i.includes("pkcs12")&&n(e)}),null!=(e=r.stderr)&&e.on("error",function(e){n(e)}),r.on("close",function(e){t(e)})})},checkOpenSSL:function(e){if(0===(e=c(e,["version"],{encoding:"utf-8"})).status)return o.debug(e.stdout),!0;throw new Error("Please install openssl or configure PATH."+e.stderr)},validatePassword:function(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return!(t.length<8)&&(e=0,/[a-z]/.test(t)&&e++,/[A-Z]/.test(t)&&e++,/[0-9]/.test(t)&&e++,/[`~!@#$%^&*()\-_=+\\|[{}];:'",<.>\/?]/.test(t)&&e++,2<=e)},extractZip:_}}),hr=Lt(function(e,t){var r=require("path"),n=require("os"),i=he().checkOpenSSL,a=n.platform(),n=require("@atomicservice/ascf-base"),o=n.getLogger,s=n.installAscfTools,u=o("openssl"),c=!1;function l(){return(l=_asyncToGenerator(_regenerator().m(function e(){var t,n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(t="openssl","win32"===a)return e.n=1,s();e.n=2;break;case 1:n=e.v,t=r.join(n,"/lib/tools/release_64/bin/openssl.exe");case 2:return e.a(2,(c||(u.debug(t),c=i(t)),t))}},e)}))).apply(this,arguments)}function h(){return(h=_asyncToGenerator(_regenerator().m(function e(){var t,n;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(t="","win32"===a)return e.n=1,s();e.n=2;break;case 1:n=e.v,t="-config ".concat(r.join(n,"/lib/tools/release_64/SSL/openssl.cnf"));case 2:return e.a(2,t)}},e)}))).apply(this,arguments)}t.exports={getOpensslPath:function(){return l.apply(this,arguments)},getOpensslConfig:function(){return h.apply(this,arguments)}}}),ni=Lt(function(z,e){var f,l=require("crypto"),d=require("path"),p=require("fs"),u=Pe().jszip,g=Ce(),t=require("@atomicservice/ascf-base").getLogger,n=he(),m=n.RAWFILE_DIR,N=n.ASCF_BUILD,L=n.clearResource,_=n.copyDirectory,j=n.getEntryPkgPath,H=n.getManifestData,U=n.readJsonFile,y=n.ASCF_CONFIG_JSON,c=n.P12_PATH,M=n.QUICK_SERVICE_BUILD,W=n.DIST_PATH,h=n.executeCommand,v=hr().getOpensslPath,n=Qt(),s=n.RPKS,q=n.RPK,b=n.SRPK,w=t("generate-spk"),k=100,G=1e4,Z=0;function S(){return r.apply(this,arguments)}function r(){return(r=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=d.resolve(t,y),e.n=1,function(){return A.apply(this,arguments)}(n,t,r);case 1:return i=e.v,e.n=2,function(){return o.apply(this,arguments)}(n,t,r);case 2:return a=e.v,e.a(2,g.getSignInfo(a,i,f))}},e)}))).apply(this,arguments)}function E(){return(E=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(r=null==(r=JSON.parse(p.readFileSync(t).toString()))?void 0:r.signConfig,p.existsSync(null==r?void 0:r.publicKeyPath))return e.a(2,(w.debug("Obtain the public key from the ascf.config.json publicKeyPath"),p.readFileSync(r.publicKeyPath)));e.n=1;break;case 1:if(p.existsSync(null==r?void 0:r.profilePath))return w.debug("Obtain the public key from the ascf.config.json profilePath"),e.n=2,R(r.profilePath,F(n.signPwd));e.n=3;break;case 2:return e.a(2,e.v);case 3:return e.a(2)}},e)}))).apply(this,arguments)}function o(){return(o=_asyncToGenerator(_regenerator().m(function e(r,i,a){var o,s;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(o="",p.existsSync(r.signPublicKeyPath)&&(w.debug("Obtaining a public Key using a Path"),o=p.readFileSync(r.signPublicKeyPath)),!o&&p.existsSync(r.signProfilePath))return w.debug("Obtain the private key using the p12 file path specified by the parameter"),e.n=1,R(r.signProfilePath,F(r.signPwd));e.n=2;break;case 1:o=e.v;case 2:if(!o&&p.existsSync(a))return e.n=3,function(){return E.apply(this,arguments)}(a,r);e.n=4;break;case 3:o=e.v;case 4:if(s=d.resolve(i,"sign/certificate.pem"),!o&&p.existsSync(s)&&(w.debug("Obtaining the public key using ".concat(s)),o=p.readFileSync(s)),s=d.resolve(i,c),!o&&p.existsSync(s))return w.debug("Obtaining the public Key Using the .p12 File"),e.n=5,R(s,F(r.signPwd));e.n=6;break;case 5:o=e.v;case 6:o||(w.error("failed to obtain the public key, please ensure certificate.pem or ascf-build.p12 under sign"),process.exit(-1)),n=t=void 0;var t=o,n=(t=g.checkValidity(t)).validityDays,t=t.isInvalid;if(n<0||t)throw new Error("ERROR: Your certificate is Invalid.");return n<180&&w.warn("WARNING: Your certificate is valid for less than 180 days. Please update it in time."),e.a(2,o)}},e)}))).apply(this,arguments)}function C(){return(C=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(r=null==(r=JSON.parse(p.readFileSync(t).toString()))?void 0:r.signConfig,p.existsSync(null==r?void 0:r.privateKeyPath))return e.a(2,(w.debug("Obtain the private key from the ascf.config.json privateKeyPath"),p.readFileSync(r.privateKeyPath)));e.n=1;break;case 1:if(p.existsSync(null==r?void 0:r.profilePath))return w.debug("Obtain the private key from the ascf.config.json profilePath"),e.n=2,P(r.profilePath,F(n.signPwd));e.n=3;break;case 2:return e.a(2,e.v);case 3:return e.a(2)}},e)}))).apply(this,arguments)}function A(){return(A=_asyncToGenerator(_regenerator().m(function e(t,n,r){var i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(i="",p.existsSync(t.signPrivateKeyPath)&&(w.debug("Obtaining a private Key using a Path"),i=p.readFileSync(t.signPrivateKeyPath)),!i&&p.existsSync(t.signProfilePath))return w.debug("Obtain the private key using the p12 file path specified by the parameter"),e.n=1,P(t.signProfilePath,F(t.signPwd));e.n=2;break;case 1:i=e.v;case 2:if(!i&&p.existsSync(r))return e.n=3,function(){return C.apply(this,arguments)}(r,t);e.n=4;break;case 3:i=e.v;case 4:if(a=d.resolve(n,"sign/private.pem"),!i&&p.existsSync(a)&&(w.debug("Obtaining the private key using ".concat(a)),i=p.readFileSync(a)),a=d.resolve(n,c),!i&&p.existsSync(a))return w.debug("Obtaining the private Key Using the p12 File"),e.n=5,P(a,F(t.signPwd));e.n=6;break;case 5:i=e.v;case 6:return i||(w.error("failed to obtain the private key, please ensure private.pem or ascf-build.p12 under sign"),process.exit(-1)),e.a(2,i)}},e)}))).apply(this,arguments)}function a(){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regenerator().m(function e(n,r,i,a){var o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(i.length>k&&(i=i.slice(0,k)),n){e.n=1;break}return e.a(2);case 1:if(o=d.join(r,i),p.writeFileSync(o,n),w.info("Build spk ".concat(o)),"release"===a)return e.n=2,((t=o).endsWith(s)?e=>{var t=Qt(),o=t.MAX_SIZE_SSPK,s=t.MAX_SIZE_SPK;return new Promise(function(i,a){p.readFile(e,function(e,t){if(e)return a(e);u.loadAsync(t).then(function(e){var n=null,r=0;return e.forEach(function(e,t){if(G<++Z)throw"Reached max. number of files";!n&&e.endsWith(b)&&t._data.compressedSize>o&&(n=new Error("Subpackage is exceed limit ".concat(o/1024/1024," MB."))),e.endsWith(b)&&(r+=t._data.compressedSize)}),n?a(n):s<r?a("The total of srpk packages exceeds the limit ".concat(s/1024/1024," MB.")):void i()})})})}:e=>{var t=Qt().MAX_SIZE_SPK;if(p.statSync(e).size>t)throw new Error("Total package is exceed limit ".concat(t/1024/1024," MB."))})(t);e.n=2;break;case 2:return e.a(2,o)}var t},e)}))).apply(this,arguments)}function x(){return O.apply(this,arguments)}function O(){return(O=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return p.existsSync(t)||p.mkdirSync(t),e.n=1,a(r.rpksBuffer,t,i+s,n);case 1:return e.n=2,a(r.rpkBuffer,t,i+q,n);case 2:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function B(e){if(!e.package||!e.package.startsWith("com.atomicservice."))throw new Error("The package in the app.json file cannot be empty and must start with com.atomicservice.");if(!e.versionName||!e.versionCode)throw new Error("The versionName and versionCode fields in the app.json file cannot be empty.")}function D(e){var t=(new Date).toISOString().split("T")[0].split("-").join(""),n="production"===process.env.NODE_ENV?"release":"debug";return"".concat(e.package,"-").concat(e.versionCode,"-").concat(n,"-").concat(t)}function I(){return(I=_asyncToGenerator(_regenerator().m(function e(n,t){var r,i,a,o,s,u,c,l,h;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(r=d.join(n,y),(f=(p.existsSync(r)?require(r):{}).sign)&&!f.host)throw new Error("ERROR: The signature configuration file is incorrect, the hostvalue is empty.");e.n=1;break;case 1:return e.n=2,S(n,t);case 2:if(i=e.v){e.n=3;break}throw new Error("ERROR: Failed to obtain the signature configuration information.");case 3:return a=d.resolve(n,W),o=d.resolve(n,M),e.n=4,L([o]);case 4:if(B(s=H(n)),u=D(s),null!=(r=s.subpackages)&&r.forEach(function(e){var t=d.resolve(n,N,e.resource,m);_(t,d.resolve(o,e.resource))}),_(d.resolve(j(n),m),o),l=g.generatePkgDef(s.subpackages),c=l.mainPkg,l=l.subPkgs,(h=0<(h=[]).length?h:g.getResources(o)).length){e.n=5;break}throw new Error("The packed file is empty.");case 5:return g.addResourceToPkg(h,o,c,l),e.n=6,g.signPkgs(u,i,c,l,t).then((()=>{var t=_asyncToGenerator(_regenerator().m(function e(t){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x(a,s.versionType,t,u);case 1:return e.a(2,e.v)}},e)}));return function(e){return t.apply(this,arguments)}})());case 6:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function T(){return(T=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a,o,s,u,c,l,h;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return a={signPrivateKeyPath:r,signPublicKeyPath:n,disableSubpackages:!1},e.n=1,S("",a);case 1:if(o=e.v,l=d.resolve(t,"manifest.json"),s=U(l),u=D(s),B(s),l=g.generatePkgDef(s.subpackages),c=l.mainPkg,l=l.subPkgs,(h=0<(h=[]).length?h:g.getResources(t)).length){e.n=2;break}throw new Error("The packed file is empty.");case 2:g.addResourceToPkg(h,t,c,l),i=null!=i?i:d.resolve(t,"dist"),g.signPkgs(u,o,c,l,a).then((()=>{var t=_asyncToGenerator(_regenerator().m(function e(t){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x(i,s.versionType,t,u);case 1:return e.a(2,e.v)}},e)}));return function(e){return t.apply(this,arguments)}})());case 3:return e.a(2)}},e)}))).apply(this,arguments)}function F(e){e=null!=e?e:process.env.ASCF_SIGN_PWD;return e||(w.error("signPwd is null, please configure through cli options, ascf.config.json or env ASCF_SIGN_PWD"),process.exit(-1)),e}function P(u,c){return new Promise((n=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o,s;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return w.debug("Start to obtain the private key"),r=l.randomBytes(16).toString("hex"),i=l.randomBytes(16).toString("hex"),e.p=1,e.n=2,v();case 2:return a=e.v,o="".concat(a," pkcs12 -in ").concat(u," -nocerts -nodes -out ").concat(r," -passin pass:").concat(c),w.debug("".concat(a," pkcs12 -in ").concat(u," -nocerts -nodes -out ").concat(r," -passin pass:***")),e.n=3,h(o);case 3:return o="".concat(a," ec -in ").concat(r," -check -out ").concat(i),w.debug("".concat(a," ec -in ").concat(r," -check -out ").concat(i)),e.n=4,h(o);case 4:return p.existsSync(r)&&p.unlinkSync(r),s="",e.a(2,(p.existsSync(i)&&(s=p.readFileSync(i),p.unlinkSync(i)),w.debug("Obtaining the private key is complete."),t(s)));case 5:e.p=5,s=e.v,p.existsSync(r)&&p.unlinkSync(r),p.existsSync(i)&&p.unlinkSync(i),n("Failed to obtain the private key: ".concat(s));case 6:return e.a(2)}},e,null,[[1,5]])})),function(e,t){return n.apply(this,arguments)}));var n}function R(o,s){return new Promise((n=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=l.randomBytes(16).toString("hex"),e.p=1,e.n=2,v();case 2:return i=e.v,a="".concat(i," pkcs12 -in ").concat(o," -nokeys -clcerts -passin pass:").concat(s," | ").concat(i," x509 -out ").concat(r),w.debug("".concat(i," pkcs12 -in ").concat(o," -nokeys -clcerts -passin pass:*** | ").concat(i," x509 -out ").concat(r)),e.n=3,h(a);case 3:if(p.existsSync(r))return i=p.readFileSync(r),e.a(2,(p.unlinkSync(r),t(i)));e.n=4;break;case 4:e.n=6;break;case 5:e.p=5,a=e.v,p.existsSync(r)&&p.unlinkSync(r),n("Failed to obtain the cert key: ".concat(a));case 6:return e.a(2)}},e,null,[[1,5]])})),function(e,t){return n.apply(this,arguments)}));var n}e.exports={signSpk:function(e,t){return I.apply(this,arguments)},resignSpk:function(e,t,n,r){return T.apply(this,arguments)}}}),ai=Lt(function(e,t){require("path");var s=require("fs"),n=require("@atomicservice/ascf-base").getLogger,r=he(),u=r.executeCommand,c=r.validatePassword,r=hr(),l=r.getOpensslPath,h=r.getOpensslConfig,f=n("cert-utils");function i(){return(i=_asyncToGenerator(_regenerator().m(function e(t,n){var r,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(s.existsSync(t)||s.existsSync(n))throw new Error("".concat(t," or ").concat(n," exists"));e.n=1;break;case 1:return e.p=1,e.n=2,l();case 2:return r=e.v,e.n=3,h();case 3:return i=e.v,a="".concat(r," ecparam -name secp256r1 -genkey -noout -out ").concat(t),f.debug(a),e.n=4,u(a);case 4:return a="".concat(r," req -new -x509 -key ").concat(t," -out ").concat(n,' -days 3650 -sha256 -subj "/CN=ASCF/OU=/O=/L=/ST=/C=CN" ').concat(i),f.debug(a),e.n=5,u(a);case 5:e.n=7;break;case 6:e.p=6,o=e.v,f.error("Failed to generate cert",o),s.existsSync(t)&&s.unlinkSync(t),s.existsSync(n)&&s.unlinkSync(n);case 7:return e.a(2)}},e,null,[[1,6]])}))).apply(this,arguments)}function a(){return(a=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a,o;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c(i)){e.n=1;break}throw new Error("Invalid Password.\nThe password must contain at least 8 characters and include any two of the following:\n1. Lowercase letters: a-z\n2. Uppercase letters : A-Z\n3. Digits : 0-9\n4. Special characters : `~!@#$%^&*()-_=+\\|[{}];:'\",<.>/?");case 1:if(s.existsSync(t))throw new Error("".concat(t," exists"));e.n=2;break;case 2:return e.p=2,e.n=3,l();case 3:return o=e.v,a="".concat(o," pkcs12 -export -out ").concat(t," -inkey ").concat(n," -in ").concat(r," -passout pass:").concat(i),f.debug("".concat(o," pkcs12 -export -out ").concat(t," -inkey ").concat(n," -in ").concat(r," -passout pass:***")),e.n=4,u(a);case 4:e.n=6;break;case 5:e.p=5,o=e.v,f.error("Failed to generate p12",o),s.existsSync(t)&&s.unlinkSync(t);case 6:return e.a(2)}},e,null,[[2,5]])}))).apply(this,arguments)}t.exports={genCert:function(e,t){return i.apply(this,arguments)},genP12:function(e,t,n,r){return a.apply(this,arguments)}}}),li=Lt(function(e){var r=require("path"),i=Ce().getSignedZipCertFp,t=he(),a=t.clearResource,o=t.deleteDirectory,s=t.extractZip;function n(){return(n=_asyncToGenerator(_regenerator().m(function e(t,n){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=null!=n?n:r.resolve(r.dirname(t),"dist"),e.n=1,i(t);case 1:return e.n=2,a([n]);case 2:s(t,n),o(r.resolve(n,"META-INF"));case 3:return e.a(2)}},e)}))).apply(this,arguments)}e.verifySignHandler=function(e,t){return n.apply(this,arguments)}}),fi=Lt(function(e,t){var m=require("fs"),_=require("path"),i=Pe().jszip,n=he(),y=n.mkdirsSync,f=n.extractspk,d=n.clearResource,v=Ce(),n=Qt(),a=n.RPKS,b=n.RPK,o="manifest.json",w="";function p(){return(p=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a,o,s,u,c,l,h,f,d,p,g;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return y(n),a=t.package,o=t.versionType,s=t.versionCode,d=i.privateKeyFilePath,c=i.certFilePath,c=m.readFileSync(c),d=m.readFileSync(d),e.n=1,v.getSignInfo(c,d);case 1:if(u=e.v,c=v.generatePkgDef(t.subpackages),l=c.mainPkg,h=c.subPkgs,(f=0<(f=[]).length?f:v.getResources(r)).length){e.n=2;break}throw new Error("The packed file is empty.");case 2:return v.addResourceToPkg(f,r,l,h),e.n=3,v.signPkgs(a,u,l,h,{disableSubpackages:!1});case 3:d=e.v,p=d.rpksBuffer,g=(new Date).toISOString().split("T")[0].split("-").join(""),w=_.join(n,"".concat(a,"-").concat(s,"-").concat(o,"-").concat(g).concat(b)),m.writeFileSync(w,p);case 4:return e.a(2)}},e)}))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(_regenerator().m(function e(t){var n,r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,(new i).loadAsync(m.readFileSync(t));case 1:if((n=e.v).files["base".concat(a)]){e.n=2;break}throw new Error("Can not resolve base".concat(a," file."));case 2:return e.n=3,n.files["base".concat(a)].async("nodebuffer");case 3:return r=e.v,e.n=4,(new i).loadAsync(r);case 4:return e.n=5,e.v.file(o).async("string");case 5:return r=e.v,e.a(2,JSON.parse(r)||{})}},e)}))).apply(this,arguments)}t.exports={spkHandler:function(s,u,c,l,h){return new Promise((n=_asyncToGenerator(_regenerator().m(function e(n,r){var i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(m.existsSync(s)){e.n=1;break}return e.a(2,r(new Error("Can not resolve spk file: ".concat(s))));case 1:if(m.existsSync(u)){e.n=2;break}return e.a(2,r(new Error("Can not resolve certificate file: ".concat(u))));case 2:if(m.existsSync(c)){e.n=3;break}return e.a(2,r(new Error("Can not resolve private key file: ".concat(c))));case 3:return e.n=4,function(){return g.apply(this,arguments)}(s);case 4:if(i=e.v,t=i,0===Object.keys(t).length)return e.a(2,r(new Error("Invalid spk file.")));e.n=5;break;case 5:return a=i.package,o=_.dirname(s),o=_.join(o,a),a=_.join(null!=l?l:o,"quick-service-build"),o=_.join(null!=l?l:o,"dist"),e.n=6,d([a,o]);case 6:return y(a),e.n=7,f(s,a);case 7:return i.versionType=null!=h?h:i.versionType,m.writeFileSync(_.resolve(a,"manifest.json"),JSON.stringify(i,null,2)),e.n=8,function(){return p.apply(this,arguments)}(i,o,a,{privateKeyFilePath:c,certFilePath:u});case 8:return e.a(2,n(w))}var t},e)})),function(e,t){return n.apply(this,arguments)}));var n}}}),_ni=ni(),wo=_ni.signSpk,ko=_ni.resignSpk,_ai=ai(),So=_ai.genCert,Eo=_ai.genP12,_he6=he(),Co=_he6.formatHexString,_li=li(),xo=_li.verifySignHandler,_require9=require("@atomicservice/ascf-base"),Ao=_require9.getLogger,_fi=fi(),Do=_fi.spkHandler,_Ce2=Ce(),Bo=_Ce2.getCertString,Rt=Ao("index");function Oo(e,t){return _Oo.apply(this,arguments)}function _Oo(){return(_Oo=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec sign spk"),e.n=1,wo(t,n);case 1:return r=e.v,e.a(2,(Rt.info("Signed successfully."),r));case 2:e.p=2,r=e.v,Rt.fatal("Signing failed: "+r),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function Io(e,t,n,r){return _Io.apply(this,arguments)}function _Io(){return(_Io=_asyncToGenerator(_regenerator().m(function e(t,n,r,i){var a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec resign spk"),e.n=1,ko(t,n,r,i);case 1:Rt.info("Signed successfully."),e.n=3;break;case 2:e.p=2,a=e.v,Rt.fatal("Signing failed: "+a),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function Fo(e,t){return _Fo.apply(this,arguments)}function _Fo(){return(_Fo=_asyncToGenerator(_regenerator().m(function e(t,n){var r;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec verify sign"),e.n=1,xo(t,n);case 1:Rt.info("Signature verification succeeded."),e.n=3;break;case 2:e.p=2,r=e.v,Rt.info("Failed to verify the signature: ",r),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function To(e,t,n,r,i){return _To.apply(this,arguments)}function _To(){return(_To=_asyncToGenerator(_regenerator().m(function e(t,n,r,i,a){var o;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,Rt.info("start exec repack"),e.n=1,Do(t,n,r,i,a);case 1:o=e.v,Rt.info("exec repack success, repack package path: "+o),e.n=3;break;case 2:e.p=2,o=e.v,Rt.fatal("repack failed: "+o),process.exit(-1);case 3:return e.a(2)}},e,null,[[0,2]])}))).apply(this,arguments)}function Ro(e){try{Rt.info("start exec print fingerprints");var t=Bo(e),n=Co(t);Rt.info("exec print fingerprints success, fingerprints info: "+n)}catch(e){Rt.fatal("failed to obtain the fingerprint: "+e),process.exit(-1)}}process.on("uncaughtException",function(e){Rt.error("ASCF uncaught error",e)}),process.on("unhandledRejection",function(e,t){Rt.error("ASCF unhandled rejection at:",t,"reason:",e)}),module.exports={signPkg:Oo,resignPkg:Io,verifySign:Fo,repackHandler:To,printFp:Ro,genCert:So,genP12:Eo};