@allthings/sdk 6.2.0-6 → 6.2.0-7

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.
@@ -40,4 +40,4 @@
40
40
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
41
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
42
  PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __rest$6(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function __decorate(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function __param(e,t){return function(n,r){t(n,r,e)}}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function __generator(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function __createBinding(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function __exportStar(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{!function(e){e.value instanceof __await?Promise.resolve(e.value.v).then(c,u):l(o[0][2],e)}(i[e](t))}catch(e){l(o[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function __asyncDelegator(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:__await(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function __asyncValues(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function __classPrivateFieldSet(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var tslib_es6=Object.freeze({__proto__:null,get __assign(){return __assign},__asyncDelegator:__asyncDelegator,__asyncGenerator:__asyncGenerator,__asyncValues:__asyncValues,__await:__await,__awaiter:__awaiter,__classPrivateFieldGet:__classPrivateFieldGet,__classPrivateFieldSet:__classPrivateFieldSet,__createBinding:__createBinding,__decorate:__decorate,__exportStar:__exportStar,__extends:__extends,__generator:__generator,__importDefault:__importDefault,__importStar:__importStar,__makeTemplateObject:__makeTemplateObject,__metadata:__metadata,__param:__param,__read:__read,__rest:__rest$6,__spread:__spread,__spreadArrays:__spreadArrays,__values:__values}),require$$0$1=getAugmentedNamespace(tslib_es6),CryptoOperation={},hasRequiredCryptoOperation;function requireCryptoOperation(){return hasRequiredCryptoOperation||(hasRequiredCryptoOperation=1,Object.defineProperty(CryptoOperation,"__esModule",{value:!0})),CryptoOperation}var Key={},hasRequiredKey;function requireKey(){return hasRequiredKey||(hasRequiredKey=1,Object.defineProperty(Key,"__esModule",{value:!0})),Key}var KeyOperation={},hasRequiredKeyOperation;function requireKeyOperation(){return hasRequiredKeyOperation||(hasRequiredKeyOperation=1,Object.defineProperty(KeyOperation,"__esModule",{value:!0})),KeyOperation}var MsSubtleCrypto={},hasRequiredMsSubtleCrypto;function requireMsSubtleCrypto(){return hasRequiredMsSubtleCrypto||(hasRequiredMsSubtleCrypto=1,Object.defineProperty(MsSubtleCrypto,"__esModule",{value:!0})),MsSubtleCrypto}var MsWindow={},hasRequiredMsWindow,hasRequiredBuild,hasRequiredCrossPlatformSha256;function requireMsWindow(){if(hasRequiredMsWindow)return MsWindow;hasRequiredMsWindow=1,Object.defineProperty(MsWindow,"__esModule",{value:!0}),MsWindow.isMsWindow=void 0;var e=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];return MsWindow.isMsWindow=function(t){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(t)&&void 0!==t.msCrypto.subtle){var n=t.msCrypto,r=n.getRandomValues,i=n.subtle;return e.map((function(e){return i[e]})).concat(r).every((function(e){return"function"==typeof e}))}return!1},MsWindow}function requireBuild(){return hasRequiredBuild||(hasRequiredBuild=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=require$$0$1;t.__exportStar(requireCryptoOperation(),e),t.__exportStar(requireKey(),e),t.__exportStar(requireKeyOperation(),e),t.__exportStar(requireMsSubtleCrypto(),e),t.__exportStar(requireMsWindow(),e)}(build)),build}function requireCrossPlatformSha256(){if(hasRequiredCrossPlatformSha256)return crossPlatformSha256;hasRequiredCrossPlatformSha256=1,Object.defineProperty(crossPlatformSha256,"__esModule",{value:!0}),crossPlatformSha256.Sha256=void 0;var e=requireIe11Sha256(),t=requireWebCryptoSha256(),n=requireBuild$2(),r=requireBuild$1(),i=requireBuild(),o=require$$5,s=requireBuild$3(),a=function(){function a(s){(0,r.supportsWebCrypto)((0,o.locateWindow)())?this.hash=new t.Sha256(s):(0,i.isMsWindow)((0,o.locateWindow)())?this.hash=new e.Sha256(s):this.hash=new n.Sha256(s)}return a.prototype.update=function(e,t){this.hash.update((0,s.convertToBuffer)(e))},a.prototype.digest=function(){return this.hash.digest()},a.prototype.reset=function(){this.hash.reset()},a}();return crossPlatformSha256.Sha256=a,crossPlatformSha256}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebCryptoSha256=e.Ie11Sha256=void 0,require$$0$5.__exportStar(requireCrossPlatformSha256(),e);var t=requireIe11Sha256();Object.defineProperty(e,"Ie11Sha256",{enumerable:!0,get:function(){return t.Sha256}});var n=requireWebCryptoSha256();Object.defineProperty(e,"WebCryptoSha256",{enumerable:!0,get:function(){return n.Sha256}})}(build$4);var es5={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,c=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(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,r.key,r)}}var a=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(t.prototype,n),r&&s(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),c=a.default.find(s,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}}if(o>0){var p=Object.keys(i),m=a.default.find(p,(function(e){return t.isBrowser(e,!0)}));if(void 0!==m)return this.compareVersion(i[m])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})}(es5);var es5Exports=es5.exports,bowser=getDefaultExportFromCjs(es5Exports);const defaultUserAgent=({serviceId:e,clientVersion:t})=>async()=>{const n="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,r=[["aws-sdk-js",t],["ua","2.0"],[`os/${n?.os?.name||"other"}`,n?.os?.version],["lang/js"],["md/browser",`${n?.browser?.name??"unknown"}_${n?.browser?.version??"unknown"}`]];return e&&r.push([`api/${e}`,t]),r},invalidProvider=e=>()=>Promise.reject(e),TEXT_ENCODER="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=e=>{if("string"==typeof e){if(TEXT_ENCODER)return TEXT_ENCODER.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},u="required",v="fn",w="argv",x="ref",a=!0,b="isSet",c="booleanEquals",d="error",e="endpoint",f="tree",g="PartitionResult",h="getAttr",i={[u]:!1,type:"String"},j={[u]:!0,default:!1,type:"Boolean"},k={[x]:"Endpoint"},l={[v]:c,[w]:[{[x]:"UseFIPS"},!0]},m={[v]:c,[w]:[{[x]:"UseDualStack"},!0]},n={},o={[v]:h,[w]:[{[x]:g},"supportsFIPS"]},p={[x]:g},q={[v]:c,[w]:[!0,{[v]:h,[w]:[p,"supportsDualStack"]}]},r=[l],s=[m],t=[{[x]:"Region"}],_data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:b,[w]:[k]}],rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:k,properties:n,headers:n},type:e}],type:f},{conditions:[{[v]:b,[w]:t}],rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:g}],rules:[{conditions:[l,m],rules:[{conditions:[{[v]:c,[w]:[a,o]},q],rules:[{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:r,rules:[{conditions:[{[v]:c,[w]:[o,a]}],rules:[{conditions:[{[v]:"stringEquals",[w]:[{[v]:h,[w]:[p,"name"]},"aws-us-gov"]}],endpoint:{url:"https://ssm.{Region}.amazonaws.com",properties:n,headers:n},type:e},{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:s,rules:[{conditions:[q],rules:[{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]},ruleSet=_data,defaultEndpointResolver=(e,t={})=>resolveEndpoint(ruleSet,{endpointParams:e,logger:t.logger});customEndpointFunctions.aws=awsEndpointFunctions;const getRuntimeConfig$1=e=>({apiVersion:"2014-11-06",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSSMHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:e?.logger??new NoOpLogger,serviceId:e?.serviceId??"SSM",urlParser:e?.urlParser??parseUrl,utf8Decoder:e?.utf8Decoder??fromUtf8$3,utf8Encoder:e?.utf8Encoder??toUtf8$3}),memoize=(e,t,n)=>{let r,i,o,s=!1;return async t=>(o&&!t?.forceRefresh||(r=await(async()=>{i||(i=e());try{r=await i,o=!0,s=!1}finally{i=void 0}return r})()),r)},DEFAULTS_MODE_OPTIONS=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig=({defaultsMode:e}={})=>memoize((async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(isMobileBrowser()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${t}`)}})),isMobileBrowser=()=>{const e="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,t=e?.platform?.type;return"tablet"===t||"mobile"===t},getRuntimeConfig=e=>{const t=resolveDefaultsModeConfig(e),n=()=>t().then(loadConfigsForDefaultMode),r=getRuntimeConfig$1(e);return{...r,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??defaultUserAgent({serviceId:r.serviceId,clientVersion:packageInfo.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS,region:e?.region??invalidProvider("Region is missing"),requestHandler:FetchHttpHandler.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE),sha256:e?.sha256??build$4.Sha256,streamCollector:e?.streamCollector??streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))}},getAwsRegionExtensionConfiguration=e=>{let t=async()=>{if(void 0===e.region)throw new Error("Region is missing from runtimeConfig");const t=e.region;return"string"==typeof t?t:t()};return{setRegion(e){t=e},region:()=>t}},resolveAwsRegionExtensionConfiguration=e=>({region:e.region()}),getHttpAuthExtensionConfiguration=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}},resolveHttpAuthRuntimeConfig=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),asPartial=e=>e,resolveRuntimeExtensions=(e,t)=>{const n={...asPartial(getAwsRegionExtensionConfiguration(e)),...asPartial(getDefaultExtensionConfiguration(e)),...asPartial(getHttpHandlerExtensionConfiguration(e)),...asPartial(getHttpAuthExtensionConfiguration(e))};return t.forEach((e=>e.configure(n))),{...e,...resolveAwsRegionExtensionConfiguration(n),...resolveDefaultRuntimeConfig(n),...resolveHttpHandlerRuntimeConfig(n),...resolveHttpAuthRuntimeConfig(n)}};class SSMClient extends Client{constructor(...[e]){const t=getRuntimeConfig(e||{}),n=resolveClientEndpointParameters(t),r=resolveRegionConfig(n),i=resolveEndpointConfig(r),o=resolveUserAgentConfig(resolveHostHeaderConfig(resolveRetryConfig(i))),s=resolveHttpAuthSchemeConfig(o),a=resolveRuntimeExtensions(s,e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(getRetryPlugin(this.config)),this.middlewareStack.use(getContentLengthPlugin(this.config)),this.middlewareStack.use(getHostHeaderPlugin(this.config)),this.middlewareStack.use(getLoggerPlugin(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(getUserAgentPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:this.getDefaultHttpAuthSchemeParametersProvider(),identityProviderConfigProvider:this.getIdentityProviderConfigProvider()})),this.middlewareStack.use(getHttpSigningPlugin(this.config))}destroy(){super.destroy()}getDefaultHttpAuthSchemeParametersProvider(){return defaultSSMHttpAuthSchemeParametersProvider}getIdentityProviderConfigProvider(){return async e=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials})}}class SSMServiceException extends ServiceException{constructor(e){super(e),Object.setPrototypeOf(this,SSMServiceException.prototype)}}class InternalServerError extends SSMServiceException{constructor(e){super({name:"InternalServerError",$fault:"server",...e}),this.name="InternalServerError",this.$fault="server",Object.setPrototypeOf(this,InternalServerError.prototype),this.Message=e.Message}}class InvalidResourceId extends SSMServiceException{constructor(e){super({name:"InvalidResourceId",$fault:"client",...e}),this.name="InvalidResourceId",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceId.prototype)}}class InvalidResourceType extends SSMServiceException{constructor(e){super({name:"InvalidResourceType",$fault:"client",...e}),this.name="InvalidResourceType",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceType.prototype)}}class TooManyTagsError extends SSMServiceException{constructor(e){super({name:"TooManyTagsError",$fault:"client",...e}),this.name="TooManyTagsError",this.$fault="client",Object.setPrototypeOf(this,TooManyTagsError.prototype)}}class TooManyUpdates extends SSMServiceException{constructor(e){super({name:"TooManyUpdates",$fault:"client",...e}),this.name="TooManyUpdates",this.$fault="client",Object.setPrototypeOf(this,TooManyUpdates.prototype),this.Message=e.Message}}class AlreadyExistsException extends SSMServiceException{constructor(e){super({name:"AlreadyExistsException",$fault:"client",...e}),this.name="AlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,AlreadyExistsException.prototype),this.Message=e.Message}}class OpsItemConflictException extends SSMServiceException{constructor(e){super({name:"OpsItemConflictException",$fault:"client",...e}),this.name="OpsItemConflictException",this.$fault="client",Object.setPrototypeOf(this,OpsItemConflictException.prototype),this.Message=e.Message}}class OpsItemInvalidParameterException extends SSMServiceException{constructor(e){super({name:"OpsItemInvalidParameterException",$fault:"client",...e}),this.name="OpsItemInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,OpsItemInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class OpsItemLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsItemLimitExceededException",$fault:"client",...e}),this.name="OpsItemLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsItemLimitExceededException.prototype),this.ResourceTypes=e.ResourceTypes,this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class OpsItemNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemNotFoundException",$fault:"client",...e}),this.name="OpsItemNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemNotFoundException.prototype),this.Message=e.Message}}class OpsItemRelatedItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemRelatedItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAlreadyExistsException.prototype),this.Message=e.Message,this.ResourceUri=e.ResourceUri,this.OpsItemId=e.OpsItemId}}class DuplicateInstanceId extends SSMServiceException{constructor(e){super({name:"DuplicateInstanceId",$fault:"client",...e}),this.name="DuplicateInstanceId",this.$fault="client",Object.setPrototypeOf(this,DuplicateInstanceId.prototype)}}class InvalidCommandId extends SSMServiceException{constructor(e){super({name:"InvalidCommandId",$fault:"client",...e}),this.name="InvalidCommandId",this.$fault="client",Object.setPrototypeOf(this,InvalidCommandId.prototype)}}class InvalidInstanceId extends SSMServiceException{constructor(e){super({name:"InvalidInstanceId",$fault:"client",...e}),this.name="InvalidInstanceId",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceId.prototype),this.Message=e.Message}}class DoesNotExistException extends SSMServiceException{constructor(e){super({name:"DoesNotExistException",$fault:"client",...e}),this.name="DoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,DoesNotExistException.prototype),this.Message=e.Message}}class InvalidParameters extends SSMServiceException{constructor(e){super({name:"InvalidParameters",$fault:"client",...e}),this.name="InvalidParameters",this.$fault="client",Object.setPrototypeOf(this,InvalidParameters.prototype),this.Message=e.Message}}class AssociationAlreadyExists extends SSMServiceException{constructor(e){super({name:"AssociationAlreadyExists",$fault:"client",...e}),this.name="AssociationAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,AssociationAlreadyExists.prototype)}}class AssociationLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationLimitExceeded",$fault:"client",...e}),this.name="AssociationLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationLimitExceeded.prototype)}}class InvalidDocument extends SSMServiceException{constructor(e){super({name:"InvalidDocument",$fault:"client",...e}),this.name="InvalidDocument",this.$fault="client",Object.setPrototypeOf(this,InvalidDocument.prototype),this.Message=e.Message}}class InvalidDocumentVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentVersion",$fault:"client",...e}),this.name="InvalidDocumentVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentVersion.prototype),this.Message=e.Message}}class InvalidOutputLocation extends SSMServiceException{constructor(e){super({name:"InvalidOutputLocation",$fault:"client",...e}),this.name="InvalidOutputLocation",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputLocation.prototype)}}class InvalidSchedule extends SSMServiceException{constructor(e){super({name:"InvalidSchedule",$fault:"client",...e}),this.name="InvalidSchedule",this.$fault="client",Object.setPrototypeOf(this,InvalidSchedule.prototype),this.Message=e.Message}}class InvalidTag extends SSMServiceException{constructor(e){super({name:"InvalidTag",$fault:"client",...e}),this.name="InvalidTag",this.$fault="client",Object.setPrototypeOf(this,InvalidTag.prototype),this.Message=e.Message}}class InvalidTarget extends SSMServiceException{constructor(e){super({name:"InvalidTarget",$fault:"client",...e}),this.name="InvalidTarget",this.$fault="client",Object.setPrototypeOf(this,InvalidTarget.prototype),this.Message=e.Message}}class InvalidTargetMaps extends SSMServiceException{constructor(e){super({name:"InvalidTargetMaps",$fault:"client",...e}),this.name="InvalidTargetMaps",this.$fault="client",Object.setPrototypeOf(this,InvalidTargetMaps.prototype),this.Message=e.Message}}class UnsupportedPlatformType extends SSMServiceException{constructor(e){super({name:"UnsupportedPlatformType",$fault:"client",...e}),this.name="UnsupportedPlatformType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedPlatformType.prototype),this.Message=e.Message}}class DocumentAlreadyExists extends SSMServiceException{constructor(e){super({name:"DocumentAlreadyExists",$fault:"client",...e}),this.name="DocumentAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,DocumentAlreadyExists.prototype),this.Message=e.Message}}class DocumentLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentLimitExceeded",$fault:"client",...e}),this.name="DocumentLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentLimitExceeded.prototype),this.Message=e.Message}}class InvalidDocumentContent extends SSMServiceException{constructor(e){super({name:"InvalidDocumentContent",$fault:"client",...e}),this.name="InvalidDocumentContent",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentContent.prototype),this.Message=e.Message}}class InvalidDocumentSchemaVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentSchemaVersion",$fault:"client",...e}),this.name="InvalidDocumentSchemaVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentSchemaVersion.prototype),this.Message=e.Message}}class MaxDocumentSizeExceeded extends SSMServiceException{constructor(e){super({name:"MaxDocumentSizeExceeded",$fault:"client",...e}),this.name="MaxDocumentSizeExceeded",this.$fault="client",Object.setPrototypeOf(this,MaxDocumentSizeExceeded.prototype),this.Message=e.Message}}class IdempotentParameterMismatch extends SSMServiceException{constructor(e){super({name:"IdempotentParameterMismatch",$fault:"client",...e}),this.name="IdempotentParameterMismatch",this.$fault="client",Object.setPrototypeOf(this,IdempotentParameterMismatch.prototype),this.Message=e.Message}}class ResourceLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Message=e.Message}}class OpsItemAccessDeniedException extends SSMServiceException{constructor(e){super({name:"OpsItemAccessDeniedException",$fault:"client",...e}),this.name="OpsItemAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAccessDeniedException.prototype),this.Message=e.Message}}class OpsItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAlreadyExistsException.prototype),this.Message=e.Message,this.OpsItemId=e.OpsItemId}}class OpsMetadataAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsMetadataAlreadyExistsException",$fault:"client",...e}),this.name="OpsMetadataAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataAlreadyExistsException.prototype)}}class OpsMetadataInvalidArgumentException extends SSMServiceException{constructor(e){super({name:"OpsMetadataInvalidArgumentException",$fault:"client",...e}),this.name="OpsMetadataInvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataInvalidArgumentException.prototype)}}class OpsMetadataLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataLimitExceededException.prototype)}}class OpsMetadataTooManyUpdatesException extends SSMServiceException{constructor(e){super({name:"OpsMetadataTooManyUpdatesException",$fault:"client",...e}),this.name="OpsMetadataTooManyUpdatesException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataTooManyUpdatesException.prototype)}}class ResourceDataSyncAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncAlreadyExistsException",$fault:"client",...e}),this.name="ResourceDataSyncAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncAlreadyExistsException.prototype),this.SyncName=e.SyncName}}class ResourceDataSyncCountExceededException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncCountExceededException",$fault:"client",...e}),this.name="ResourceDataSyncCountExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncCountExceededException.prototype),this.Message=e.Message}}class ResourceDataSyncInvalidConfigurationException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncInvalidConfigurationException",$fault:"client",...e}),this.name="ResourceDataSyncInvalidConfigurationException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncInvalidConfigurationException.prototype),this.Message=e.Message}}class InvalidActivation extends SSMServiceException{constructor(e){super({name:"InvalidActivation",$fault:"client",...e}),this.name="InvalidActivation",this.$fault="client",Object.setPrototypeOf(this,InvalidActivation.prototype),this.Message=e.Message}}class InvalidActivationId extends SSMServiceException{constructor(e){super({name:"InvalidActivationId",$fault:"client",...e}),this.name="InvalidActivationId",this.$fault="client",Object.setPrototypeOf(this,InvalidActivationId.prototype),this.Message=e.Message}}class AssociationDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationDoesNotExist",$fault:"client",...e}),this.name="AssociationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationDoesNotExist.prototype),this.Message=e.Message}}class AssociatedInstances extends SSMServiceException{constructor(e){super({name:"AssociatedInstances",$fault:"client",...e}),this.name="AssociatedInstances",this.$fault="client",Object.setPrototypeOf(this,AssociatedInstances.prototype)}}class InvalidDocumentOperation extends SSMServiceException{constructor(e){super({name:"InvalidDocumentOperation",$fault:"client",...e}),this.name="InvalidDocumentOperation",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentOperation.prototype),this.Message=e.Message}}class InvalidDeleteInventoryParametersException extends SSMServiceException{constructor(e){super({name:"InvalidDeleteInventoryParametersException",$fault:"client",...e}),this.name="InvalidDeleteInventoryParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeleteInventoryParametersException.prototype),this.Message=e.Message}}class InvalidInventoryRequestException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryRequestException",$fault:"client",...e}),this.name="InvalidInventoryRequestException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryRequestException.prototype),this.Message=e.Message}}class InvalidOptionException extends SSMServiceException{constructor(e){super({name:"InvalidOptionException",$fault:"client",...e}),this.name="InvalidOptionException",this.$fault="client",Object.setPrototypeOf(this,InvalidOptionException.prototype),this.Message=e.Message}}class InvalidTypeNameException extends SSMServiceException{constructor(e){super({name:"InvalidTypeNameException",$fault:"client",...e}),this.name="InvalidTypeNameException",this.$fault="client",Object.setPrototypeOf(this,InvalidTypeNameException.prototype),this.Message=e.Message}}class OpsMetadataNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsMetadataNotFoundException",$fault:"client",...e}),this.name="OpsMetadataNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataNotFoundException.prototype)}}class ParameterNotFound extends SSMServiceException{constructor(e){super({name:"ParameterNotFound",$fault:"client",...e}),this.name="ParameterNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterNotFound.prototype)}}class ResourceInUseException extends SSMServiceException{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,ResourceInUseException.prototype),this.Message=e.Message}}class ResourceDataSyncNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncNotFoundException",$fault:"client",...e}),this.name="ResourceDataSyncNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncNotFoundException.prototype),this.SyncName=e.SyncName,this.SyncType=e.SyncType,this.Message=e.Message}}class MalformedResourcePolicyDocumentException extends SSMServiceException{constructor(e){super({name:"MalformedResourcePolicyDocumentException",$fault:"client",...e}),this.name="MalformedResourcePolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,MalformedResourcePolicyDocumentException.prototype),this.Message=e.Message}}class ResourceNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceNotFoundException.prototype),this.Message=e.Message}}class ResourcePolicyConflictException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyConflictException",$fault:"client",...e}),this.name="ResourcePolicyConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyConflictException.prototype),this.Message=e.Message}}class ResourcePolicyInvalidParameterException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyInvalidParameterException",$fault:"client",...e}),this.name="ResourcePolicyInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class ResourcePolicyNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyNotFoundException",$fault:"client",...e}),this.name="ResourcePolicyNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyNotFoundException.prototype),this.Message=e.Message}}class TargetInUseException extends SSMServiceException{constructor(e){super({name:"TargetInUseException",$fault:"client",...e}),this.name="TargetInUseException",this.$fault="client",Object.setPrototypeOf(this,TargetInUseException.prototype),this.Message=e.Message}}class InvalidFilter extends SSMServiceException{constructor(e){super({name:"InvalidFilter",$fault:"client",...e}),this.name="InvalidFilter",this.$fault="client",Object.setPrototypeOf(this,InvalidFilter.prototype),this.Message=e.Message}}class InvalidNextToken extends SSMServiceException{constructor(e){super({name:"InvalidNextToken",$fault:"client",...e}),this.name="InvalidNextToken",this.$fault="client",Object.setPrototypeOf(this,InvalidNextToken.prototype),this.Message=e.Message}}class InvalidAssociationVersion extends SSMServiceException{constructor(e){super({name:"InvalidAssociationVersion",$fault:"client",...e}),this.name="InvalidAssociationVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociationVersion.prototype),this.Message=e.Message}}class AssociationExecutionDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationExecutionDoesNotExist",$fault:"client",...e}),this.name="AssociationExecutionDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationExecutionDoesNotExist.prototype),this.Message=e.Message}}class InvalidFilterKey extends SSMServiceException{constructor(e){super({name:"InvalidFilterKey",$fault:"client",...e}),this.name="InvalidFilterKey",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterKey.prototype)}}class InvalidFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidFilterValue",$fault:"client",...e}),this.name="InvalidFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterValue.prototype),this.Message=e.Message}}class AutomationExecutionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionNotFoundException",$fault:"client",...e}),this.name="AutomationExecutionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionNotFoundException.prototype),this.Message=e.Message}}class InvalidPermissionType extends SSMServiceException{constructor(e){super({name:"InvalidPermissionType",$fault:"client",...e}),this.name="InvalidPermissionType",this.$fault="client",Object.setPrototypeOf(this,InvalidPermissionType.prototype),this.Message=e.Message}}class UnsupportedOperatingSystem extends SSMServiceException{constructor(e){super({name:"UnsupportedOperatingSystem",$fault:"client",...e}),this.name="UnsupportedOperatingSystem",this.$fault="client",Object.setPrototypeOf(this,UnsupportedOperatingSystem.prototype),this.Message=e.Message}}class InvalidInstanceInformationFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstanceInformationFilterValue",$fault:"client",...e}),this.name="InvalidInstanceInformationFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceInformationFilterValue.prototype)}}class InvalidInstancePropertyFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstancePropertyFilterValue",$fault:"client",...e}),this.name="InvalidInstancePropertyFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstancePropertyFilterValue.prototype)}}class InvalidDeletionIdException extends SSMServiceException{constructor(e){super({name:"InvalidDeletionIdException",$fault:"client",...e}),this.name="InvalidDeletionIdException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeletionIdException.prototype),this.Message=e.Message}}class InvalidFilterOption extends SSMServiceException{constructor(e){super({name:"InvalidFilterOption",$fault:"client",...e}),this.name="InvalidFilterOption",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterOption.prototype)}}class OpsItemRelatedItemAssociationNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAssociationNotFoundException",$fault:"client",...e}),this.name="OpsItemRelatedItemAssociationNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAssociationNotFoundException.prototype),this.Message=e.Message}}class InvalidDocumentType extends SSMServiceException{constructor(e){super({name:"InvalidDocumentType",$fault:"client",...e}),this.name="InvalidDocumentType",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentType.prototype),this.Message=e.Message}}class UnsupportedCalendarException extends SSMServiceException{constructor(e){super({name:"UnsupportedCalendarException",$fault:"client",...e}),this.name="UnsupportedCalendarException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedCalendarException.prototype),this.Message=e.Message}}class InvalidPluginName extends SSMServiceException{constructor(e){super({name:"InvalidPluginName",$fault:"client",...e}),this.name="InvalidPluginName",this.$fault="client",Object.setPrototypeOf(this,InvalidPluginName.prototype)}}class InvocationDoesNotExist extends SSMServiceException{constructor(e){super({name:"InvocationDoesNotExist",$fault:"client",...e}),this.name="InvocationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,InvocationDoesNotExist.prototype)}}class UnsupportedFeatureRequiredException extends SSMServiceException{constructor(e){super({name:"UnsupportedFeatureRequiredException",$fault:"client",...e}),this.name="UnsupportedFeatureRequiredException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedFeatureRequiredException.prototype),this.Message=e.Message}}class InvalidAggregatorException extends SSMServiceException{constructor(e){super({name:"InvalidAggregatorException",$fault:"client",...e}),this.name="InvalidAggregatorException",this.$fault="client",Object.setPrototypeOf(this,InvalidAggregatorException.prototype),this.Message=e.Message}}class InvalidInventoryGroupException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryGroupException",$fault:"client",...e}),this.name="InvalidInventoryGroupException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryGroupException.prototype),this.Message=e.Message}}class InvalidResultAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidResultAttributeException",$fault:"client",...e}),this.name="InvalidResultAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidResultAttributeException.prototype),this.Message=e.Message}}class InvalidKeyId extends SSMServiceException{constructor(e){super({name:"InvalidKeyId",$fault:"client",...e}),this.name="InvalidKeyId",this.$fault="client",Object.setPrototypeOf(this,InvalidKeyId.prototype)}}class ParameterVersionNotFound extends SSMServiceException{constructor(e){super({name:"ParameterVersionNotFound",$fault:"client",...e}),this.name="ParameterVersionNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionNotFound.prototype)}}class ServiceSettingNotFound extends SSMServiceException{constructor(e){super({name:"ServiceSettingNotFound",$fault:"client",...e}),this.name="ServiceSettingNotFound",this.$fault="client",Object.setPrototypeOf(this,ServiceSettingNotFound.prototype),this.Message=e.Message}}class ParameterVersionLabelLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterVersionLabelLimitExceeded",$fault:"client",...e}),this.name="ParameterVersionLabelLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionLabelLimitExceeded.prototype)}}class DocumentPermissionLimit extends SSMServiceException{constructor(e){super({name:"DocumentPermissionLimit",$fault:"client",...e}),this.name="DocumentPermissionLimit",this.$fault="client",Object.setPrototypeOf(this,DocumentPermissionLimit.prototype),this.Message=e.Message}}class ComplianceTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"ComplianceTypeCountLimitExceededException",$fault:"client",...e}),this.name="ComplianceTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ComplianceTypeCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidItemContentException extends SSMServiceException{constructor(e){super({name:"InvalidItemContentException",$fault:"client",...e}),this.name="InvalidItemContentException",this.$fault="client",Object.setPrototypeOf(this,InvalidItemContentException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class ItemSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"ItemSizeLimitExceededException",$fault:"client",...e}),this.name="ItemSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ItemSizeLimitExceededException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class TotalSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"TotalSizeLimitExceededException",$fault:"client",...e}),this.name="TotalSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,TotalSizeLimitExceededException.prototype),this.Message=e.Message}}class CustomSchemaCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"CustomSchemaCountLimitExceededException",$fault:"client",...e}),this.name="CustomSchemaCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,CustomSchemaCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryItemContextException",$fault:"client",...e}),this.name="InvalidInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryItemContextException.prototype),this.Message=e.Message}}class ItemContentMismatchException extends SSMServiceException{constructor(e){super({name:"ItemContentMismatchException",$fault:"client",...e}),this.name="ItemContentMismatchException",this.$fault="client",Object.setPrototypeOf(this,ItemContentMismatchException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class SubTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"SubTypeCountLimitExceededException",$fault:"client",...e}),this.name="SubTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,SubTypeCountLimitExceededException.prototype),this.Message=e.Message}}class UnsupportedInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventoryItemContextException",$fault:"client",...e}),this.name="UnsupportedInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventoryItemContextException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class UnsupportedInventorySchemaVersionException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventorySchemaVersionException",$fault:"client",...e}),this.name="UnsupportedInventorySchemaVersionException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventorySchemaVersionException.prototype),this.Message=e.Message}}class HierarchyLevelLimitExceededException extends SSMServiceException{constructor(e){super({name:"HierarchyLevelLimitExceededException",$fault:"client",...e}),this.name="HierarchyLevelLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,HierarchyLevelLimitExceededException.prototype)}}class HierarchyTypeMismatchException extends SSMServiceException{constructor(e){super({name:"HierarchyTypeMismatchException",$fault:"client",...e}),this.name="HierarchyTypeMismatchException",this.$fault="client",Object.setPrototypeOf(this,HierarchyTypeMismatchException.prototype)}}class IncompatiblePolicyException extends SSMServiceException{constructor(e){super({name:"IncompatiblePolicyException",$fault:"client",...e}),this.name="IncompatiblePolicyException",this.$fault="client",Object.setPrototypeOf(this,IncompatiblePolicyException.prototype)}}class InvalidAllowedPatternException extends SSMServiceException{constructor(e){super({name:"InvalidAllowedPatternException",$fault:"client",...e}),this.name="InvalidAllowedPatternException",this.$fault="client",Object.setPrototypeOf(this,InvalidAllowedPatternException.prototype)}}class InvalidPolicyAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyAttributeException",$fault:"client",...e}),this.name="InvalidPolicyAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyAttributeException.prototype)}}class InvalidPolicyTypeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyTypeException",$fault:"client",...e}),this.name="InvalidPolicyTypeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyTypeException.prototype)}}class ParameterAlreadyExists extends SSMServiceException{constructor(e){super({name:"ParameterAlreadyExists",$fault:"client",...e}),this.name="ParameterAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,ParameterAlreadyExists.prototype)}}class ParameterLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterLimitExceeded",$fault:"client",...e}),this.name="ParameterLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterLimitExceeded.prototype)}}class ParameterMaxVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterMaxVersionLimitExceeded",$fault:"client",...e}),this.name="ParameterMaxVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterMaxVersionLimitExceeded.prototype)}}class ParameterPatternMismatchException extends SSMServiceException{constructor(e){super({name:"ParameterPatternMismatchException",$fault:"client",...e}),this.name="ParameterPatternMismatchException",this.$fault="client",Object.setPrototypeOf(this,ParameterPatternMismatchException.prototype)}}class PoliciesLimitExceededException extends SSMServiceException{constructor(e){super({name:"PoliciesLimitExceededException",$fault:"client",...e}),this.name="PoliciesLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,PoliciesLimitExceededException.prototype)}}class UnsupportedParameterType extends SSMServiceException{constructor(e){super({name:"UnsupportedParameterType",$fault:"client",...e}),this.name="UnsupportedParameterType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedParameterType.prototype)}}class ResourcePolicyLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyLimitExceededException",$fault:"client",...e}),this.name="ResourcePolicyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyLimitExceededException.prototype),this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class FeatureNotAvailableException extends SSMServiceException{constructor(e){super({name:"FeatureNotAvailableException",$fault:"client",...e}),this.name="FeatureNotAvailableException",this.$fault="client",Object.setPrototypeOf(this,FeatureNotAvailableException.prototype),this.Message=e.Message}}class AutomationStepNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationStepNotFoundException",$fault:"client",...e}),this.name="AutomationStepNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationStepNotFoundException.prototype),this.Message=e.Message}}class InvalidAutomationSignalException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationSignalException",$fault:"client",...e}),this.name="InvalidAutomationSignalException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationSignalException.prototype),this.Message=e.Message}}class InvalidNotificationConfig extends SSMServiceException{constructor(e){super({name:"InvalidNotificationConfig",$fault:"client",...e}),this.name="InvalidNotificationConfig",this.$fault="client",Object.setPrototypeOf(this,InvalidNotificationConfig.prototype),this.Message=e.Message}}class InvalidOutputFolder extends SSMServiceException{constructor(e){super({name:"InvalidOutputFolder",$fault:"client",...e}),this.name="InvalidOutputFolder",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputFolder.prototype)}}class InvalidRole extends SSMServiceException{constructor(e){super({name:"InvalidRole",$fault:"client",...e}),this.name="InvalidRole",this.$fault="client",Object.setPrototypeOf(this,InvalidRole.prototype),this.Message=e.Message}}class InvalidAssociation extends SSMServiceException{constructor(e){super({name:"InvalidAssociation",$fault:"client",...e}),this.name="InvalidAssociation",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociation.prototype),this.Message=e.Message}}class AutomationDefinitionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotFoundException.prototype),this.Message=e.Message}}class AutomationDefinitionVersionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionVersionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionVersionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionVersionNotFoundException.prototype),this.Message=e.Message}}class AutomationExecutionLimitExceededException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionLimitExceededException",$fault:"client",...e}),this.name="AutomationExecutionLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionLimitExceededException.prototype),this.Message=e.Message}}class InvalidAutomationExecutionParametersException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationExecutionParametersException",$fault:"client",...e}),this.name="InvalidAutomationExecutionParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationExecutionParametersException.prototype),this.Message=e.Message}}const ParameterFilterSensitiveLog=e=>({...e,...e.Value&&{Value:SENSITIVE_STRING}}),GetParameterResultFilterSensitiveLog=e=>({...e,...e.Parameter&&{Parameter:ParameterFilterSensitiveLog(e.Parameter)}}),GetParametersResultFilterSensitiveLog=e=>({...e,...e.Parameters&&{Parameters:e.Parameters.map((e=>ParameterFilterSensitiveLog(e)))}});class AutomationDefinitionNotApprovedException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotApprovedException",$fault:"client",...e}),this.name="AutomationDefinitionNotApprovedException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotApprovedException.prototype),this.Message=e.Message}}class TargetNotConnected extends SSMServiceException{constructor(e){super({name:"TargetNotConnected",$fault:"client",...e}),this.name="TargetNotConnected",this.$fault="client",Object.setPrototypeOf(this,TargetNotConnected.prototype),this.Message=e.Message}}class InvalidAutomationStatusUpdateException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationStatusUpdateException",$fault:"client",...e}),this.name="InvalidAutomationStatusUpdateException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationStatusUpdateException.prototype),this.Message=e.Message}}class AssociationVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationVersionLimitExceeded",$fault:"client",...e}),this.name="AssociationVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationVersionLimitExceeded.prototype),this.Message=e.Message}}class InvalidUpdate extends SSMServiceException{constructor(e){super({name:"InvalidUpdate",$fault:"client",...e}),this.name="InvalidUpdate",this.$fault="client",Object.setPrototypeOf(this,InvalidUpdate.prototype),this.Message=e.Message}}class StatusUnchanged extends SSMServiceException{constructor(e){super({name:"StatusUnchanged",$fault:"client",...e}),this.name="StatusUnchanged",this.$fault="client",Object.setPrototypeOf(this,StatusUnchanged.prototype)}}class DocumentVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentVersionLimitExceeded",$fault:"client",...e}),this.name="DocumentVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentVersionLimitExceeded.prototype),this.Message=e.Message}}class DuplicateDocumentContent extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentContent",$fault:"client",...e}),this.name="DuplicateDocumentContent",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentContent.prototype),this.Message=e.Message}}class DuplicateDocumentVersionName extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentVersionName",$fault:"client",...e}),this.name="DuplicateDocumentVersionName",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentVersionName.prototype),this.Message=e.Message}}class OpsMetadataKeyLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataKeyLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataKeyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataKeyLimitExceededException.prototype)}}class ResourceDataSyncConflictException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncConflictException",$fault:"client",...e}),this.name="ResourceDataSyncConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncConflictException.prototype),this.Message=e.Message}}const se_GetParameterCommand=async(e,t)=>{const n=sharedHeaders("GetParameter");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},se_GetParametersCommand=async(e,t)=>{const n=sharedHeaders("GetParameters");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},de_GetParameterCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParameterResult(n);return{$metadata:deserializeMetadata(e),...r}},de_GetParametersCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParametersResult(n);return{$metadata:deserializeMetadata(e),...r}},de_CommandError=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},r=loadRestJsonErrorCode(e,n.body);switch(r){case"InternalServerError":case"com.amazonaws.ssm#InternalServerError":throw await de_InternalServerErrorRes(n);case"InvalidResourceId":case"com.amazonaws.ssm#InvalidResourceId":throw await de_InvalidResourceIdRes(n);case"InvalidResourceType":case"com.amazonaws.ssm#InvalidResourceType":throw await de_InvalidResourceTypeRes(n);case"TooManyTagsError":case"com.amazonaws.ssm#TooManyTagsError":throw await de_TooManyTagsErrorRes(n);case"TooManyUpdates":case"com.amazonaws.ssm#TooManyUpdates":throw await de_TooManyUpdatesRes(n);case"OpsItemConflictException":case"com.amazonaws.ssm#OpsItemConflictException":throw await de_OpsItemConflictExceptionRes(n);case"OpsItemInvalidParameterException":case"com.amazonaws.ssm#OpsItemInvalidParameterException":throw await de_OpsItemInvalidParameterExceptionRes(n);case"OpsItemLimitExceededException":case"com.amazonaws.ssm#OpsItemLimitExceededException":throw await de_OpsItemLimitExceededExceptionRes(n);case"OpsItemNotFoundException":case"com.amazonaws.ssm#OpsItemNotFoundException":throw await de_OpsItemNotFoundExceptionRes(n);case"OpsItemRelatedItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemRelatedItemAlreadyExistsException":throw await de_OpsItemRelatedItemAlreadyExistsExceptionRes(n);case"DuplicateInstanceId":case"com.amazonaws.ssm#DuplicateInstanceId":throw await de_DuplicateInstanceIdRes(n);case"InvalidCommandId":case"com.amazonaws.ssm#InvalidCommandId":throw await de_InvalidCommandIdRes(n);case"InvalidInstanceId":case"com.amazonaws.ssm#InvalidInstanceId":throw await de_InvalidInstanceIdRes(n);case"DoesNotExistException":case"com.amazonaws.ssm#DoesNotExistException":throw await de_DoesNotExistExceptionRes(n);case"InvalidParameters":case"com.amazonaws.ssm#InvalidParameters":throw await de_InvalidParametersRes(n);case"AssociationAlreadyExists":case"com.amazonaws.ssm#AssociationAlreadyExists":throw await de_AssociationAlreadyExistsRes(n);case"AssociationLimitExceeded":case"com.amazonaws.ssm#AssociationLimitExceeded":throw await de_AssociationLimitExceededRes(n);case"InvalidDocument":case"com.amazonaws.ssm#InvalidDocument":throw await de_InvalidDocumentRes(n);case"InvalidDocumentVersion":case"com.amazonaws.ssm#InvalidDocumentVersion":throw await de_InvalidDocumentVersionRes(n);case"InvalidOutputLocation":case"com.amazonaws.ssm#InvalidOutputLocation":throw await de_InvalidOutputLocationRes(n);case"InvalidSchedule":case"com.amazonaws.ssm#InvalidSchedule":throw await de_InvalidScheduleRes(n);case"InvalidTag":case"com.amazonaws.ssm#InvalidTag":throw await de_InvalidTagRes(n);case"InvalidTarget":case"com.amazonaws.ssm#InvalidTarget":throw await de_InvalidTargetRes(n);case"InvalidTargetMaps":case"com.amazonaws.ssm#InvalidTargetMaps":throw await de_InvalidTargetMapsRes(n);case"UnsupportedPlatformType":case"com.amazonaws.ssm#UnsupportedPlatformType":throw await de_UnsupportedPlatformTypeRes(n);case"DocumentAlreadyExists":case"com.amazonaws.ssm#DocumentAlreadyExists":throw await de_DocumentAlreadyExistsRes(n);case"DocumentLimitExceeded":case"com.amazonaws.ssm#DocumentLimitExceeded":throw await de_DocumentLimitExceededRes(n);case"InvalidDocumentContent":case"com.amazonaws.ssm#InvalidDocumentContent":throw await de_InvalidDocumentContentRes(n);case"InvalidDocumentSchemaVersion":case"com.amazonaws.ssm#InvalidDocumentSchemaVersion":throw await de_InvalidDocumentSchemaVersionRes(n);case"MaxDocumentSizeExceeded":case"com.amazonaws.ssm#MaxDocumentSizeExceeded":throw await de_MaxDocumentSizeExceededRes(n);case"IdempotentParameterMismatch":case"com.amazonaws.ssm#IdempotentParameterMismatch":throw await de_IdempotentParameterMismatchRes(n);case"ResourceLimitExceededException":case"com.amazonaws.ssm#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(n);case"OpsItemAccessDeniedException":case"com.amazonaws.ssm#OpsItemAccessDeniedException":throw await de_OpsItemAccessDeniedExceptionRes(n);case"OpsItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemAlreadyExistsException":throw await de_OpsItemAlreadyExistsExceptionRes(n);case"OpsMetadataAlreadyExistsException":case"com.amazonaws.ssm#OpsMetadataAlreadyExistsException":throw await de_OpsMetadataAlreadyExistsExceptionRes(n);case"OpsMetadataInvalidArgumentException":case"com.amazonaws.ssm#OpsMetadataInvalidArgumentException":throw await de_OpsMetadataInvalidArgumentExceptionRes(n);case"OpsMetadataLimitExceededException":case"com.amazonaws.ssm#OpsMetadataLimitExceededException":throw await de_OpsMetadataLimitExceededExceptionRes(n);case"OpsMetadataTooManyUpdatesException":case"com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":throw await de_OpsMetadataTooManyUpdatesExceptionRes(n);case"ResourceDataSyncAlreadyExistsException":case"com.amazonaws.ssm#ResourceDataSyncAlreadyExistsException":throw await de_ResourceDataSyncAlreadyExistsExceptionRes(n);case"ResourceDataSyncCountExceededException":case"com.amazonaws.ssm#ResourceDataSyncCountExceededException":throw await de_ResourceDataSyncCountExceededExceptionRes(n);case"ResourceDataSyncInvalidConfigurationException":case"com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(n);case"InvalidActivation":case"com.amazonaws.ssm#InvalidActivation":throw await de_InvalidActivationRes(n);case"InvalidActivationId":case"com.amazonaws.ssm#InvalidActivationId":throw await de_InvalidActivationIdRes(n);case"AssociationDoesNotExist":case"com.amazonaws.ssm#AssociationDoesNotExist":throw await de_AssociationDoesNotExistRes(n);case"AssociatedInstances":case"com.amazonaws.ssm#AssociatedInstances":throw await de_AssociatedInstancesRes(n);case"InvalidDocumentOperation":case"com.amazonaws.ssm#InvalidDocumentOperation":throw await de_InvalidDocumentOperationRes(n);case"InvalidDeleteInventoryParametersException":case"com.amazonaws.ssm#InvalidDeleteInventoryParametersException":throw await de_InvalidDeleteInventoryParametersExceptionRes(n);case"InvalidInventoryRequestException":case"com.amazonaws.ssm#InvalidInventoryRequestException":throw await de_InvalidInventoryRequestExceptionRes(n);case"InvalidOptionException":case"com.amazonaws.ssm#InvalidOptionException":throw await de_InvalidOptionExceptionRes(n);case"InvalidTypeNameException":case"com.amazonaws.ssm#InvalidTypeNameException":throw await de_InvalidTypeNameExceptionRes(n);case"OpsMetadataNotFoundException":case"com.amazonaws.ssm#OpsMetadataNotFoundException":throw await de_OpsMetadataNotFoundExceptionRes(n);case"ParameterNotFound":case"com.amazonaws.ssm#ParameterNotFound":throw await de_ParameterNotFoundRes(n);case"ResourceInUseException":case"com.amazonaws.ssm#ResourceInUseException":throw await de_ResourceInUseExceptionRes(n);case"ResourceDataSyncNotFoundException":case"com.amazonaws.ssm#ResourceDataSyncNotFoundException":throw await de_ResourceDataSyncNotFoundExceptionRes(n);case"MalformedResourcePolicyDocumentException":case"com.amazonaws.ssm#MalformedResourcePolicyDocumentException":throw await de_MalformedResourcePolicyDocumentExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.ssm#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes(n);case"ResourcePolicyConflictException":case"com.amazonaws.ssm#ResourcePolicyConflictException":throw await de_ResourcePolicyConflictExceptionRes(n);case"ResourcePolicyInvalidParameterException":case"com.amazonaws.ssm#ResourcePolicyInvalidParameterException":throw await de_ResourcePolicyInvalidParameterExceptionRes(n);case"ResourcePolicyNotFoundException":case"com.amazonaws.ssm#ResourcePolicyNotFoundException":throw await de_ResourcePolicyNotFoundExceptionRes(n);case"TargetInUseException":case"com.amazonaws.ssm#TargetInUseException":throw await de_TargetInUseExceptionRes(n);case"InvalidFilter":case"com.amazonaws.ssm#InvalidFilter":throw await de_InvalidFilterRes(n);case"InvalidNextToken":case"com.amazonaws.ssm#InvalidNextToken":throw await de_InvalidNextTokenRes(n);case"InvalidAssociationVersion":case"com.amazonaws.ssm#InvalidAssociationVersion":throw await de_InvalidAssociationVersionRes(n);case"AssociationExecutionDoesNotExist":case"com.amazonaws.ssm#AssociationExecutionDoesNotExist":throw await de_AssociationExecutionDoesNotExistRes(n);case"InvalidFilterKey":case"com.amazonaws.ssm#InvalidFilterKey":throw await de_InvalidFilterKeyRes(n);case"InvalidFilterValue":case"com.amazonaws.ssm#InvalidFilterValue":throw await de_InvalidFilterValueRes(n);case"AutomationExecutionNotFoundException":case"com.amazonaws.ssm#AutomationExecutionNotFoundException":throw await de_AutomationExecutionNotFoundExceptionRes(n);case"InvalidPermissionType":case"com.amazonaws.ssm#InvalidPermissionType":throw await de_InvalidPermissionTypeRes(n);case"UnsupportedOperatingSystem":case"com.amazonaws.ssm#UnsupportedOperatingSystem":throw await de_UnsupportedOperatingSystemRes(n);case"InvalidInstanceInformationFilterValue":case"com.amazonaws.ssm#InvalidInstanceInformationFilterValue":throw await de_InvalidInstanceInformationFilterValueRes(n);case"InvalidInstancePropertyFilterValue":case"com.amazonaws.ssm#InvalidInstancePropertyFilterValue":throw await de_InvalidInstancePropertyFilterValueRes(n);case"InvalidDeletionIdException":case"com.amazonaws.ssm#InvalidDeletionIdException":throw await de_InvalidDeletionIdExceptionRes(n);case"InvalidFilterOption":case"com.amazonaws.ssm#InvalidFilterOption":throw await de_InvalidFilterOptionRes(n);case"OpsItemRelatedItemAssociationNotFoundException":case"com.amazonaws.ssm#OpsItemRelatedItemAssociationNotFoundException":throw await de_OpsItemRelatedItemAssociationNotFoundExceptionRes(n);case"InvalidDocumentType":case"com.amazonaws.ssm#InvalidDocumentType":throw await de_InvalidDocumentTypeRes(n);case"UnsupportedCalendarException":case"com.amazonaws.ssm#UnsupportedCalendarException":throw await de_UnsupportedCalendarExceptionRes(n);case"InvalidPluginName":case"com.amazonaws.ssm#InvalidPluginName":throw await de_InvalidPluginNameRes(n);case"InvocationDoesNotExist":case"com.amazonaws.ssm#InvocationDoesNotExist":throw await de_InvocationDoesNotExistRes(n);case"UnsupportedFeatureRequiredException":case"com.amazonaws.ssm#UnsupportedFeatureRequiredException":throw await de_UnsupportedFeatureRequiredExceptionRes(n);case"InvalidAggregatorException":case"com.amazonaws.ssm#InvalidAggregatorException":throw await de_InvalidAggregatorExceptionRes(n);case"InvalidInventoryGroupException":case"com.amazonaws.ssm#InvalidInventoryGroupException":throw await de_InvalidInventoryGroupExceptionRes(n);case"InvalidResultAttributeException":case"com.amazonaws.ssm#InvalidResultAttributeException":throw await de_InvalidResultAttributeExceptionRes(n);case"InvalidKeyId":case"com.amazonaws.ssm#InvalidKeyId":throw await de_InvalidKeyIdRes(n);case"ParameterVersionNotFound":case"com.amazonaws.ssm#ParameterVersionNotFound":throw await de_ParameterVersionNotFoundRes(n);case"ServiceSettingNotFound":case"com.amazonaws.ssm#ServiceSettingNotFound":throw await de_ServiceSettingNotFoundRes(n);case"ParameterVersionLabelLimitExceeded":case"com.amazonaws.ssm#ParameterVersionLabelLimitExceeded":throw await de_ParameterVersionLabelLimitExceededRes(n);case"DocumentPermissionLimit":case"com.amazonaws.ssm#DocumentPermissionLimit":throw await de_DocumentPermissionLimitRes(n);case"ComplianceTypeCountLimitExceededException":case"com.amazonaws.ssm#ComplianceTypeCountLimitExceededException":throw await de_ComplianceTypeCountLimitExceededExceptionRes(n);case"InvalidItemContentException":case"com.amazonaws.ssm#InvalidItemContentException":throw await de_InvalidItemContentExceptionRes(n);case"ItemSizeLimitExceededException":case"com.amazonaws.ssm#ItemSizeLimitExceededException":throw await de_ItemSizeLimitExceededExceptionRes(n);case"TotalSizeLimitExceededException":case"com.amazonaws.ssm#TotalSizeLimitExceededException":throw await de_TotalSizeLimitExceededExceptionRes(n);case"CustomSchemaCountLimitExceededException":case"com.amazonaws.ssm#CustomSchemaCountLimitExceededException":throw await de_CustomSchemaCountLimitExceededExceptionRes(n);case"InvalidInventoryItemContextException":case"com.amazonaws.ssm#InvalidInventoryItemContextException":throw await de_InvalidInventoryItemContextExceptionRes(n);case"ItemContentMismatchException":case"com.amazonaws.ssm#ItemContentMismatchException":throw await de_ItemContentMismatchExceptionRes(n);case"SubTypeCountLimitExceededException":case"com.amazonaws.ssm#SubTypeCountLimitExceededException":throw await de_SubTypeCountLimitExceededExceptionRes(n);case"UnsupportedInventoryItemContextException":case"com.amazonaws.ssm#UnsupportedInventoryItemContextException":throw await de_UnsupportedInventoryItemContextExceptionRes(n);case"UnsupportedInventorySchemaVersionException":case"com.amazonaws.ssm#UnsupportedInventorySchemaVersionException":throw await de_UnsupportedInventorySchemaVersionExceptionRes(n);case"HierarchyLevelLimitExceededException":case"com.amazonaws.ssm#HierarchyLevelLimitExceededException":throw await de_HierarchyLevelLimitExceededExceptionRes(n);case"HierarchyTypeMismatchException":case"com.amazonaws.ssm#HierarchyTypeMismatchException":throw await de_HierarchyTypeMismatchExceptionRes(n);case"IncompatiblePolicyException":case"com.amazonaws.ssm#IncompatiblePolicyException":throw await de_IncompatiblePolicyExceptionRes(n);case"InvalidAllowedPatternException":case"com.amazonaws.ssm#InvalidAllowedPatternException":throw await de_InvalidAllowedPatternExceptionRes(n);case"InvalidPolicyAttributeException":case"com.amazonaws.ssm#InvalidPolicyAttributeException":throw await de_InvalidPolicyAttributeExceptionRes(n);case"InvalidPolicyTypeException":case"com.amazonaws.ssm#InvalidPolicyTypeException":throw await de_InvalidPolicyTypeExceptionRes(n);case"ParameterAlreadyExists":case"com.amazonaws.ssm#ParameterAlreadyExists":throw await de_ParameterAlreadyExistsRes(n);case"ParameterLimitExceeded":case"com.amazonaws.ssm#ParameterLimitExceeded":throw await de_ParameterLimitExceededRes(n);case"ParameterMaxVersionLimitExceeded":case"com.amazonaws.ssm#ParameterMaxVersionLimitExceeded":throw await de_ParameterMaxVersionLimitExceededRes(n);case"ParameterPatternMismatchException":case"com.amazonaws.ssm#ParameterPatternMismatchException":throw await de_ParameterPatternMismatchExceptionRes(n);case"PoliciesLimitExceededException":case"com.amazonaws.ssm#PoliciesLimitExceededException":throw await de_PoliciesLimitExceededExceptionRes(n);case"UnsupportedParameterType":case"com.amazonaws.ssm#UnsupportedParameterType":throw await de_UnsupportedParameterTypeRes(n);case"ResourcePolicyLimitExceededException":case"com.amazonaws.ssm#ResourcePolicyLimitExceededException":throw await de_ResourcePolicyLimitExceededExceptionRes(n);case"AlreadyExistsException":case"com.amazonaws.ssm#AlreadyExistsException":throw await de_AlreadyExistsExceptionRes(n);case"FeatureNotAvailableException":case"com.amazonaws.ssm#FeatureNotAvailableException":throw await de_FeatureNotAvailableExceptionRes(n);case"AutomationStepNotFoundException":case"com.amazonaws.ssm#AutomationStepNotFoundException":throw await de_AutomationStepNotFoundExceptionRes(n);case"InvalidAutomationSignalException":case"com.amazonaws.ssm#InvalidAutomationSignalException":throw await de_InvalidAutomationSignalExceptionRes(n);case"InvalidNotificationConfig":case"com.amazonaws.ssm#InvalidNotificationConfig":throw await de_InvalidNotificationConfigRes(n);case"InvalidOutputFolder":case"com.amazonaws.ssm#InvalidOutputFolder":throw await de_InvalidOutputFolderRes(n);case"InvalidRole":case"com.amazonaws.ssm#InvalidRole":throw await de_InvalidRoleRes(n);case"InvalidAssociation":case"com.amazonaws.ssm#InvalidAssociation":throw await de_InvalidAssociationRes(n);case"AutomationDefinitionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionNotFoundException":throw await de_AutomationDefinitionNotFoundExceptionRes(n);case"AutomationDefinitionVersionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":throw await de_AutomationDefinitionVersionNotFoundExceptionRes(n);case"AutomationExecutionLimitExceededException":case"com.amazonaws.ssm#AutomationExecutionLimitExceededException":throw await de_AutomationExecutionLimitExceededExceptionRes(n);case"InvalidAutomationExecutionParametersException":case"com.amazonaws.ssm#InvalidAutomationExecutionParametersException":throw await de_InvalidAutomationExecutionParametersExceptionRes(n);case"AutomationDefinitionNotApprovedException":case"com.amazonaws.ssm#AutomationDefinitionNotApprovedException":throw await de_AutomationDefinitionNotApprovedExceptionRes(n);case"TargetNotConnected":case"com.amazonaws.ssm#TargetNotConnected":throw await de_TargetNotConnectedRes(n);case"InvalidAutomationStatusUpdateException":case"com.amazonaws.ssm#InvalidAutomationStatusUpdateException":throw await de_InvalidAutomationStatusUpdateExceptionRes(n);case"AssociationVersionLimitExceeded":case"com.amazonaws.ssm#AssociationVersionLimitExceeded":throw await de_AssociationVersionLimitExceededRes(n);case"InvalidUpdate":case"com.amazonaws.ssm#InvalidUpdate":throw await de_InvalidUpdateRes(n);case"StatusUnchanged":case"com.amazonaws.ssm#StatusUnchanged":throw await de_StatusUnchangedRes(n);case"DocumentVersionLimitExceeded":case"com.amazonaws.ssm#DocumentVersionLimitExceeded":throw await de_DocumentVersionLimitExceededRes(n);case"DuplicateDocumentContent":case"com.amazonaws.ssm#DuplicateDocumentContent":throw await de_DuplicateDocumentContentRes(n);case"DuplicateDocumentVersionName":case"com.amazonaws.ssm#DuplicateDocumentVersionName":throw await de_DuplicateDocumentVersionNameRes(n);case"OpsMetadataKeyLimitExceededException":case"com.amazonaws.ssm#OpsMetadataKeyLimitExceededException":throw await de_OpsMetadataKeyLimitExceededExceptionRes(n);case"ResourceDataSyncConflictException":case"com.amazonaws.ssm#ResourceDataSyncConflictException":throw await de_ResourceDataSyncConflictExceptionRes(n);default:const t=n.body;return throwDefaultError({output:e,parsedBody:t,errorCode:r})}},de_AlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociatedInstancesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociatedInstances({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationExecutionDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationExecutionDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotApprovedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotApprovedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionVersionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionVersionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationStepNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationStepNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ComplianceTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ComplianceTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_CustomSchemaCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new CustomSchemaCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentPermissionLimitRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentPermissionLimit({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DoesNotExistExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DoesNotExistException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentVersionNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentVersionName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_FeatureNotAvailableExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new FeatureNotAvailableException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyLevelLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyLevelLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyTypeMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyTypeMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IdempotentParameterMismatchRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IdempotentParameterMismatch({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IncompatiblePolicyExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IncompatiblePolicyException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InternalServerErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InternalServerError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivationId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAggregatorExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAggregatorException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAllowedPatternExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAllowedPatternException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociationVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationExecutionParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationExecutionParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationSignalExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationSignalException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationStatusUpdateExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationStatusUpdateException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidCommandIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidCommandId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeleteInventoryParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeleteInventoryParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeletionIdExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeletionIdException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocument({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentOperationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentOperation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentSchemaVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentSchemaVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilter({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterKeyRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterKey({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterOptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterOption({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceInformationFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceInformationFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstancePropertyFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstancePropertyFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryGroupExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryGroupException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryRequestExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryRequestException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidItemContentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidItemContentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidKeyIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidKeyId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNextTokenRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNextToken({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNotificationConfigRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNotificationConfig({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOptionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOptionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputFolderRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputFolder({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputLocationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputLocation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidParametersRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidParameters({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPermissionTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPermissionType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPluginNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPluginName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyTypeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyTypeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResultAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResultAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidRoleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidRole({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidScheduleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidSchedule({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTagRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTag({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTarget({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetMapsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTargetMaps({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTypeNameExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTypeNameException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidUpdateRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidUpdate({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvocationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvocationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemContentMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemContentMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MalformedResourcePolicyDocumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MalformedResourcePolicyDocumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MaxDocumentSizeExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MaxDocumentSizeExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAccessDeniedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAccessDeniedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAssociationNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAssociationNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataInvalidArgumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataInvalidArgumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataKeyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataKeyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataTooManyUpdatesExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataTooManyUpdatesException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterMaxVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterMaxVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterPatternMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterPatternMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionLabelLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionLabelLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_PoliciesLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new PoliciesLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncCountExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncCountExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncInvalidConfigurationExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncInvalidConfigurationException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ServiceSettingNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ServiceSettingNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_StatusUnchangedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new StatusUnchanged({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_SubTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new SubTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetNotConnectedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetNotConnected({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyTagsErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyTagsError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyUpdatesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyUpdates({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TotalSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TotalSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedCalendarExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedCalendarException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedFeatureRequiredExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedFeatureRequiredException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventorySchemaVersionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventorySchemaVersionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedOperatingSystemRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedOperatingSystem({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedParameterTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedParameterType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedPlatformTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedPlatformType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_GetParameterResult=(e,t)=>take(e,{Parameter:e=>de_Parameter(e)}),de_GetParametersResult=(e,t)=>take(e,{InvalidParameters:_json,Parameters:e=>de_ParameterList(e)}),de_Parameter=(e,t)=>take(e,{ARN:expectString,DataType:expectString,LastModifiedDate:e=>expectNonNull(parseEpochTimestamp(expectNumber(e))),Name:expectString,Selector:expectString,SourceResult:expectString,Type:expectString,Value:expectString,Version:expectLong}),de_ParameterList=(e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>de_Parameter(e)));return n},deserializeMetadata=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),throwDefaultError=withBaseException(SSMServiceException),buildHttpRpcRequest=async(e,t,n,r,i)=>{const{hostname:o,protocol:s="https",port:a,path:c}=await e.endpoint(),u={protocol:s,hostname:o,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==i&&(u.body=i),new HttpRequest(u)};function sharedHeaders(e){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AmazonSSM.${e}`}}class GetParameterCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameter",{}).n("SSMClient","GetParameterCommand").f(void 0,GetParameterResultFilterSensitiveLog).ser(se_GetParameterCommand).de(de_GetParameterCommand).build()){}class GetParametersCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameters",{}).n("SSMClient","GetParametersCommand").f(void 0,GetParametersResultFilterSensitiveLog).ser(se_GetParametersCommand).de(de_GetParametersCommand).build()){}const version$1="6.2.0-6",REST_API_URL="https://api.allthings.me",OAUTH_URL="https://accounts.allthings.me",QUEUE_CONCURRENCY=void 0,QUEUE_DELAY=0,QUEUE_RESERVOIR=30,QUEUE_RESERVOIR_REFILL_INTERVAL=166,REQUEST_BACK_OFF_INTERVAL=200,REQUEST_MAX_RETRIES=50,DEFAULT_API_WRAPPER_OPTIONS={apiUrl:process.env.ALLTHINGS_REST_API_URL||REST_API_URL,clientId:process.env.ALLTHINGS_OAUTH_CLIENT_ID,clientSecret:process.env.ALLTHINGS_OAUTH_CLIENT_SECRET,oauthUrl:process.env.ALLTHINGS_OAUTH_URL||OAUTH_URL,password:process.env.ALLTHINGS_OAUTH_PASSWORD,requestBackOffInterval:REQUEST_BACK_OFF_INTERVAL,requestMaxRetries:REQUEST_MAX_RETRIES,scope:"user:profile",username:process.env.ALLTHINGS_OAUTH_USERNAME},USER_AGENT=`Allthings Node SDK REST Client/${version$1}`,DEFAULT_AWS_CONFIGURATION={region:"eu-central-2"};var __rest$5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const DEFAULT_CLIENT_CONFIG={clientConfig:DEFAULT_AWS_CONFIGURATION,onlyDefault:!1,prefix:process.env.SSM_PARAM_PATH},getSecrets=async(e,t,n,r)=>{var i,o;if(t.onlyDefault)return[r];try{const s=await e.send(new GetParametersCommand({Names:n.map((e=>t.prefix+e)),WithDecryption:!0}));return null!==(o=null===(i=null==s?void 0:s.Parameters)||void 0===i?void 0:i.map((e=>{var t;return null!==(t=e.Value)&&void 0!==t?t:r})))&&void 0!==o?o:[r]}catch(e){return t.logger&&t.logger(e),[r]}},getSecret=async(e,t,n,r)=>{var i,o;if(console.log(t,n,{defaultValue:r}),t.onlyDefault)return r;try{const s=await e.send(new GetParameterCommand({Name:t.prefix+n,WithDecryption:!0}));return null!==(o=null===(i=null==s?void 0:s.Parameter)||void 0===i?void 0:i.Value)&&void 0!==o?o:r}catch(e){return t.logger&&t.logger(e),r}},parameterStore=e=>{const t=Object.assign(Object.assign({},DEFAULT_CLIENT_CONFIG),e),{clientConfig:n}=t,r=__rest$5(t,["clientConfig"]),i=new SSMClient(n);return{getSecret:(e,t="")=>getSecret(i,r,e,t),getSecrets:(e,t="")=>getSecrets(i,r,e,t)}};function createTokenStore(e){const t=new Map(Object.entries(e||{}));return{get:e=>t.get(e),reset:()=>t.clear(),set:e=>Object.entries(e).forEach((([e,n])=>t.set(e,n)))}}var queryString={},strictUriEncode=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],decodeComponents(n),decodeComponents(r))}function decode(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(singleMatcher)||[],n=1;n<t.length;n++)t=(e=decodeComponents(t,n).join("")).match(singleMatcher)||[];return e}}function customDecodeURIComponent(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=multiMatcher.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=decode(n[0]);r!==n[0]&&(t[n[0]]=r)}n=multiMatcher.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),o=0;o<i.length;o++){var s=i[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}var decodeUriComponent=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return customDecodeURIComponent(e)}},splitOnFirst=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},filterObj=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var s=r[o],a=e[s];(i?-1!==t.indexOf(s):t(s,a,e))&&(n[s]=a)}return n};!function(e){const t=strictUriEncode,n=decodeUriComponent,r=splitOnFirst,i=filterObj,o=Symbol("encodeFragmentIdentifier");function s(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function c(e,t){return t.decode?n(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&c(n,e).includes(e.arrayFormatSeparator);n=o?c(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===n?n:c(n,e);r[t]=s};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n?c(n,e):n);const o=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],o):r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,s]=r(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:c(s,t),n(c(e,t),s,i)}for(const e of Object.keys(i)){const n=i[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=p(n[e],t);else i[e]=p(n,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const n=i[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}e.extract=d,e.parse=m,e.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[",i,"]"].join("")]:[...n,[a(t,e),"[",a(i,e),"]=",a(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[]"].join("")]:[...n,[a(t,e),"[]=",a(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),":list="].join("")]:[...n,[a(t,e),":list=",a(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[a(n,e),t,a(i,e)].join("")]:[[r,a(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,a(t,e)]:[...n,[a(t,e),"=",a(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?a(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?a(n,t)+"[]":i.reduce(r(n),[]).join("&"):a(n,t)+"="+a(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,i]=r(e,"#");return Object.assign({url:n.split("?")[0]||"",query:m(d(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:c(i,t)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[o]:!0},n);const r=l(t.url).split("?")[0]||"",i=e.extract(t.url),s=e.parse(i,{sort:!1}),c=Object.assign(s,t.query);let u=e.stringify(c,n);u&&(u=`?${u}`);let d=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(t.url);return t.fragmentIdentifier&&(d=`#${n[o]?a(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${u}${d}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[o]:!1},r);const{url:s,query:a,fragmentIdentifier:c}=e.parseUrl(t,r);return e.stringifyUrl({url:s,query:i(a,n),fragmentIdentifier:c},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return e.pick(t,i,r)}}(queryString);var querystring=getDefaultExportFromCjs(queryString);const RESPONSE_TYPE$1="code",GRANT_TYPE$3="authorization_code",castToAuthorizationRequestParams$1=e=>{const{redirectUri:t,clientId:n,scope:r,state:i}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform authorization code grant redirect');if(!t)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant redirect');return Object.assign(Object.assign({client_id:n,redirect_uri:t,response_type:RESPONSE_TYPE$1},r?{scope:r}:{}),i?{state:i}:{})},isEligibleForClientRedirect$1=e=>{try{return!!castToAuthorizationRequestParams$1(e)}catch(e){return!1}},getRedirectUrl$1=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams$1(e),{skipEmptyString:!0,skipNull:!0})}`,castToTokenRequestParams$2=e=>{const{authorizationCode:t,redirectUri:n,clientId:r,clientSecret:i}=e;if(!r)throw new Error('Missing required "clientId" parameter to perform authorization code grant');if(!n)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant');if(!t)throw new Error('Missing required "authorizationCode" parameter to perform authorization code grant');return Object.assign({client_id:r,code:t,grant_type:GRANT_TYPE$3,redirect_uri:n},i?{client_secret:i}:{})},isEligible$3=e=>{try{return!!castToTokenRequestParams$2(e)}catch(e){return!1}},requestToken$3=(e,t)=>e(castToTokenRequestParams$2(t));var browserPonyfill={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==commonjsGlobal&&commonjsGlobal,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in n,a="ArrayBuffer"in n;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function m(e){this.map={},e instanceof m?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&o&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=h(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(y)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}m.prototype.append=function(e,t){e=l(e),t=d(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},m.prototype.delete=function(e){delete this.map[l(e)]},m.prototype.get=function(e){return e=l(e),this.has(e)?this.map[e]:null},m.prototype.has=function(e){return this.map.hasOwnProperty(l(e))},m.prototype.set=function(e,t){this.map[l(e)]=d(t)},m.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},m.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},m.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},m.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},i&&(m.prototype[Symbol.iterator]=m.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(t=t||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new m(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new m(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),v.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function S(e,t){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new m(t.headers),this.url=t.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},_.call(E.prototype),_.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var w=[301,302,303,307,308];S.redirect=function(e,t){if(-1===w.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function x(e,r){return new Promise((function(i,s){var c=new E(e,r);if(c.signal&&c.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function l(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new m,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout((function(){i(new S(r,n))}),0)},u.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){s(new t.DOMException("Aborted","AbortError"))}),0)},u.open(c.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?u.withCredentials=!0:"omit"===c.credentials&&(u.withCredentials=!1),"responseType"in u&&(o?u.responseType="blob":a&&c.headers.get("Content-Type")&&-1!==c.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof m?c.headers.forEach((function(e,t){u.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){u.setRequestHeader(e,d(r.headers[e]))})),c.signal&&(c.signal.addEventListener("abort",l),u.onreadystatechange=function(){4===u.readyState&&c.signal.removeEventListener("abort",l)}),u.send(void 0===c._bodyInit?null:c._bodyInit)}))}x.polyfill=!0,n.fetch||(n.fetch=x,n.Headers=m,n.Request=E,n.Response=S),t.Headers=m,t.Request=E,t.Response=S,t.fetch=x}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports,fetch$1=getDefaultExportFromCjs(browserPonyfillExports);const SUBSCRIPTIONS=process.env.DEBUG&&process.env.DEBUG.split(",").map((e=>e.trim()))||[];function makeLogger(e){return["log","info","warn","error"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:function(...t){return(SUBSCRIPTIONS.includes("*")||SUBSCRIPTIONS.includes(e)||SUBSCRIPTIONS.includes(e.toLocaleLowerCase()))&&console[n](`${e}:`,...t),!0}})),{})}const logger=makeLogger("OAuth Token Request"),makeFetchTokenRequester=e=>async t=>{try{const n=await fetch$1(e,{body:querystring.stringify(t,{skipEmptyString:!0,skipNull:!0}),cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded",accept:"application/json","user-agent":USER_AGENT},method:"POST",mode:"cors"});if(200!==n.status)throw n;const{access_token:r,refresh_token:i,expires_in:o}=await n.json();return{accessToken:r,expiresIn:o,refreshToken:i}}catch(e){if(!e.status)throw e;const t=`HTTP ${e.status} — ${e.statusText}`;throw logger.error(t,e.response),new Error(`HTTP ${e.status} — ${e.statusText}. Could not get token.`)}},GRANT_TYPE$2="refresh_token",castToTokenRequestParams$1=e=>{const{clientId:t,clientSecret:n,refreshToken:r,scope:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform refresh token grant');if(!r)throw new Error('Missing required "refreshToken" parameter to perform refresh token grant');return Object.assign(Object.assign({client_id:t,grant_type:GRANT_TYPE$2,refresh_token:r},n?{client_secret:n}:{}),i?{scope:i}:{})},isEligible$2=e=>{try{return!!castToTokenRequestParams$1(e)}catch(e){return!1}},requestToken$2=(e,t)=>e(castToTokenRequestParams$1(t));async function requestAndSaveToStore(e,t){const n=await e();return t.set(n),n}const partial=(e,...t)=>(...n)=>e(...t,...n);async function until(e,t,n,r=0){const i=await t(n,r);return await e(i,r)?i:until(e,t,i,r+1)}function fnClearInterval(e){return clearInterval(e),!0}function pseudoRandomString(e=16){let t="";for(;t.length<e;)t+=Math.random().toString(36).substr(2);return t.substr(0,e)}async function del(e,t,n,r,i){return e("delete",t,{body:n,headers:i},r)}async function get(e,t,n,r,i){return e("get",t,{headers:i,query:n},r)}var __rest$4=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumGender,EnumUserType,EnumCommunicationPreferenceChannel,EnumUserPermissionRole,EnumUserPermissionObjectType;!function(e){e.female="female",e.male="male"}(EnumGender||(EnumGender={})),function(e){e.allthingsUser="allthings_user",e.allthingsContent="allthings_content",e.customer="customer",e.demoContent="demo_content",e.demoPublic="demo_public",e.partner="partner"}(EnumUserType||(EnumUserType={})),exports.EnumCommunicationPreferenceChannel=void 0,EnumCommunicationPreferenceChannel=exports.EnumCommunicationPreferenceChannel||(exports.EnumCommunicationPreferenceChannel={}),EnumCommunicationPreferenceChannel.push="push",EnumCommunicationPreferenceChannel.email="email",exports.EnumUserPermissionRole=void 0,EnumUserPermissionRole=exports.EnumUserPermissionRole||(exports.EnumUserPermissionRole={}),EnumUserPermissionRole.appAdmin="app-admin",EnumUserPermissionRole.appOwner="app-owner",EnumUserPermissionRole.articlesAgent="articles-agent",EnumUserPermissionRole.articlesViewOnly="articles-view-only",EnumUserPermissionRole.bookableAssetAgent="bookable-asset-agent",EnumUserPermissionRole.bookingAgent="booking-agent",EnumUserPermissionRole.cockpitManager="cockpit-manager",EnumUserPermissionRole.dataConnectorAdmin="data-connector-admin",EnumUserPermissionRole.documentAdmin="doc-admin",EnumUserPermissionRole.externalAgent="external-agent",EnumUserPermissionRole.globalOrgAdmin="global-org-admin",EnumUserPermissionRole.globalUserAdmin="global-user-admin",EnumUserPermissionRole.orgAdmin="org-admin",EnumUserPermissionRole.orgTeamManager="org-team-manager",EnumUserPermissionRole.pinboardAgent="pinboard-agent",EnumUserPermissionRole.platformOwner="platform-owner",EnumUserPermissionRole.qa="qa",EnumUserPermissionRole.serviceCenterAgent="service-center-agent",EnumUserPermissionRole.serviceCenterManager="service-center-manager",EnumUserPermissionRole.setup="setup",EnumUserPermissionRole.tenantManager="tenant-manager",exports.EnumUserPermissionObjectType=void 0,EnumUserPermissionObjectType=exports.EnumUserPermissionObjectType||(exports.EnumUserPermissionObjectType={}),EnumUserPermissionObjectType.app="App",EnumUserPermissionObjectType.group="Group",EnumUserPermissionObjectType.property="Property",EnumUserPermissionObjectType.unit="Unit";const remapUserResult=e=>{const{tenantIDs:t}=e,n=__rest$4(e,["tenantIDs"]);return Object.assign(Object.assign({},n),{tenantIds:t})},remapEmbeddedUser=e=>e.users?e.users.map(remapUserResult):[];async function userCreate(e,t,n,r){return e.post("/v1/users",Object.assign(Object.assign({},r),{creationContext:t,username:n}))}async function getUsers(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/users",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i.map(remapUserResult)},total:o}}async function getCurrentUser(e){return remapUserResult(await e.get("/v1/me"))}async function userGetById(e,t){return remapUserResult(await e.get(`/v1/users/${t}`))}async function userUpdateById(e,t,n){const{tenantIds:r}=n,i=__rest$4(n,["tenantIds"]);return remapUserResult(await e.patch(`/v1/users/${t}`,Object.assign(Object.assign({},i),{tenantIDs:r})))}async function userCreatePermission(e,t,n){const{objectId:r}=n,i=__rest$4(n,["objectId"]),o=await e.post(`/v1/users/${t}/permissions`,Object.assign(Object.assign({},i),{objectID:r})),{objectID:s}=o,a=__rest$4(o,["objectID"]);return Object.assign(Object.assign({},a),{objectId:s})}async function userCreatePermissionBatch(e,t,n){const{objectId:r,objectType:i,roles:o,startDate:s,endDate:a}=n,c={batch:o.map((e=>({endDate:a&&a.toISOString(),objectID:r,objectType:i,restrictions:[],role:e,startDate:s&&s.toISOString()})))};return!await e.post(`/v1/users/${t}/permissions`,c)}async function userGetPermissions(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/roles?limit=-1`);return n.map((e=>{var{objectID:t}=e,n=__rest$4(e,["objectID"]);return Object.assign(Object.assign({},n),{objectId:t})}))}async function userDeletePermission(e,t){return!await e.delete(`/v1/permissions/${t}`)}async function userGetUtilisationPeriods(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/utilisation-periods`);return n}async function userCheckInToUtilisationPeriod(e,t,n){const{email:r}=await e.userGetById(t);return e.utilisationPeriodCheckInUser(n,{email:r})}async function userGetByEmail(e,t,n=1,r=1e3){return e.getUsers(n,r,{email:t})}async function userChangePassword(e,t,n,r){return!await e.put(`/v1/users/${t}/password`,{currentPassword:n,plainPassword:r})}async function agentCreate(e,t,n,r,i,o,s){const a=await e.userCreate(t,r,Object.assign(Object.assign({},i),{type:EnumUserType.customer})),c=await e.post(`/v1/property-managers/${n}/users`,Object.assign({userID:a.id},s&&{externalAgentCompany:s}));return!((void 0===o||o)&&await e.post(`/v1/users/${a.id}/invitations`))&&Object.assign(Object.assign({},a),c)}async function agentCreatePermissions(e,t,n,r,i,o,s){return e.userCreatePermissionBatch(t,{endDate:s,objectId:n,objectType:r,restrictions:[],roles:i,startDate:o})}async function appCreate(e,t,n){return e.post(`/v1/users/${t}/apps`,Object.assign(Object.assign({availableLocales:{0:"de_DE"}},n),{siteUrl:n.siteUrl.replace("_","")}))}async function appGetById(e,t){return e.get(`/v1/apps/${t}`)}async function bookingGetById(e,t){return e.get(`/v1/bookings/${t}`)}async function bookingUpdateById(e,t,n){return e.patch(`/v1/bookings/${t}`,n)}async function bucketGet(e,t){return e.get(`/v1/buckets/${t}`)}async function bucketCreate(e,t){return e.post("/v1/buckets",{channels:t.channels,name:t.name})}async function bucketAddFile(e,t,n){return""===await e.post(`/v1/buckets/${t}/files`,{id:n})}async function bucketRemoveFile(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files/${n}`)}async function bucketRemoveFilesInPath(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files`,{folder:n.path})}const createManyFiles=async(e,t)=>await Promise.all(e.map((async e=>{try{return await t.fileCreate({file:e.content,name:e.filename})}catch(e){return e}})));async function createManyFilesSorted(e,t){const n=await createManyFiles(e,t);return{error:n.filter((e=>e instanceof Error)),success:n.filter((e=>!(e instanceof Error))).map((e=>e.id))}}async function conversationGetById(e,t){return e.get(`/v1/conversations/${t}`)}async function conversationCreateMessage(e,t,n){const r=`/v1/conversations/${t}/messages`,i=n.attachments&&n.attachments.length?{content:{description:n.body,files:(await createManyFilesSorted(n.attachments,e)).success},createdBy:n.createdBy,inputChannel:n.inputChannel,internal:!1,type:"file"}:{content:{content:n.body},createdBy:n.createdBy,inputChannel:n.inputChannel,type:"text"};return e.post(r,i)}async function fileCreate(e,t){return e.post("/v1/files",{formData:{file:[t.file,t.name],path:t.path||""}})}async function fileDelete(e,t){return""===await e.delete(`/v1/files/${t}`)}var __rest$3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};async function groupCreate(e,t,n){const{propertyManagerId:r}=n,i=__rest$3(n,["propertyManagerId"]);return e.post(`/v1/properties/${t}/groups`,Object.assign(Object.assign({},i),{propertyManagerID:r}))}async function groupGetById(e,t){const n=await e.get(`/v1/groups/${t}`),{propertyManagerID:r}=n,i=__rest$3(n,["propertyManagerID"]);return Object.assign(Object.assign({},i),{propertyManagerId:r})}async function groupUpdateById(e,t,n){return e.patch(`/v1/groups/${t}`,n)}async function getGroups(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/groups",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:o}}async function lookupIds(e,t,n){return e.post(`/v1/id-lookup/${t}/${n.resource}`,Object.assign(Object.assign({externalIds:"string"==typeof n.externalIds?[n.externalIds]:n.externalIds},n.parentId?{parentId:n.parentId}:{}),n.userType?{userType:n.userType}:{}))}function stringToDate(e){return new Date(Date.parse(e))}function dateToString(e){return e.toISOString()}var __rest$2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumNotificationCategory,EnumNotificationType,EnumNotificationSettingsValue;function remapNotificationResult(e){var{createdAt:t,objectID:n,referencedObjectID:r}=e,i=__rest$2(e,["createdAt","objectID","referencedObjectID"]);return Object.assign({createdAt:stringToDate(t),objectId:n,referencedObjectId:r},i)}async function notificationsGetByUser(e,t,n=1,r=-1){const{_embedded:{items:i},total:o,metaData:s}=await e.get(`/v1/users/${t}/notifications?page=${n}&limit=${r}`);return{_embedded:{items:i.map(remapNotificationResult)},metaData:s,total:o}}async function notificationsUpdateReadByUser(e,t,n=new Date){return e.patch(`/v1/users/${t}/notifications`,{lastReadAt:dateToString(n)})}async function notificationUpdateRead(e,t){return remapNotificationResult(await e.patch(`/v1/notifications/${t}`,{read:!0}))}function remapKeys(e,t){return Object.entries(e).reduce(((e,n)=>Object.assign(Object.assign({},e),{[t(n[0])]:n[1]})),{})}function camelCaseToDash(e){return e.replace(/([A-Z])/g,(e=>`-${e[0].toLowerCase()}`))}function dashCaseToCamel(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}async function notificationSettingsUpdateByUser(e,t,n){const r=await e.patch(`/v1/users/${t}/notification-settings`,{notificationSettings:remapKeys(n,camelCaseToDash)});return remapKeys(r,dashCaseToCamel)}async function notificationSettingsResetByUser(e,t){return remapKeys(await e.delete(`/v1/users/${t}/notification-settings`),dashCaseToCamel)}async function propertyCreate(e,t,n){return e.post(`/v1/apps/${t}/properties`,n)}async function propertyGetById(e,t){return e.get(`/v1/properties/${t}`)}async function propertyUpdateById(e,t,n){return e.patch(`/v1/properties/${t}`,n)}async function getProperties(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/properties",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:o}}!function(e){e.events="events",e.hintsAndTips="hints-and-tips",e.lostAndFound="lost-and-found",e.localDeals="local-deals",e.localEvents="local-events",e.miscellaneous="miscellaneous",e.deals="deals",e.messages="messages",e.adminMessages="admin-messages",e.newThingsToGive="new-things-to-give",e.newThingsForSale="new-things-for-sale",e.surveys="surveys",e.supportOffer="support-offer",e.supportRequest="support-request",e.sustainability="sustainability",e.localServices="local-services",e.services="services",e.ticketDigestEmail="ticket-digest-email",e.appDigestEmail="app-digest-email",e.newFile="new-file"}(EnumNotificationCategory||(EnumNotificationCategory={})),function(e){e.clipboardThing="clipboard-thing",e.comment="comment",e.communityArticle="community-article",e.newFile="new-file",e.ticketComment="ticket-comment",e.welcomeNotification="welcome-notification"}(EnumNotificationType||(EnumNotificationType={})),function(e){e.never="never",e.immediately="immediately",e.daily="daily",e.weekly="weekly",e.biweekly="biweekly",e.monthly="monthly"}(EnumNotificationSettingsValue||(EnumNotificationSettingsValue={}));var __rest$1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const remapRegistationCodeResult=e=>{const{tenantID:t}=e,n=__rest$1(e,["tenantID"]);return Object.assign(Object.assign({},n),{externalId:t})};async function registrationCodeCreate(e,t,n,r={permanent:!1}){const{externalId:i}=r,o=__rest$1(r,["externalId"]);return remapRegistationCodeResult(await e.post("/v1/registration-codes",Object.assign(Object.assign({code:t,utilisationPeriods:"string"==typeof n?[n]:n},i?{tenantID:i}:{}),o)))}async function registrationCodeUpdateById(e,t,n){return remapRegistationCodeResult(await e.patch(`/v1/registration-codes/${t}`,n))}async function registrationCodeGetById(e,t){return remapRegistationCodeResult(await e.get(`/v1/invitations/${t}`))}async function registrationCodeDelete(e,t){return""===await e.delete(`/v1/invitations/${t}`)}async function serviceProviderCreate(e,t){return e.post("/v1/service-providers",t)}async function serviceProviderGetById(e,t){return e.get(`/v1/service-providers/${t}`)}async function serviceProviderUpdateById(e,t,n){return e.patch(`/v1/service-providers/${t}`,n)}var ETicketStatus,ETrafficLightColor,EnumUnitObjectType,EnumUnitType,EnumUserRelationType;async function ticketGetById(e,t){return e.get(`/v1/tickets/${t}`)}async function ticketCreateOnUser(e,t,n,r){return e.post(`/v1/users/${t}/tickets`,Object.assign(Object.assign({},r),{files:r.files?(await createManyFilesSorted(r.files,e)).success:[],utilisationPeriod:n}))}async function ticketCreateOnServiceProvider(e,t,n){return e.post(`/v1/property-managers/${t}/tickets`,Object.assign(Object.assign({},n),{files:n.files?(await createManyFilesSorted(n.files,e)).success:[]}))}async function unitCreate(e,t,n){return e.post(`/v1/groups/${t}/units`,n)}async function unitGetById(e,t){return e.get(`/v1/units/${t}`)}async function unitUpdateById(e,t,n){return e.patch(`/v1/units/${t}`,n)}async function getUnits(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/units",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:o}}async function userRelationCreate(e,t,n){return e.post(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,readOnly:n.readOnly,role:n.role})}async function userRelationDelete(e,t,n){return e.delete(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,role:n.role})}async function userRelationsGetByUser(e,t){return e.get(`/v1/users/${t}/user-relations`)}!function(e){e.CLOSED="closed",e.WAITING_FOR_AGENT="waiting-for-agent",e.WAITING_FOR_CUSTOMER="waiting-for-customer",e.WAITING_FOR_EXTERNAL="waiting-for-external"}(ETicketStatus||(ETicketStatus={})),function(e){e.GREEN="green",e.RED="red",e.YELLOW="yellow"}(ETrafficLightColor||(ETrafficLightColor={})),exports.EnumUnitObjectType=void 0,EnumUnitObjectType=exports.EnumUnitObjectType||(exports.EnumUnitObjectType={}),EnumUnitObjectType.adjoiningRoom="adjoining-room",EnumUnitObjectType.advertisingSpace="advertising-space",EnumUnitObjectType.aerial="aerial",EnumUnitObjectType.apartmentBuilding="apartment-building",EnumUnitObjectType.atm="atm",EnumUnitObjectType.atmRoom="atm-room",EnumUnitObjectType.attic="attic",EnumUnitObjectType.atticFlat="attic-flat",EnumUnitObjectType.bank="bank",EnumUnitObjectType.basment="basment",EnumUnitObjectType.bikeShed="bike-shed",EnumUnitObjectType.buildingLaw="building-law",EnumUnitObjectType.cafeteria="cafeteria",EnumUnitObjectType.caretakerRoom="caretaker-room",EnumUnitObjectType.carport="carport",EnumUnitObjectType.cellar="cellar",EnumUnitObjectType.commercialProperty="commercial-property",EnumUnitObjectType.commonRoom="common-room",EnumUnitObjectType.deliveryZone="delivery-zone",EnumUnitObjectType.diverse="diverse",EnumUnitObjectType.doubleParkingSpace="double-parking-space",EnumUnitObjectType.engineeringRoom="engineering-room",EnumUnitObjectType.entertainment="entertainment",EnumUnitObjectType.environment="environment",EnumUnitObjectType.estate="estate",EnumUnitObjectType.fillingStation="filling-station",EnumUnitObjectType.fitnessCenter="fitness-center",EnumUnitObjectType.flat="flat",EnumUnitObjectType.freeZone="free-zone",EnumUnitObjectType.garage="garage",EnumUnitObjectType.garden="garden",EnumUnitObjectType.gardenFlat="garden-flat",EnumUnitObjectType.heatingFacilities="heating-facilities",EnumUnitObjectType.hotel="hotel",EnumUnitObjectType.incidentalRentalExpenses="incidental-rental-expenses",EnumUnitObjectType.industry="industry",EnumUnitObjectType.kiosk="kiosk",EnumUnitObjectType.kitchen="kitchen",EnumUnitObjectType.loft="loft",EnumUnitObjectType.machine="machine",EnumUnitObjectType.maisonette="maisonette",EnumUnitObjectType.medicalPractice="medical-practice",EnumUnitObjectType.mopedShed="moped-shed",EnumUnitObjectType.motorcycleParkingSpace="motorcycle-parking-space",EnumUnitObjectType.office="office",EnumUnitObjectType.oneFamilyHouse="one-family-house",EnumUnitObjectType.parkingBox="parking-box",EnumUnitObjectType.parkingGarage="parking-garage",EnumUnitObjectType.parkingSpace="parking-space",EnumUnitObjectType.parkingSpaces="parking-spaces",EnumUnitObjectType.penthouse="penthouse",EnumUnitObjectType.productionPlant="production-plant",EnumUnitObjectType.pub="pub",EnumUnitObjectType.publicArea="public-area",EnumUnitObjectType.restaurant="restaurant",EnumUnitObjectType.retirementHome="retirement-home",EnumUnitObjectType.salesFloor="sales-floor",EnumUnitObjectType.school="school",EnumUnitObjectType.shelter="shelter",EnumUnitObjectType.storage="storage",EnumUnitObjectType.store="store",EnumUnitObjectType.storeroom="storeroom",EnumUnitObjectType.studio="studio",EnumUnitObjectType.terrace="terrace",EnumUnitObjectType.toilets="toilets",EnumUnitObjectType.utilityRoom="utility-room",EnumUnitObjectType.variableParkingSpace="variable-parking-space",EnumUnitObjectType.variableRoom="variable-room",EnumUnitObjectType.visitorParkingSpace="visitor-parking-space",EnumUnitObjectType.workshop="workshop",exports.EnumUnitType=void 0,EnumUnitType=exports.EnumUnitType||(exports.EnumUnitType={}),EnumUnitType.rented="rented",EnumUnitType.owned="owned",exports.EnumUserRelationType=void 0,EnumUserRelationType=exports.EnumUserRelationType||(exports.EnumUserRelationType={}),EnumUserRelationType.isResponsible="is-responsible";var __rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumUtilisationPeriodType;async function utilisationPeriodCreate(e,t,n){const r=await e.post(`/v1/units/${t}/utilisation-periods`,n),{tenantIDs:i,_embedded:o}=r,s=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},s),{invitations:o.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(o)})}async function utilisationPeriodGetById(e,t){const n=await e.get(`/v1/utilisation-periods/${t}`),{tenantIDs:r,_embedded:i}=n,o=__rest(n,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},o),{invitations:i.invitations.map(remapRegistationCodeResult),tenantIds:r,users:remapEmbeddedUser(i)})}async function utilisationPeriodUpdateById(e,t,n){const r=await e.patch(`/v1/utilisation-periods/${t}`,n),{tenantIDs:i,_embedded:o}=r,s=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},s),{invitations:o.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(o)})}async function utilisationPeriodDelete(e,t){return!await e.delete(`/v1/utilisation-periods/${t}/soft`)}async function utilisationPeriodCheckInUser(e,t,n){return await e.post(`/v1/utilisation-periods/${t}/users`,{email:n.email})&&e.utilisationPeriodGetById(t)}async function utilisationPeriodCheckOutUser(e,t,n){return""===await e.delete(`/v1/utilisation-periods/${t}/users/${n}`)}async function utilisationPeriodAddRegistrationCode(e,t,n,r,i=!1){return e.post(`/v1/utilisation-periods/${t}/registration-codes`,{code:n,permanent:i,tenant:r})}async function patch(e,t,n,r,i){return e("patch",t,{body:n,headers:i},r)}async function post(e,t,n,r,i){return e("post",t,{body:n,headers:i},r)}async function put(e,t,n,r,i){return e("put",t,{body:n,headers:i},r)}exports.EnumUtilisationPeriodType=void 0,EnumUtilisationPeriodType=exports.EnumUtilisationPeriodType||(exports.EnumUtilisationPeriodType={}),EnumUtilisationPeriodType.tenant="tenant",EnumUtilisationPeriodType.ownership="ownership",EnumUtilisationPeriodType.vacant="vacant";var parser$3={},DLList$2;parser$3.load=function(e,t,n={}){var r,i,o;for(r in t)o=t[r],n[r]=null!=(i=e[r])?i:o;return n},parser$3.overwrite=function(e,t,n={}){var r,i;for(r in e)i=e[r],void 0!==t[r]&&(n[r]=i);return n},DLList$2=class{constructor(e,t){this.incr=e,this.decr=t,this._first=null,this._last=null,this.length=0}push(e){var t;this.length++,"function"==typeof this.incr&&this.incr(),t={value:e,prev:this._last,next:null},null!=this._last?(this._last.next=t,this._last=t):this._first=this._last=t}shift(){var e;if(null!=this._first)return this.length--,"function"==typeof this.decr&&this.decr(),e=this._first.value,null!=(this._first=this._first.next)?this._first.prev=null:this._last=null,e}first(){if(null!=this._first)return this._first.value}getArray(){var e,t,n;for(e=this._first,n=[];null!=e;)n.push((t=e,e=e.next,t.value));return n}forEachShift(e){var t;for(t=this.shift();null!=t;)e(t),t=this.shift()}debug(){var e,t,n,r,i;for(e=this._first,i=[];null!=e;)i.push((t=e,e=e.next,{value:t.value,prev:null!=(n=t.prev)?n.value:void 0,next:null!=(r=t.next)?r.value:void 0}));return i}};var DLList_1=DLList$2,Events$1;function asyncGeneratorStep$4(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$4(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$4(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$4(o,r,i,s,a,"throw",e)}s(void 0)}))}}Events$1=class{constructor(e){if(this.instance=e,this._events={},null!=this.instance.on||null!=this.instance.once||null!=this.instance.removeAllListeners)throw new Error("An Emitter already exists for this object");this.instance.on=(e,t)=>this._addListener(e,"many",t),this.instance.once=(e,t)=>this._addListener(e,"once",t),this.instance.removeAllListeners=(e=null)=>null!=e?delete this._events[e]:this._events={}}_addListener(e,t,n){var r;return null==(r=this._events)[e]&&(r[e]=[]),this._events[e].push({cb:n,status:t}),this.instance}listenerCount(e){return null!=this._events[e]?this._events[e].length:0}trigger(e,...t){var n=this;return _asyncToGenerator$4((function*(){var r,i;try{if("debug"!==e&&n.trigger("debug",`Event triggered: ${e}`,t),null==n._events[e])return;return n._events[e]=n._events[e].filter((function(e){return"none"!==e.status})),i=n._events[e].map(function(){var e=_asyncToGenerator$4((function*(e){var r,i;if("none"!==e.status){"once"===e.status&&(e.status="none");try{return"function"==typeof(null!=(i="function"==typeof e.cb?e.cb(...t):void 0)?i.then:void 0)?yield i:i}catch(e){return r=e,n.trigger("error",r),null}}}));return function(t){return e.apply(this,arguments)}}()),(yield Promise.all(i)).find((function(e){return null!=e}))}catch(e){return r=e,n.trigger("error",r),null}}))()}};var Events_1=Events$1,DLList$1,Events,Queues;DLList$1=DLList_1,Events=Events_1,Queues=class{constructor(e){this.Events=new Events(this),this._length=0,this._lists=function(){var t,n,r;for(r=[],t=1,n=e;1<=n?t<=n:t>=n;1<=n?++t:--t)r.push(new DLList$1((()=>this.incr()),(()=>this.decr())));return r}.call(this)}incr(){if(0==this._length++)return this.Events.trigger("leftzero")}decr(){if(0==--this._length)return this.Events.trigger("zero")}push(e){return this._lists[e.options.priority].push(e)}queued(e){return null!=e?this._lists[e].length:this._length}shiftAll(e){return this._lists.forEach((function(t){return t.forEachShift(e)}))}getFirst(e=this._lists){var t,n,r;for(t=0,n=e.length;t<n;t++)if((r=e[t]).length>0)return r;return[]}shiftLastFrom(e){return this.getFirst(this._lists.slice(e).reverse()).shift()}};var Queues_1=Queues,BottleneckError_1,hasRequiredBottleneckError,BottleneckError$3,DEFAULT_PRIORITY,Job,NUM_PRIORITIES,parser$2;function requireBottleneckError(){return hasRequiredBottleneckError?BottleneckError_1:(hasRequiredBottleneckError=1,e=class extends Error{},BottleneckError_1=e);var e}function asyncGeneratorStep$3(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$3(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$3(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$3(o,r,i,s,a,"throw",e)}s(void 0)}))}}NUM_PRIORITIES=10,DEFAULT_PRIORITY=5,parser$2=parser$3,BottleneckError$3=requireBottleneckError(),Job=class{constructor(e,t,n,r,i,o,s,a){this.task=e,this.args=t,this.rejectOnDrop=i,this.Events=o,this._states=s,this.Promise=a,this.options=parser$2.load(n,r),this.options.priority=this._sanitizePriority(this.options.priority),this.options.id===r.id&&(this.options.id=`${this.options.id}-${this._randomIndex()}`),this.promise=new this.Promise(((e,t)=>{this._resolve=e,this._reject=t})),this.retryCount=0}_sanitizePriority(e){var t;return(t=~~e!==e?DEFAULT_PRIORITY:e)<0?0:t>NUM_PRIORITIES-1?NUM_PRIORITIES-1:t}_randomIndex(){return Math.random().toString(36).slice(2)}doDrop({error:e,message:t="This job has been dropped by Bottleneck"}={}){return!!this._states.remove(this.options.id)&&(this.rejectOnDrop&&this._reject(null!=e?e:new BottleneckError$3(t)),this.Events.trigger("dropped",{args:this.args,options:this.options,task:this.task,promise:this.promise}),!0)}_assertStatus(e){var t;if((t=this._states.jobStatus(this.options.id))!==e&&("DONE"!==e||null!==t))throw new BottleneckError$3(`Invalid job status ${t}, expected ${e}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`)}doReceive(){return this._states.start(this.options.id),this.Events.trigger("received",{args:this.args,options:this.options})}doQueue(e,t){return this._assertStatus("RECEIVED"),this._states.next(this.options.id),this.Events.trigger("queued",{args:this.args,options:this.options,reachedHWM:e,blocked:t})}doRun(){return 0===this.retryCount?(this._assertStatus("QUEUED"),this._states.next(this.options.id)):this._assertStatus("EXECUTING"),this.Events.trigger("scheduled",{args:this.args,options:this.options})}doExecute(e,t,n,r){var i=this;return _asyncToGenerator$3((function*(){var o,s,a;0===i.retryCount?(i._assertStatus("RUNNING"),i._states.next(i.options.id)):i._assertStatus("EXECUTING"),s={args:i.args,options:i.options,retryCount:i.retryCount},i.Events.trigger("executing",s);try{if(a=yield null!=e?e.schedule(i.options,i.task,...i.args):i.task(...i.args),t())return i.doDone(s),yield r(i.options,s),i._assertStatus("DONE"),i._resolve(a)}catch(e){return o=e,i._onFailure(o,s,t,n,r)}}))()}doExpire(e,t,n){var r,i;return this._states.jobStatus("RUNNING"===this.options.id)&&this._states.next(this.options.id),this._assertStatus("EXECUTING"),i={args:this.args,options:this.options,retryCount:this.retryCount},r=new BottleneckError$3(`This job timed out after ${this.options.expiration} ms.`),this._onFailure(r,i,e,t,n)}_onFailure(e,t,n,r,i){var o=this;return _asyncToGenerator$3((function*(){var s,a;if(n())return null!=(s=yield o.Events.trigger("failed",e,t))?(a=~~s,o.Events.trigger("retry",`Retrying ${o.options.id} after ${a} ms`,t),o.retryCount++,r(a)):(o.doDone(t),yield i(o.options,t),o._assertStatus("DONE"),o._reject(e))}))()}doDone(e){return this._assertStatus("EXECUTING"),this._states.next(this.options.id),this.Events.trigger("done",e)}};var Job_1=Job,BottleneckError$2,LocalDatastore,parser$1;function asyncGeneratorStep$2(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$2(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$2(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$2(o,r,i,s,a,"throw",e)}s(void 0)}))}}parser$1=parser$3,BottleneckError$2=requireBottleneckError(),LocalDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.clientId=this.instance._randomIndex(),parser$1.load(n,n,this),this._nextRequest=this._lastReservoirRefresh=this._lastReservoirIncrease=Date.now(),this._running=0,this._done=0,this._unblockTime=0,this.ready=this.Promise.resolve(),this.clients={},this._startHeartbeat()}_startHeartbeat(){var e;return null==this.heartbeat&&(null!=this.storeOptions.reservoirRefreshInterval&&null!=this.storeOptions.reservoirRefreshAmount||null!=this.storeOptions.reservoirIncreaseInterval&&null!=this.storeOptions.reservoirIncreaseAmount)?"function"==typeof(e=this.heartbeat=setInterval((()=>{var e,t,n,r,i;if(r=Date.now(),null!=this.storeOptions.reservoirRefreshInterval&&r>=this._lastReservoirRefresh+this.storeOptions.reservoirRefreshInterval&&(this._lastReservoirRefresh=r,this.storeOptions.reservoir=this.storeOptions.reservoirRefreshAmount,this.instance._drainAll(this.computeCapacity())),null!=this.storeOptions.reservoirIncreaseInterval&&r>=this._lastReservoirIncrease+this.storeOptions.reservoirIncreaseInterval){var o=this.storeOptions;if(e=o.reservoirIncreaseAmount,n=o.reservoirIncreaseMaximum,i=o.reservoir,this._lastReservoirIncrease=r,(t=null!=n?Math.min(e,n-i):e)>0)return this.storeOptions.reservoir+=t,this.instance._drainAll(this.computeCapacity())}}),this.heartbeatInterval)).unref?e.unref():void 0:clearInterval(this.heartbeat)}__publish__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t.instance.Events.trigger("message",e.toString())}))()}__disconnect__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),clearInterval(t.heartbeat),t.Promise.resolve()}))()}yieldLoop(e=0){return new this.Promise((function(t,n){return setTimeout(t,e)}))}computePenalty(){var e;return null!=(e=this.storeOptions.penalty)?e:15*this.storeOptions.minTime||5e3}__updateSettings__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),parser$1.overwrite(e,e,t.storeOptions),t._startHeartbeat(),t.instance._drainAll(t.computeCapacity()),!0}))()}__running__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._running}))()}__queued__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.instance.queued()}))()}__done__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._done}))()}__groupCheck__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t._nextRequest+t.timeout<e}))()}computeCapacity(){var e,t,n=this.storeOptions;return e=n.maxConcurrent,t=n.reservoir,null!=e&&null!=t?Math.min(e-this._running,t):null!=e?e-this._running:null!=t?t:null}conditionsCheck(e){var t;return null==(t=this.computeCapacity())||e<=t}__incrementReservoir__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=t.storeOptions.reservoir+=e,t.instance._drainAll(t.computeCapacity()),n}))()}__currentReservoir__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.storeOptions.reservoir}))()}isBlocked(e){return this._unblockTime>=e}check(e,t){return this.conditionsCheck(e)&&this._nextRequest-t<=0}__check__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=Date.now(),t.check(e,n)}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$2((function*(){var e,n;return yield r.yieldLoop(),e=Date.now(),r.conditionsCheck(t)?(r._running+=t,null!=r.storeOptions.reservoir&&(r.storeOptions.reservoir-=t),n=Math.max(r._nextRequest-e,0),r._nextRequest=e+n+r.storeOptions.minTime,{success:!0,wait:n,reservoir:r.storeOptions.reservoir}):{success:!1}}))()}strategyIsBlock(){return 3===this.storeOptions.strategy}__submit__(e,t){var n=this;return _asyncToGenerator$2((function*(){var r,i,o;if(yield n.yieldLoop(),null!=n.storeOptions.maxConcurrent&&t>n.storeOptions.maxConcurrent)throw new BottleneckError$2(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${n.storeOptions.maxConcurrent}`);return i=Date.now(),o=null!=n.storeOptions.highWater&&e===n.storeOptions.highWater&&!n.check(t,i),(r=n.strategyIsBlock()&&(o||n.isBlocked(i)))&&(n._unblockTime=i+n.computePenalty(),n._nextRequest=n._unblockTime+n.storeOptions.minTime,n.instance._dropAllQueued()),{reachedHWM:o,blocked:r,strategy:n.storeOptions.strategy}}))()}__free__(e,t){var n=this;return _asyncToGenerator$2((function*(){return yield n.yieldLoop(),n._running-=t,n._done+=t,n.instance._drainAll(n.computeCapacity()),{running:n._running}}))()}};var LocalDatastore_1=LocalDatastore,Scripts={},require$$0={"blacklist_client.lua":"local blacklist = ARGV[num_static_argv + 1]\n\nif redis.call('zscore', client_last_seen_key, blacklist) then\n redis.call('zadd', client_last_seen_key, 0, blacklist)\nend\n\n\nreturn {}\n","check.lua":"local weight = tonumber(ARGV[num_static_argv + 1])\n\nlocal capacity = process_tick(now, false)['capacity']\nlocal nextRequest = tonumber(redis.call('hget', settings_key, 'nextRequest'))\n\nreturn conditions_check(capacity, weight) and nextRequest - now <= 0\n","conditions_check.lua":"local conditions_check = function (capacity, weight)\n return capacity == nil or weight <= capacity\nend\n","current_reservoir.lua":"return process_tick(now, false)['reservoir']\n","done.lua":"process_tick(now, false)\n\nreturn tonumber(redis.call('hget', settings_key, 'done'))\n","free.lua":"local index = ARGV[num_static_argv + 1]\n\nredis.call('zadd', job_expirations_key, 0, index)\n\nreturn process_tick(now, false)['running']\n","get_time.lua":"redis.replicate_commands()\n\nlocal get_time = function ()\n local time = redis.call('time')\n\n return tonumber(time[1]..string.sub(time[2], 1, 3))\nend\n","group_check.lua":"return not (redis.call('exists', settings_key) == 1)\n","heartbeat.lua":"process_tick(now, true)\n","increment_reservoir.lua":"local incr = tonumber(ARGV[num_static_argv + 1])\n\nredis.call('hincrby', settings_key, 'reservoir', incr)\n\nlocal reservoir = process_tick(now, true)['reservoir']\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn reservoir\n","init.lua":"local clear = tonumber(ARGV[num_static_argv + 1])\nlocal limiter_version = ARGV[num_static_argv + 2]\nlocal num_local_argv = num_static_argv + 2\n\nif clear == 1 then\n redis.call('del', unpack(KEYS))\nend\n\nif redis.call('exists', settings_key) == 0 then\n -- Create\n local args = {'hmset', settings_key}\n\n for i = num_local_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\n end\n\n redis.call(unpack(args))\n redis.call('hmset', settings_key,\n 'nextRequest', now,\n 'lastReservoirRefresh', now,\n 'lastReservoirIncrease', now,\n 'running', 0,\n 'done', 0,\n 'unblockTime', 0,\n 'capacityPriorityCounter', 0\n )\n\nelse\n -- Apply migrations\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'version'\n )\n local id = settings[1]\n local current_version = settings[2]\n\n if current_version ~= limiter_version then\n local version_digits = {}\n for k, v in string.gmatch(current_version, \"([^.]+)\") do\n table.insert(version_digits, tonumber(k))\n end\n\n -- 2.10.0\n if version_digits[2] < 10 then\n redis.call('hsetnx', settings_key, 'reservoirRefreshInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirRefreshAmount', '')\n redis.call('hsetnx', settings_key, 'lastReservoirRefresh', '')\n redis.call('hsetnx', settings_key, 'done', 0)\n redis.call('hset', settings_key, 'version', '2.10.0')\n end\n\n -- 2.11.1\n if version_digits[2] < 11 or (version_digits[2] == 11 and version_digits[3] < 1) then\n if redis.call('hstrlen', settings_key, 'lastReservoirRefresh') == 0 then\n redis.call('hmset', settings_key,\n 'lastReservoirRefresh', now,\n 'version', '2.11.1'\n )\n end\n end\n\n -- 2.14.0\n if version_digits[2] < 14 then\n local old_running_key = 'b_'..id..'_running'\n local old_executing_key = 'b_'..id..'_executing'\n\n if redis.call('exists', old_running_key) == 1 then\n redis.call('rename', old_running_key, job_weights_key)\n end\n if redis.call('exists', old_executing_key) == 1 then\n redis.call('rename', old_executing_key, job_expirations_key)\n end\n redis.call('hset', settings_key, 'version', '2.14.0')\n end\n\n -- 2.15.2\n if version_digits[2] < 15 or (version_digits[2] == 15 and version_digits[3] < 2) then\n redis.call('hsetnx', settings_key, 'capacityPriorityCounter', 0)\n redis.call('hset', settings_key, 'version', '2.15.2')\n end\n\n -- 2.17.0\n if version_digits[2] < 17 then\n redis.call('hsetnx', settings_key, 'clientTimeout', 10000)\n redis.call('hset', settings_key, 'version', '2.17.0')\n end\n\n -- 2.18.0\n if version_digits[2] < 18 then\n redis.call('hsetnx', settings_key, 'reservoirIncreaseInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseAmount', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseMaximum', '')\n redis.call('hsetnx', settings_key, 'lastReservoirIncrease', now)\n redis.call('hset', settings_key, 'version', '2.18.0')\n end\n\n end\n\n process_tick(now, false)\nend\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","process_tick.lua":"local process_tick = function (now, always_publish)\n\n local compute_capacity = function (maxConcurrent, running, reservoir)\n if maxConcurrent ~= nil and reservoir ~= nil then\n return math.min((maxConcurrent - running), reservoir)\n elseif maxConcurrent ~= nil then\n return maxConcurrent - running\n elseif reservoir ~= nil then\n return reservoir\n else\n return nil\n end\n end\n\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'running',\n 'reservoir',\n 'reservoirRefreshInterval',\n 'reservoirRefreshAmount',\n 'lastReservoirRefresh',\n 'reservoirIncreaseInterval',\n 'reservoirIncreaseAmount',\n 'reservoirIncreaseMaximum',\n 'lastReservoirIncrease',\n 'capacityPriorityCounter',\n 'clientTimeout'\n )\n local id = settings[1]\n local maxConcurrent = tonumber(settings[2])\n local running = tonumber(settings[3])\n local reservoir = tonumber(settings[4])\n local reservoirRefreshInterval = tonumber(settings[5])\n local reservoirRefreshAmount = tonumber(settings[6])\n local lastReservoirRefresh = tonumber(settings[7])\n local reservoirIncreaseInterval = tonumber(settings[8])\n local reservoirIncreaseAmount = tonumber(settings[9])\n local reservoirIncreaseMaximum = tonumber(settings[10])\n local lastReservoirIncrease = tonumber(settings[11])\n local capacityPriorityCounter = tonumber(settings[12])\n local clientTimeout = tonumber(settings[13])\n\n local initial_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n --\n -- Process 'running' changes\n --\n local expired = redis.call('zrangebyscore', job_expirations_key, '-inf', '('..now)\n\n if #expired > 0 then\n redis.call('zremrangebyscore', job_expirations_key, '-inf', '('..now)\n\n local flush_batch = function (batch, acc)\n local weights = redis.call('hmget', job_weights_key, unpack(batch))\n redis.call('hdel', job_weights_key, unpack(batch))\n local clients = redis.call('hmget', job_clients_key, unpack(batch))\n redis.call('hdel', job_clients_key, unpack(batch))\n\n -- Calculate sum of removed weights\n for i = 1, #weights do\n acc['total'] = acc['total'] + (tonumber(weights[i]) or 0)\n end\n\n -- Calculate sum of removed weights by client\n local client_weights = {}\n for i = 1, #clients do\n local removed = tonumber(weights[i]) or 0\n if removed > 0 then\n acc['client_weights'][clients[i]] = (acc['client_weights'][clients[i]] or 0) + removed\n end\n end\n end\n\n local acc = {\n ['total'] = 0,\n ['client_weights'] = {}\n }\n local batch_size = 1000\n\n -- Compute changes to Zsets and apply changes to Hashes\n for i = 1, #expired, batch_size do\n local batch = {}\n for j = i, math.min(i + batch_size - 1, #expired) do\n table.insert(batch, expired[j])\n end\n\n flush_batch(batch, acc)\n end\n\n -- Apply changes to Zsets\n if acc['total'] > 0 then\n redis.call('hincrby', settings_key, 'done', acc['total'])\n running = tonumber(redis.call('hincrby', settings_key, 'running', -acc['total']))\n end\n\n for client, weight in pairs(acc['client_weights']) do\n redis.call('zincrby', client_running_key, -weight, client)\n end\n end\n\n --\n -- Process 'reservoir' changes\n --\n local reservoirRefreshActive = reservoirRefreshInterval ~= nil and reservoirRefreshAmount ~= nil\n if reservoirRefreshActive and now >= lastReservoirRefresh + reservoirRefreshInterval then\n reservoir = reservoirRefreshAmount\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirRefresh', now\n )\n end\n\n local reservoirIncreaseActive = reservoirIncreaseInterval ~= nil and reservoirIncreaseAmount ~= nil\n if reservoirIncreaseActive and now >= lastReservoirIncrease + reservoirIncreaseInterval then\n local num_intervals = math.floor((now - lastReservoirIncrease) / reservoirIncreaseInterval)\n local incr = reservoirIncreaseAmount * num_intervals\n if reservoirIncreaseMaximum ~= nil then\n incr = math.min(incr, reservoirIncreaseMaximum - (reservoir or 0))\n end\n if incr > 0 then\n reservoir = (reservoir or 0) + incr\n end\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirIncrease', lastReservoirIncrease + (num_intervals * reservoirIncreaseInterval)\n )\n end\n\n --\n -- Clear unresponsive clients\n --\n local unresponsive = redis.call('zrangebyscore', client_last_seen_key, '-inf', (now - clientTimeout))\n local unresponsive_lookup = {}\n local terminated_clients = {}\n for i = 1, #unresponsive do\n unresponsive_lookup[unresponsive[i]] = true\n if tonumber(redis.call('zscore', client_running_key, unresponsive[i])) == 0 then\n table.insert(terminated_clients, unresponsive[i])\n end\n end\n if #terminated_clients > 0 then\n redis.call('zrem', client_running_key, unpack(terminated_clients))\n redis.call('hdel', client_num_queued_key, unpack(terminated_clients))\n redis.call('zrem', client_last_registered_key, unpack(terminated_clients))\n redis.call('zrem', client_last_seen_key, unpack(terminated_clients))\n end\n\n --\n -- Broadcast capacity changes\n --\n local final_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n if always_publish or (initial_capacity ~= nil and final_capacity == nil) then\n -- always_publish or was not unlimited, now unlimited\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n\n elseif initial_capacity ~= nil and final_capacity ~= nil and final_capacity > initial_capacity then\n -- capacity was increased\n -- send the capacity message to the limiter having the lowest number of running jobs\n -- the tiebreaker is the limiter having not registered a job in the longest time\n\n local lowest_concurrency_value = nil\n local lowest_concurrency_clients = {}\n local lowest_concurrency_last_registered = {}\n local client_concurrencies = redis.call('zrange', client_running_key, 0, -1, 'withscores')\n\n for i = 1, #client_concurrencies, 2 do\n local client = client_concurrencies[i]\n local concurrency = tonumber(client_concurrencies[i+1])\n\n if (\n lowest_concurrency_value == nil or lowest_concurrency_value == concurrency\n ) and (\n not unresponsive_lookup[client]\n ) and (\n tonumber(redis.call('hget', client_num_queued_key, client)) > 0\n ) then\n lowest_concurrency_value = concurrency\n table.insert(lowest_concurrency_clients, client)\n local last_registered = tonumber(redis.call('zscore', client_last_registered_key, client))\n table.insert(lowest_concurrency_last_registered, last_registered)\n end\n end\n\n if #lowest_concurrency_clients > 0 then\n local position = 1\n local earliest = lowest_concurrency_last_registered[1]\n\n for i,v in ipairs(lowest_concurrency_last_registered) do\n if v < earliest then\n position = i\n earliest = v\n end\n end\n\n local next_client = lowest_concurrency_clients[position]\n redis.call('publish', 'b_'..id,\n 'capacity-priority:'..(final_capacity or '')..\n ':'..next_client..\n ':'..capacityPriorityCounter\n )\n redis.call('hincrby', settings_key, 'capacityPriorityCounter', '1')\n else\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n end\n end\n\n return {\n ['capacity'] = final_capacity,\n ['running'] = running,\n ['reservoir'] = reservoir\n }\nend\n","queued.lua":"local clientTimeout = tonumber(redis.call('hget', settings_key, 'clientTimeout'))\nlocal valid_clients = redis.call('zrangebyscore', client_last_seen_key, (now - clientTimeout), 'inf')\nlocal client_queued = redis.call('hmget', client_num_queued_key, unpack(valid_clients))\n\nlocal sum = 0\nfor i = 1, #client_queued do\n sum = sum + tonumber(client_queued[i])\nend\n\nreturn sum\n","refresh_expiration.lua":"local refresh_expiration = function (now, nextRequest, groupTimeout)\n\n if groupTimeout ~= nil then\n local ttl = (nextRequest + groupTimeout) - now\n\n for i = 1, #KEYS do\n redis.call('pexpire', KEYS[i], ttl)\n end\n end\n\nend\n","refs.lua":"local settings_key = KEYS[1]\nlocal job_weights_key = KEYS[2]\nlocal job_expirations_key = KEYS[3]\nlocal job_clients_key = KEYS[4]\nlocal client_running_key = KEYS[5]\nlocal client_num_queued_key = KEYS[6]\nlocal client_last_registered_key = KEYS[7]\nlocal client_last_seen_key = KEYS[8]\n\nlocal now = tonumber(ARGV[1])\nlocal client = ARGV[2]\n\nlocal num_static_argv = 2\n","register.lua":"local index = ARGV[num_static_argv + 1]\nlocal weight = tonumber(ARGV[num_static_argv + 2])\nlocal expiration = tonumber(ARGV[num_static_argv + 3])\n\nlocal state = process_tick(now, false)\nlocal capacity = state['capacity']\nlocal reservoir = state['reservoir']\n\nlocal settings = redis.call('hmget', settings_key,\n 'nextRequest',\n 'minTime',\n 'groupTimeout'\n)\nlocal nextRequest = tonumber(settings[1])\nlocal minTime = tonumber(settings[2])\nlocal groupTimeout = tonumber(settings[3])\n\nif conditions_check(capacity, weight) then\n\n redis.call('hincrby', settings_key, 'running', weight)\n redis.call('hset', job_weights_key, index, weight)\n if expiration ~= nil then\n redis.call('zadd', job_expirations_key, now + expiration, index)\n end\n redis.call('hset', job_clients_key, index, client)\n redis.call('zincrby', client_running_key, weight, client)\n redis.call('hincrby', client_num_queued_key, client, -1)\n redis.call('zadd', client_last_registered_key, now, client)\n\n local wait = math.max(nextRequest - now, 0)\n local newNextRequest = now + wait + minTime\n\n if reservoir == nil then\n redis.call('hset', settings_key,\n 'nextRequest', newNextRequest\n )\n else\n reservoir = reservoir - weight\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'nextRequest', newNextRequest\n )\n end\n\n refresh_expiration(now, newNextRequest, groupTimeout)\n\n return {true, wait, reservoir}\n\nelse\n return {false}\nend\n","register_client.lua":"local queued = tonumber(ARGV[num_static_argv + 1])\n\n-- Could have been re-registered concurrently\nif not redis.call('zscore', client_last_seen_key, client) then\n redis.call('zadd', client_running_key, 0, client)\n redis.call('hset', client_num_queued_key, client, queued)\n redis.call('zadd', client_last_registered_key, 0, client)\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n\nreturn {}\n","running.lua":"return process_tick(now, false)['running']\n","submit.lua":"local queueLength = tonumber(ARGV[num_static_argv + 1])\nlocal weight = tonumber(ARGV[num_static_argv + 2])\n\nlocal capacity = process_tick(now, false)['capacity']\n\nlocal settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'highWater',\n 'nextRequest',\n 'strategy',\n 'unblockTime',\n 'penalty',\n 'minTime',\n 'groupTimeout'\n)\nlocal id = settings[1]\nlocal maxConcurrent = tonumber(settings[2])\nlocal highWater = tonumber(settings[3])\nlocal nextRequest = tonumber(settings[4])\nlocal strategy = tonumber(settings[5])\nlocal unblockTime = tonumber(settings[6])\nlocal penalty = tonumber(settings[7])\nlocal minTime = tonumber(settings[8])\nlocal groupTimeout = tonumber(settings[9])\n\nif maxConcurrent ~= nil and weight > maxConcurrent then\n return redis.error_reply('OVERWEIGHT:'..weight..':'..maxConcurrent)\nend\n\nlocal reachedHWM = (highWater ~= nil and queueLength == highWater\n and not (\n conditions_check(capacity, weight)\n and nextRequest - now <= 0\n )\n)\n\nlocal blocked = strategy == 3 and (reachedHWM or unblockTime >= now)\n\nif blocked then\n local computedPenalty = penalty\n if computedPenalty == nil then\n if minTime == 0 then\n computedPenalty = 5000\n else\n computedPenalty = 15 * minTime\n end\n end\n\n local newNextRequest = now + computedPenalty + minTime\n\n redis.call('hmset', settings_key,\n 'unblockTime', now + computedPenalty,\n 'nextRequest', newNextRequest\n )\n\n local clients_queued_reset = redis.call('hkeys', client_num_queued_key)\n local queued_reset = {}\n for i = 1, #clients_queued_reset do\n table.insert(queued_reset, clients_queued_reset[i])\n table.insert(queued_reset, 0)\n end\n redis.call('hmset', client_num_queued_key, unpack(queued_reset))\n\n redis.call('publish', 'b_'..id, 'blocked:')\n\n refresh_expiration(now, newNextRequest, groupTimeout)\nend\n\nif not blocked and not reachedHWM then\n redis.call('hincrby', client_num_queued_key, client, 1)\nend\n\nreturn {reachedHWM, blocked, strategy}\n","update_settings.lua":"local args = {'hmset', settings_key}\n\nfor i = num_static_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\nend\n\nredis.call(unpack(args))\n\nprocess_tick(now, true)\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","validate_client.lua":"if not redis.call('zscore', client_last_seen_key, client) then\n return redis.error_reply('UNKNOWN_CLIENT')\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n","validate_keys.lua":"if not (redis.call('exists', settings_key) == 1) then\n return redis.error_reply('SETTINGS_KEY_NOT_FOUND')\nend\n"},hasRequiredScripts,RedisConnection_1,hasRequiredRedisConnection,IORedisConnection_1,hasRequiredIORedisConnection,BottleneckError$1,IORedisConnection,RedisConnection,RedisDatastore,parser;function requireScripts(){return hasRequiredScripts||(hasRequiredScripts=1,function(e){var t,n,r;t={refs:(n=require$$0)["refs.lua"],validate_keys:n["validate_keys.lua"],validate_client:n["validate_client.lua"],refresh_expiration:n["refresh_expiration.lua"],process_tick:n["process_tick.lua"],conditions_check:n["conditions_check.lua"],get_time:n["get_time.lua"]},e.allKeys=function(e){return[`b_${e}_settings`,`b_${e}_job_weights`,`b_${e}_job_expirations`,`b_${e}_job_clients`,`b_${e}_client_running`,`b_${e}_client_num_queued`,`b_${e}_client_last_registered`,`b_${e}_client_last_seen`]},r={init:{keys:e.allKeys,headers:["process_tick"],refresh_expiration:!0,code:n["init.lua"]},group_check:{keys:e.allKeys,headers:[],refresh_expiration:!1,code:n["group_check.lua"]},register_client:{keys:e.allKeys,headers:["validate_keys"],refresh_expiration:!1,code:n["register_client.lua"]},blacklist_client:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["blacklist_client.lua"]},heartbeat:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["heartbeat.lua"]},update_settings:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["update_settings.lua"]},running:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["running.lua"]},queued:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["queued.lua"]},done:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["done.lua"]},check:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!1,code:n["check.lua"]},submit:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["submit.lua"]},register:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["register.lua"]},free:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["free.lua"]},current_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["current_reservoir.lua"]},increment_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["increment_reservoir.lua"]}},e.names=Object.keys(r),e.keys=function(e,t){return r[e].keys(t)},e.payload=function(e){var n;return n=r[e],Array.prototype.concat(t.refs,n.headers.map((function(e){return t[e]})),n.refresh_expiration?t.refresh_expiration:"",n.code).join("\n")}}(Scripts)),Scripts}function requireRedisConnection(){if(hasRequiredRedisConnection)return RedisConnection_1;function asyncGeneratorStep(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep(o,r,i,s,a,"throw",e)}s(void 0)}))}}var Events,RedisConnection,Scripts,parser;return hasRequiredRedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),RedisConnection=function(){class RedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("redis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null==this.client&&(this.client=this.Redis.createClient(this.clientOptions)),this.subscriber=this.client.duplicate(),this.limiters={},this.shas={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>this._loadScripts())).then((()=>({client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),e.ready?n():e.once("ready",n))))}_loadScript(e){return new this.Promise(((t,n)=>{var r;return r=Scripts.payload(e),this.client.multi([["script","load",r]]).exec(((r,i)=>null!=r?n(r):(this.shas[e]=i[0],t(i[0]))))}))}_loadScripts(){return this.Promise.all(Scripts.names.map((e=>this._loadScript(e))))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){return yield t.ready,new t.Promise(((n,r)=>t.client.multi([e]).exec_atomic((function(e,t){return null!=e?r(e):n(t[0])}))))}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>{var i;return i=r=>{if(r===t)return this.subscriber.removeListener("subscribe",i),this.limiters[t]=e,n()},this.subscriber.on("subscribe",i),this.subscriber.subscribe(t)})))))}__removeLimiter__(e){var t=this;return this.Promise.all([e.channel(),e.channel_client()].map(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield new t.Promise(((n,r)=>t.subscriber.unsubscribe(e,(function(t,i){return null!=t?r(t):i===e?n():void 0}))))),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}()))}__scriptArgs__(e,t,n,r){var i;return i=Scripts.keys(e,t),[this.shas[e],i.length].concat(i,n,r)}__scriptFn__(e){return this.client.evalsha.bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,this.client.end(e),this.subscriber.end(e),this.Promise.resolve()}}return RedisConnection.prototype.datastore="redis",RedisConnection.prototype.defaults={Redis:null,clientOptions:{},client:null,Promise:Promise,Events:null},RedisConnection}.call(void 0),RedisConnection_1=RedisConnection,RedisConnection_1}function requireIORedisConnection(){if(hasRequiredIORedisConnection)return IORedisConnection_1;function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep(o,r,i,s,a,"throw",e)}s(void 0)}))}}var Events,IORedisConnection,Scripts,parser;return hasRequiredIORedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),IORedisConnection=function(){class IORedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("ioredis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null!=this.clusterNodes?(this.client=new this.Redis.Cluster(this.clusterNodes,this.clientOptions),this.subscriber=new this.Redis.Cluster(this.clusterNodes,this.clientOptions)):null!=this.client&&null==this.client.duplicate?this.subscriber=new this.Redis.Cluster(this.client.startupNodes,this.client.options):(null==this.client&&(this.client=new this.Redis(this.clientOptions)),this.subscriber=this.client.duplicate()),this.limiters={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>(this._loadScripts(),{client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),"ready"===e.status?n():e.once("ready",n))))}_loadScripts(){return Scripts.names.forEach((e=>this.client.defineCommand(e,{lua:Scripts.payload(e)})))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){yield t.ready;var n=_slicedToArray(yield t.client.pipeline([e]).exec(),1),r=_slicedToArray(n[0],2);return r[0],r[1]}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>this.subscriber.subscribe(t,(()=>(this.limiters[t]=e,n()))))))))}__removeLimiter__(e){var t=this;return[e.channel(),e.channel_client()].forEach(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield t.subscriber.unsubscribe(e)),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}())}__scriptArgs__(e,t,n,r){var i;return[(i=Scripts.keys(e,t)).length].concat(i,n,r)}__scriptFn__(e){return this.client[e].bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,e?this.Promise.all([this.client.quit(),this.subscriber.quit()]):(this.client.disconnect(),this.subscriber.disconnect(),this.Promise.resolve())}}return IORedisConnection.prototype.datastore="ioredis",IORedisConnection.prototype.defaults={Redis:null,clientOptions:{},clusterNodes:null,client:null,Promise:Promise,Events:null},IORedisConnection}.call(void 0),IORedisConnection_1=IORedisConnection,IORedisConnection_1}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep$1(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$1(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$1(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$1(o,r,i,s,a,"throw",e)}s(void 0)}))}}parser=parser$3,BottleneckError$1=requireBottleneckError(),RedisConnection=requireRedisConnection(),IORedisConnection=requireIORedisConnection(),RedisDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.originalId=this.instance.id,this.clientId=this.instance._randomIndex(),parser.load(n,n,this),this.clients={},this.capacityPriorityCounters={},this.sharedConnection=null!=this.connection,null==this.connection&&(this.connection="redis"===this.instance.datastore?new RedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,Promise:this.Promise,Events:this.instance.Events}):"ioredis"===this.instance.datastore?new IORedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,clusterNodes:this.clusterNodes,Promise:this.Promise,Events:this.instance.Events}):void 0),this.instance.connection=this.connection,this.instance.datastore=this.connection.datastore,this.ready=this.connection.ready.then((e=>(this.clients=e,this.runScript("init",this.prepareInitSettings(this.clearDatastore))))).then((()=>this.connection.__addLimiter__(this.instance))).then((()=>this.runScript("register_client",[this.instance.queued()]))).then((()=>{var e;return"function"==typeof(e=this.heartbeat=setInterval((()=>this.runScript("heartbeat",[]).catch((e=>this.instance.Events.trigger("error",e)))),this.heartbeatInterval)).unref&&e.unref(),this.clients}))}__publish__(e){var t=this;return _asyncToGenerator$1((function*(){return(yield t.ready).client.publish(t.instance.channel(),`message:${e.toString()}`)}))()}onMessage(e,t){var n=this;return _asyncToGenerator$1((function*(){var e,r,i,o,s,a,c,u,l,d;try{c=t.indexOf(":");var p=[t.slice(0,c),t.slice(c+1)];if(i=p[1],"capacity"===(d=p[0]))return yield n.instance._drainAll(i.length>0?~~i:void 0);if("capacity-priority"===d){var m=_slicedToArray(i.split(":"),3);return l=m[0],u=m[1],r=m[2],e=l.length>0?~~l:void 0,u===n.clientId?(o=yield n.instance._drainAll(e),a=null!=e?e-(o||0):"",yield n.clients.client.publish(n.instance.channel(),`capacity-priority:${a}::${r}`)):""===u?(clearTimeout(n.capacityPriorityCounters[r]),delete n.capacityPriorityCounters[r],n.instance._drainAll(e)):n.capacityPriorityCounters[r]=setTimeout(_asyncToGenerator$1((function*(){var t;try{return delete n.capacityPriorityCounters[r],yield n.runScript("blacklist_client",[u]),yield n.instance._drainAll(e)}catch(e){return t=e,n.instance.Events.trigger("error",t)}})),1e3)}if("message"===d)return n.instance.Events.trigger("message",i);if("blocked"===d)return yield n.instance._dropAllQueued()}catch(e){return s=e,n.instance.Events.trigger("error",s)}}))()}__disconnect__(e){return clearInterval(this.heartbeat),this.sharedConnection?this.connection.__removeLimiter__(this.instance):this.connection.disconnect(e)}runScript(e,t){var n=this;return _asyncToGenerator$1((function*(){return"init"!==e&&"register_client"!==e&&(yield n.ready),new n.Promise(((r,i)=>{var o,s;return o=[Date.now(),n.clientId].concat(t),n.instance.Events.trigger("debug",`Calling Redis script: ${e}.lua`,o),s=n.connection.__scriptArgs__(e,n.originalId,o,(function(e,t){return null!=e?i(e):r(t)})),n.connection.__scriptFn__(e)(...s)})).catch((r=>"SETTINGS_KEY_NOT_FOUND"===r.message?"heartbeat"===e?n.Promise.resolve():n.runScript("init",n.prepareInitSettings(!1)).then((()=>n.runScript(e,t))):"UNKNOWN_CLIENT"===r.message?n.runScript("register_client",[n.instance.queued()]).then((()=>n.runScript(e,t))):n.Promise.reject(r)))}))()}prepareArray(e){var t,n,r,i;for(r=[],t=0,n=e.length;t<n;t++)i=e[t],r.push(null!=i?i.toString():"");return r}prepareObject(e){var t,n,r;for(n in t=[],e)r=e[n],t.push(n,null!=r?r.toString():"");return t}prepareInitSettings(e){var t;return(t=this.prepareObject(Object.assign({},this.storeOptions,{id:this.originalId,version:this.instance.version,groupTimeout:this.timeout,clientTimeout:this.clientTimeout}))).unshift(e?1:0,this.instance.version),t}convertBool(e){return!!e}__updateSettings__(e){var t=this;return _asyncToGenerator$1((function*(){return yield t.runScript("update_settings",t.prepareObject(e)),parser.overwrite(e,e,t.storeOptions)}))()}__running__(){return this.runScript("running",[])}__queued__(){return this.runScript("queued",[])}__done__(){return this.runScript("done",[])}__groupCheck__(){var e=this;return _asyncToGenerator$1((function*(){return e.convertBool(yield e.runScript("group_check",[]))}))()}__incrementReservoir__(e){return this.runScript("increment_reservoir",[e])}__currentReservoir__(){return this.runScript("current_reservoir",[])}__check__(e){var t=this;return _asyncToGenerator$1((function*(){return t.convertBool(yield t.runScript("check",t.prepareArray([e])))}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$1((function*(){var i,o,s,a=_slicedToArray(yield r.runScript("register",r.prepareArray([e,t,n])),3);return o=a[0],s=a[1],i=a[2],{success:r.convertBool(o),wait:s,reservoir:i}}))()}__submit__(e,t){var n=this;return _asyncToGenerator$1((function*(){var r,i,o,s,a;try{var c=_slicedToArray(yield n.runScript("submit",n.prepareArray([e,t])),3);return s=c[0],r=c[1],a=c[2],{reachedHWM:n.convertBool(s),blocked:n.convertBool(r),strategy:a}}catch(e){if(0===(i=e).message.indexOf("OVERWEIGHT")){var u=_slicedToArray(i.message.split(":"),3);throw u[0],t=u[1],o=u[2],new BottleneckError$1(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${o}`)}throw i}}))()}__free__(e,t){var n=this;return _asyncToGenerator$1((function*(){return{running:yield n.runScript("free",n.prepareArray([e]))}}))()}};var RedisDatastore_1=RedisDatastore,BottleneckError,States;BottleneckError=requireBottleneckError(),States=class{constructor(e){this.status=e,this._jobs={},this.counts=this.status.map((function(){return 0}))}next(e){var t,n;return n=(t=this._jobs[e])+1,null!=t&&n<this.status.length?(this.counts[t]--,this.counts[n]++,this._jobs[e]++):null!=t?(this.counts[t]--,delete this._jobs[e]):void 0}start(e){return 0,this._jobs[e]=0,this.counts[0]++}remove(e){var t;return null!=(t=this._jobs[e])&&(this.counts[t]--,delete this._jobs[e]),null!=t}jobStatus(e){var t;return null!=(t=this.status[this._jobs[e]])?t:null}statusJobs(e){var t,n,r,i;if(null!=e){if((n=this.status.indexOf(e))<0)throw new BottleneckError(`status must be one of ${this.status.join(", ")}`);for(t in i=[],r=this._jobs)r[t]===n&&i.push(t);return i}return Object.keys(this._jobs)}statusCounts(){return this.counts.reduce(((e,t,n)=>(e[this.status[n]]=t,e)),{})}};var States_1=States,DLList,Sync;function asyncGeneratorStep(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep(o,r,i,s,a,"throw",e)}s(void 0)}))}}DLList=DLList_1,Sync=class{constructor(e,t){this.schedule=this.schedule.bind(this),this.name=e,this.Promise=t,this._running=0,this._queue=new DLList}isEmpty(){return 0===this._queue.length}_tryToRun(){var e=this;return _asyncToGenerator((function*(){var t,n,r,i,o,s,a;if(e._running<1&&e._queue.length>0){e._running++;var c=e._queue.shift();return a=c.task,t=c.args,o=c.resolve,i=c.reject,n=yield _asyncToGenerator((function*(){try{return s=yield a(...t),function(){return o(s)}}catch(e){return r=e,function(){return i(r)}}}))(),e._running--,e._tryToRun(),n()}}))()}schedule(e,...t){var n,r,i;return i=r=null,n=new this.Promise((function(e,t){return i=e,r=t})),this._queue.push({task:e,args:t,resolve:i,reject:r}),this._tryToRun(),n}};var Sync_1=Sync;const version="2.19.5";var require$$8={version:version},Group_1,hasRequiredGroup,Batcher_1,hasRequiredBatcher,Bottleneck_1,hasRequiredBottleneck;function requireGroup(){if(hasRequiredGroup)return Group_1;function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function t(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=e.apply(n,r);function a(e){t(s,i,o,a,c,"next",e)}function c(e){t(s,i,o,a,c,"throw",e)}a(void 0)}))}}var r,i,o,s,a,c;return hasRequiredGroup=1,c=parser$3,r=Events_1,s=requireRedisConnection(),o=requireIORedisConnection(),a=requireScripts(),i=function(){class t{constructor(e={}){this.deleteKey=this.deleteKey.bind(this),this.limiterOptions=e,c.load(this.limiterOptions,this.defaults,this),this.Events=new r(this),this.instances={},this.Bottleneck=requireBottleneck(),this._startAutoCleanup(),this.sharedConnection=null!=this.connection,null==this.connection&&("redis"===this.limiterOptions.datastore?this.connection=new s(Object.assign({},this.limiterOptions,{Events:this.Events})):"ioredis"===this.limiterOptions.datastore&&(this.connection=new o(Object.assign({},this.limiterOptions,{Events:this.Events}))))}key(e=""){var t;return null!=(t=this.instances[e])?t:(()=>{var t;return t=this.instances[e]=new this.Bottleneck(Object.assign(this.limiterOptions,{id:`${this.id}-${e}`,timeout:this.timeout,connection:this.connection})),this.Events.trigger("created",t,e),t})()}deleteKey(e=""){var t=this;return n((function*(){var n,r;return r=t.instances[e],t.connection&&(n=yield t.connection.__runCommand__(["del",...a.allKeys(`${t.id}-${e}`)])),null!=r&&(delete t.instances[e],yield r.disconnect()),null!=r||n>0}))()}limiters(){var e,t,n,r;for(e in n=[],t=this.instances)r=t[e],n.push({key:e,limiter:r});return n}keys(){return Object.keys(this.instances)}clusterKeys(){var t=this;return n((function*(){var n,r,i,o,s,a,c;if(null==t.connection)return t.Promise.resolve(t.keys());for(s=[],n=null,c=`b_${t.id}-`.length,9;0!==n;){var u=e(yield t.connection.__runCommand__(["scan",null!=n?n:0,"match",`b_${t.id}-*_settings`,"count",1e4]),2);for(n=~~u[0],i=0,a=(r=u[1]).length;i<a;i++)o=r[i],s.push(o.slice(c,-9))}return s}))()}_startAutoCleanup(){var e,t=this;return clearInterval(this.interval),"function"==typeof(e=this.interval=setInterval(n((function*(){var e,n,r,i,o,s;for(n in o=Date.now(),i=[],r=t.instances){s=r[n];try{(yield s._store.__groupCheck__(o))?i.push(t.deleteKey(n)):i.push(void 0)}catch(t){e=t,i.push(s.Events.trigger("error",e))}}return i})),this.timeout/2)).unref?e.unref():void 0}updateSettings(e={}){if(c.overwrite(e,this.defaults,this),c.overwrite(e,e,this.limiterOptions),null!=e.timeout)return this._startAutoCleanup()}disconnect(e=!0){var t;if(!this.sharedConnection)return null!=(t=this.connection)?t.disconnect(e):void 0}}return t.prototype.defaults={timeout:3e5,connection:null,Promise:Promise,id:"group-key"},t}.call(void 0),Group_1=i}function requireBatcher(){return hasRequiredBatcher?Batcher_1:(hasRequiredBatcher=1,n=parser$3,t=Events_1,e=function(){class e{constructor(e={}){this.options=e,n.load(this.options,this.defaults,this),this.Events=new t(this),this._arr=[],this._resetPromise(),this._lastFlush=Date.now()}_resetPromise(){return this._promise=new this.Promise(((e,t)=>this._resolve=e))}_flush(){return clearTimeout(this._timeout),this._lastFlush=Date.now(),this._resolve(),this.Events.trigger("batch",this._arr),this._arr=[],this._resetPromise()}add(e){var t;return this._arr.push(e),t=this._promise,this._arr.length===this.maxSize?this._flush():null!=this.maxTime&&1===this._arr.length&&(this._timeout=setTimeout((()=>this._flush()),this.maxTime)),t}}return e.prototype.defaults={maxTime:null,maxSize:null,Promise:Promise},e}.call(void 0),Batcher_1=e);var e,t,n}function requireBottleneck(){if(hasRequiredBottleneck)return Bottleneck_1;function e(e,t){return r(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||n()}function t(e){return r(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(e){if(Array.isArray(e))return e}function i(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var s=e.apply(t,n);function a(e){i(s,r,o,a,c,"next",e)}function c(e){i(s,r,o,a,c,"throw",e)}a(void 0)}))}}hasRequiredBottleneck=1;var s,a,c,u,l,d,p,m,h,f=[].splice;return 10,5,h=parser$3,l=Queues_1,c=Job_1,u=LocalDatastore_1,d=RedisDatastore_1,a=Events_1,p=States_1,m=Sync_1,s=function(){class n{constructor(e={},...t){var r,i;this._addToQueue=this._addToQueue.bind(this),this._validateOptions(e,t),h.load(e,this.instanceDefaults,this),this._queues=new l(10),this._scheduled={},this._states=new p(["RECEIVED","QUEUED","RUNNING","EXECUTING"].concat(this.trackDoneStatus?["DONE"]:[])),this._limiter=null,this.Events=new a(this),this._submitLock=new m("submit",this.Promise),this._registerLock=new m("register",this.Promise),i=h.load(e,this.storeDefaults,{}),this._store=function(){if("redis"===this.datastore||"ioredis"===this.datastore||null!=this.connection)return r=h.load(e,this.redisStoreDefaults,{}),new d(this,i,r);if("local"===this.datastore)return r=h.load(e,this.localStoreDefaults,{}),new u(this,i,r);throw new n.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`)}.call(this),this._queues.on("leftzero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.ref?e.ref():void 0})),this._queues.on("zero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.unref?e.unref():void 0}))}_validateOptions(e,t){if(null==e||"object"!=typeof e||0!==t.length)throw new n.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.")}ready(){return this._store.ready}clients(){return this._store.clients}channel(){return`b_${this.id}`}channel_client(){return`b_${this.id}_${this._store.clientId}`}publish(e){return this._store.__publish__(e)}disconnect(e=!0){return this._store.__disconnect__(e)}chain(e){return this._limiter=e,this}queued(e){return this._queues.queued(e)}clusterQueued(){return this._store.__queued__()}empty(){return 0===this.queued()&&this._submitLock.isEmpty()}running(){return this._store.__running__()}done(){return this._store.__done__()}jobStatus(e){return this._states.jobStatus(e)}jobs(e){return this._states.statusJobs(e)}counts(){return this._states.statusCounts()}_randomIndex(){return Math.random().toString(36).slice(2)}check(e=1){return this._store.__check__(e)}_clearGlobalState(e){return null!=this._scheduled[e]&&(clearTimeout(this._scheduled[e].expiration),delete this._scheduled[e],!0)}_free(e,t,n,r){var i=this;return o((function*(){var t,o;try{if(o=(yield i._store.__free__(e,n.weight)).running,i.Events.trigger("debug",`Freed ${n.id}`,r),0===o&&i.empty())return i.Events.trigger("idle")}catch(e){return t=e,i.Events.trigger("error",t)}}))()}_run(e,t,n){var r,i,o;return t.doRun(),r=this._clearGlobalState.bind(this,e),o=this._run.bind(this,e,t),i=this._free.bind(this,e,t),this._scheduled[e]={timeout:setTimeout((()=>t.doExecute(this._limiter,r,o,i)),n),expiration:null!=t.options.expiration?setTimeout((function(){return t.doExpire(r,o,i)}),n+t.options.expiration):void 0,job:t}}_drainOne(e){return this._registerLock.schedule((()=>{var t,n,r,i,o;if(0===this.queued())return this.Promise.resolve(null);o=this._queues.getFirst();var s=r=o.first();return i=s.options,t=s.args,null!=e&&i.weight>e?this.Promise.resolve(null):(this.Events.trigger("debug",`Draining ${i.id}`,{args:t,options:i}),n=this._randomIndex(),this._store.__register__(n,i.weight,i.expiration).then((({success:e,wait:s,reservoir:a})=>{var c;return this.Events.trigger("debug",`Drained ${i.id}`,{success:e,args:t,options:i}),e?(o.shift(),(c=this.empty())&&this.Events.trigger("empty"),0===a&&this.Events.trigger("depleted",c),this._run(n,r,s),this.Promise.resolve(i.weight)):this.Promise.resolve(null)})))}))}_drainAll(e,t=0){return this._drainOne(e).then((n=>{var r;return null!=n?(r=null!=e?e-n:e,this._drainAll(r,t+n)):this.Promise.resolve(t)})).catch((e=>this.Events.trigger("error",e)))}_dropAllQueued(e){return this._queues.shiftAll((function(t){return t.doDrop({message:e})}))}stop(e={}){var t,r;return e=h.load(e,this.stopDefaults),r=e=>{var t;return t=()=>{var t;return(t=this._states.counts)[0]+t[1]+t[2]+t[3]===e},new this.Promise(((e,n)=>t()?e():this.on("done",(()=>{if(t())return this.removeAllListeners("done"),e()}))))},t=e.dropWaitingJobs?(this._run=function(t,n){return n.doDrop({message:e.dropErrorMessage})},this._drainOne=()=>this.Promise.resolve(null),this._registerLock.schedule((()=>this._submitLock.schedule((()=>{var t,n,i;for(t in n=this._scheduled)i=n[t],"RUNNING"===this.jobStatus(i.job.options.id)&&(clearTimeout(i.timeout),clearTimeout(i.expiration),i.job.doDrop({message:e.dropErrorMessage}));return this._dropAllQueued(e.dropErrorMessage),r(0)}))))):this.schedule({priority:9,weight:0},(()=>r(1))),this._receive=function(t){return t._reject(new n.prototype.BottleneckError(e.enqueueErrorMessage))},this.stop=()=>this.Promise.reject(new n.prototype.BottleneckError("stop() has already been called")),t}_addToQueue(e){var t=this;return o((function*(){var r,i,o,s,a,c,u;r=e.args,s=e.options;try{var l=yield t._store.__submit__(t.queued(),s.weight);a=l.reachedHWM,i=l.blocked,u=l.strategy}catch(n){return o=n,t.Events.trigger("debug",`Could not queue ${s.id}`,{args:r,options:s,error:o}),e.doDrop({error:o}),!1}return i?(e.doDrop(),!0):a&&(null!=(c=u===n.prototype.strategy.LEAK?t._queues.shiftLastFrom(s.priority):u===n.prototype.strategy.OVERFLOW_PRIORITY?t._queues.shiftLastFrom(s.priority+1):u===n.prototype.strategy.OVERFLOW?e:void 0)&&c.doDrop(),null==c||u===n.prototype.strategy.OVERFLOW)?(null==c&&e.doDrop(),a):(e.doQueue(a,i),t._queues.push(e),yield t._drainAll(),a)}))()}_receive(e){return null!=this._states.jobStatus(e.options.id)?(e._reject(new n.prototype.BottleneckError(`A job with the same id already exists (id=${e.options.id})`)),!1):(e.doReceive(),this._submitLock.schedule(this._addToQueue,e))}submit(...n){var r,i,o,s,a,u,l,d,p;"function"==typeof n[0]?(u=t(n),i=u[0],n=u.slice(1),l=e(f.call(n,-1),1),r=l[0],s=h.load({},this.jobDefaults)):(s=(d=t(n))[0],i=d[1],n=d.slice(2),p=e(f.call(n,-1),1),r=p[0],s=h.load(s,this.jobDefaults));return a=(...e)=>new this.Promise((function(t,n){return i(...e,(function(...e){return(null!=e[0]?n:t)(e)}))})),(o=new c(a,n,s,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise)).promise.then((function(e){return"function"==typeof r?r(...e):void 0})).catch((function(e){return Array.isArray(e)?"function"==typeof r?r(...e):void 0:"function"==typeof r?r(e):void 0})),this._receive(o)}schedule(...e){var n,r,i;if("function"==typeof e[0]){var o=t(e);i=o[0],e=o.slice(1),r={}}else{var s=t(e);r=s[0],i=s[1],e=s.slice(2)}return n=new c(i,e,r,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise),this._receive(n),n.promise}wrap(e){var t,n;return t=this.schedule.bind(this),(n=function(...n){return t(e.bind(this),...n)}).withOptions=function(n,...r){return t(n,e,...r)},n}updateSettings(e={}){var t=this;return o((function*(){return yield t._store.__updateSettings__(h.overwrite(e,t.storeDefaults)),h.overwrite(e,t.instanceDefaults,t),t}))()}currentReservoir(){return this._store.__currentReservoir__()}incrementReservoir(e=0){return this._store.__incrementReservoir__(e)}}return n.default=n,n.Events=a,n.version=n.prototype.version=require$$8.version,n.strategy=n.prototype.strategy={LEAK:1,OVERFLOW:2,OVERFLOW_PRIORITY:4,BLOCK:3},n.BottleneckError=n.prototype.BottleneckError=requireBottleneckError(),n.Group=n.prototype.Group=requireGroup(),n.RedisConnection=n.prototype.RedisConnection=requireRedisConnection(),n.IORedisConnection=n.prototype.IORedisConnection=requireIORedisConnection(),n.Batcher=n.prototype.Batcher=requireBatcher(),n.prototype.jobDefaults={priority:5,weight:1,expiration:null,id:"<no-id>"},n.prototype.storeDefaults={maxConcurrent:null,minTime:0,highWater:null,strategy:n.prototype.strategy.LEAK,penalty:null,reservoir:null,reservoirRefreshInterval:null,reservoirRefreshAmount:null,reservoirIncreaseInterval:null,reservoirIncreaseAmount:null,reservoirIncreaseMaximum:null},n.prototype.localStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:250},n.prototype.redisStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:5e3,clientTimeout:1e4,Redis:null,clientOptions:{},clusterNodes:null,clearDatastore:!1,connection:null},n.prototype.instanceDefaults={datastore:"local",connection:null,id:"<no-id>",rejectOnDrop:!0,trackDoneStatus:!1,Promise:Promise},n.prototype.stopDefaults={enqueueErrorMessage:"This limiter has been stopped and cannot accept new jobs.",dropWaitingJobs:!0,dropErrorMessage:"This limiter has been stopped."},n}.call(void 0),Bottleneck_1=s}var lib=requireBottleneck(),Bottleneck=getDefaultExportFromCjs(lib),browser="object"==typeof self?self.FormData:window.FormData,FormDataModule=getDefaultExportFromCjs(browser);const GRANT_TYPE$1="client_credentials",castClientOptionsToRequestParams=e=>{const{scope:t,clientId:n,clientSecret:r}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform client credentials grant');if(!r)throw new Error('Missing required "clientSecret" parameter to perform client credentials grant');return Object.assign({client_id:n,client_secret:r,grant_type:GRANT_TYPE$1},t?{scope:t}:{})},isEligible$1=e=>{try{return!!castClientOptionsToRequestParams(e)}catch(e){return!1}},requestToken$1=(e,t)=>e(castClientOptionsToRequestParams(t)),RESPONSE_TYPE="token",castToAuthorizationRequestParams=e=>{const{clientId:t,scope:n,state:r,redirectUri:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform implicit grant');return Object.assign(Object.assign({client_id:t,redirect_uri:i||window.location.href,response_type:RESPONSE_TYPE},n?{scope:n}:{}),r?{state:r}:{})},isEligibleForClientRedirect=e=>{try{return!!castToAuthorizationRequestParams(e)}catch(e){return!1}},getRedirectUrl=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams(e),{skipEmptyString:!0,skipNull:!0})}`,GRANT_TYPE="password",castToTokenRequestParams=e=>{const{username:t,password:n,scope:r,clientId:i,clientSecret:o}=e;if(!i)throw new Error('Missing required "clientId" parameter to perform password grant');if(!t)throw new Error('Missing required "username" parameter to perform password grant');if(!n)throw new Error('Missing required "password" parameter to perform password grant');return Object.assign(Object.assign({client_id:i,grant_type:GRANT_TYPE,password:n,username:t},r?{scope:r}:{}),o?{client_secret:o}:{})},isEligible=e=>{try{return!!castToTokenRequestParams(e)}catch(e){return!1}},requestToken=(e,t)=>e(castToTokenRequestParams(t));async function maybeUpdateToken(e,t,n,r=!1){if(!r&&e.get("accessToken"))return;const i=Object.assign(Object.assign({},n),{refreshToken:e.get("refreshToken")});if(isEligible$2(i))return e.set(await requestToken$2(t,i));if(isEligible(n))return e.set(await requestToken(t,n));if("undefined"!=typeof window&&n.implicit){const t=querystring.parse(window.location.hash),r=t&&t.access_token;if(r)return window.history.replaceState({},"",window.location.href.split("#")[0]),e.set({accessToken:r});if(isEligibleForClientRedirect(n))return void(window.location.href=getRedirectUrl(n))}return!r&&isEligible$3(n)?e.set(await requestToken$3(t,n)):n.authorizationRedirect&&isEligibleForClientRedirect$1(n)?n.authorizationRedirect(getRedirectUrl$1(n)):isEligible$1(n)?e.set(await requestToken$1(t,n)):void 0}function sleep(e){return new Promise((t=>setTimeout((()=>t(!0)),e)))}const requestLogger=makeLogger("REST API Request"),responseLogger=makeLogger("REST API Response"),RETRYABLE_STATUS_CODES=[401,408,429,502,503,504],TOKEN_REFRESH_STATUS_CODES=[401],queue=new Bottleneck({maxConcurrent:QUEUE_CONCURRENCY,minTime:QUEUE_DELAY,reservoir:QUEUE_RESERVOIR}),refillIntervalSet=new Set;function isFormData(e){return void 0!==e&&void 0!==e.formData}function refillReservoir(){if(0===refillIntervalSet.size){const e=setInterval((async()=>{const t=await queue.currentReservoir();return queue.empty()&&0===await queue.running()&&t>10?await queue.incrementReservoir(1)&&fnClearInterval(e)&&refillIntervalSet.delete(e):t<QUEUE_RESERVOIR?queue.incrementReservoir(1):fnClearInterval(e)&&refillIntervalSet.delete(e)}),QUEUE_RESERVOIR_REFILL_INTERVAL);return refillIntervalSet.add(e)}return refillIntervalSet}async function makeResultFromResponse(e){return RETRYABLE_STATUS_CODES.includes(e.status)?e.clone():e.ok?"application/json"!==e.headers.get("content-type")&&204!==e.status?new Error(`Response content type was "${e.headers.get("content-type")}" but expected JSON`):{body:204===e.status?"":await e.json(),status:e.status}:new Error(`${e.status} ${e.statusText}\n\n${await e.text()}`)}function responseWasSuccessful(e){return!RETRYABLE_STATUS_CODES.includes(e.status)}function makeApiRequest(e,t,n,r,i,o,s){return async(a,c)=>{if(c>0){if(c>n.requestMaxRetries){const e=`Maximum number of retries reached while retrying ${a.method} request ${a.path}.`;throw requestLogger.error(e),new Error(e)}requestLogger.warn(`Warning: encountered ${a.status}. Retrying ${a.method} request ${a.path} (retry #${c}).`),await sleep(Math.ceil(Math.random()*n.requestBackOffInterval*2**c))}if(await maybeUpdateToken(e,t,n,c>0&&TOKEN_REFRESH_STATUS_CODES.includes(a.status)),!e.get("accessToken"))throw new Error("Unable to get OAuth2 access token.");try{return refillReservoir()&&await queue.schedule((async()=>{var t,a,c;const u=r.toUpperCase(),l=o&&o.query?(i.includes("?")?"&":"?")+querystring.stringify(o.query,{skipEmptyString:!0,skipNull:!0}):"",d=`${n.apiUrl}/api${i}${l}`,p=o&&o.body,m=isFormData(p),h=isFormData(p)?p.formData:{},f=Object.entries(h).reduce(((e,[t,n])=>(e.append.apply(e,[t].concat(n)),e)),new FormDataModule),y=Object.assign(Object.assign(Object.assign(Object.assign({accept:"application/json",authorization:`Bearer ${e.get("accessToken")}`,"X-Allthings-Caller":`${n.serviceName?n.serviceName:process.env.SEVICE_NAME?process.env.SEVICE_NAME:"unknown service name"} --- clientID ${null!==(c=null!==(a=null===(t=n.clientId)||void 0===t?void 0:t.split("_")[0])&&void 0!==a?a:n.clientId)&&void 0!==c?c:"no client id present"}`},m?{}:{"content-type":"application/json"}),"undefined"==typeof window&&"undefined"==typeof document&&{"user-agent":USER_AGENT}),o&&o.headers?o.headers:{}),m&&f.getHeaders?f.getHeaders():{});process.env.LOG_REQUEST&&console.log({sdkLogs:{method:u,url:d}}),requestLogger.log(u,d,{body:p,headers:y});const g={body:m?f:JSON.stringify(p)},_=await fetch$1(d,Object.assign({cache:"no-cache",credentials:"omit",headers:y,method:u,mode:"cors"},m||p?g:{})),v=await makeResultFromResponse(_);return responseLogger.log(u,d,v instanceof Error?{error:v}:{body:v.body,status:_.status}),v instanceof Error&&s?{body:v.message,status:_.status}:v}))}catch(e){return e}}}async function request(e,t,n,r,i,o,s){const a=await until(responseWasSuccessful,makeApiRequest(e,t,n,r,i,o,s));if(a instanceof Error)throw requestLogger.log("Request Error",a,o),a;return s?a:a.body}const API_METHODS=[agentCreate,agentCreatePermissions,appCreate,appGetById,bucketCreate,bucketAddFile,bucketRemoveFile,bucketRemoveFilesInPath,bucketGet,conversationGetById,conversationCreateMessage,fileCreate,fileDelete,notificationSettingsResetByUser,notificationSettingsUpdateByUser,groupCreate,groupGetById,groupUpdateById,getGroups,lookupIds,notificationsGetByUser,notificationUpdateRead,notificationsUpdateReadByUser,propertyCreate,propertyGetById,propertyUpdateById,getProperties,serviceProviderCreate,serviceProviderGetById,serviceProviderUpdateById,registrationCodeCreate,registrationCodeUpdateById,registrationCodeDelete,registrationCodeGetById,ticketCreateOnUser,ticketCreateOnServiceProvider,ticketGetById,unitCreate,unitGetById,unitUpdateById,getUnits,userCreate,userGetById,userUpdateById,userChangePassword,userCreatePermission,userCreatePermissionBatch,userGetPermissions,userDeletePermission,userCheckInToUtilisationPeriod,userGetUtilisationPeriods,userGetByEmail,getCurrentUser,getUsers,userRelationCreate,userRelationDelete,userRelationsGetByUser,utilisationPeriodCreate,utilisationPeriodDelete,utilisationPeriodGetById,utilisationPeriodUpdateById,utilisationPeriodCheckInUser,utilisationPeriodCheckOutUser,utilisationPeriodAddRegistrationCode,bookingUpdateById,bookingGetById];function restClient(e=DEFAULT_API_WRAPPER_OPTIONS){const t=Object.assign(Object.assign({},DEFAULT_API_WRAPPER_OPTIONS),e);if(void 0===t.apiUrl)throw new Error("API URL is undefined.");if(void 0===t.oauthUrl)throw new Error("OAuth2 URL is undefined.");if(!t.clientId&&!t.accessToken&&!t.tokenStore&&"undefined"==typeof window)throw new Error('Missing required "clientId" or "accessToken" parameter .');const n=makeFetchTokenRequester(`${t.oauthUrl}/oauth/token`),r=t.tokenStore||createTokenStore({accessToken:t.accessToken,refreshToken:t.refreshToken}),i=partial(request,r,n,t),o=partial(del,i),s=partial(get,i),a=partial(post,i),c=partial(patch,i),u=partial(put,i),l={authorizationCode:{getUri:(e=t.state||pseudoRandomString())=>partial(getRedirectUrl$1,Object.assign(Object.assign({},t),{state:e}))(),requestToken:e=>requestAndSaveToStore(partial(requestToken$3,n,Object.assign(Object.assign({},t),{authorizationCode:e||t.authorizationCode})),r)},generateState:pseudoRandomString,refreshToken:e=>requestAndSaveToStore(partial(requestToken$2,n,Object.assign(Object.assign({},t),{refreshToken:e||r.get("refreshToken")})),r)},d=API_METHODS.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:(...e)=>t(d,...e)})),{delete:o,get:s,oauth:l,options:t,patch:c,post:a,put:u});return d}var EnumResource,EnumCountryCode,EnumLocale,EnumTimezone,EnumServiceProviderType,EnumCommunicationMethodType,EnumInputChannel,EnumLookupUserType;exports.EnumResource=void 0,EnumResource=exports.EnumResource||(exports.EnumResource={}),EnumResource.group="group",EnumResource.property="property",EnumResource.serviceProvider="propertyManager",EnumResource.registrationCode="registrationCode",EnumResource.unit="unit",EnumResource.user="user",EnumResource.utilisationPeriod="utilisationPeriod",exports.EnumCountryCode=void 0,EnumCountryCode=exports.EnumCountryCode||(exports.EnumCountryCode={}),EnumCountryCode.CH="CH",EnumCountryCode.DE="DE",EnumCountryCode.FR="FR",EnumCountryCode.IT="IT",EnumCountryCode.NL="NL",EnumCountryCode.PT="PT",EnumCountryCode.US="US",exports.EnumLocale=void 0,EnumLocale=exports.EnumLocale||(exports.EnumLocale={}),EnumLocale.ch_de="ch_DE",EnumLocale.ch_fr="ch_FR",EnumLocale.ch_it="ch_it",EnumLocale.de_DE="de_DE",EnumLocale.it_IT="it_IT",EnumLocale.fr_FR="fr_FR",EnumLocale.pt_PT="pt_PT",EnumLocale.en_US="en_US",exports.EnumTimezone=void 0,EnumTimezone=exports.EnumTimezone||(exports.EnumTimezone={}),EnumTimezone.EuropeBerlin="Europe/Berlin",EnumTimezone.EuropeLondon="Europe/London",EnumTimezone.EuropeSofia="Europe/Sofia",EnumTimezone.EuropeZurich="Europe/Zurich",EnumTimezone.UTC="UTC",exports.EnumServiceProviderType=void 0,EnumServiceProviderType=exports.EnumServiceProviderType||(exports.EnumServiceProviderType={}),EnumServiceProviderType.propertyManager="property-manager",EnumServiceProviderType.craftspeople="craftspeople",exports.EnumCommunicationMethodType=void 0,EnumCommunicationMethodType=exports.EnumCommunicationMethodType||(exports.EnumCommunicationMethodType={}),EnumCommunicationMethodType.email="email",exports.EnumInputChannel=void 0,EnumInputChannel=exports.EnumInputChannel||(exports.EnumInputChannel={}),EnumInputChannel.APP="app",EnumInputChannel.COCKPIT="cockpit",EnumInputChannel.CRAFTSMEN="craftsmen",EnumInputChannel.EMAIL="email",EnumInputChannel.PHONE="phone",EnumInputChannel.WHATS_APP="whats_app",exports.EnumLookupUserType=void 0,EnumLookupUserType=exports.EnumLookupUserType||(exports.EnumLookupUserType={}),EnumLookupUserType.agent="agent",EnumLookupUserType.tenant="tenant",exports.DEFAULT_PARAMETER_STORE_CLIENT_CONFIG=DEFAULT_CLIENT_CONFIG,exports.createTokenStore=createTokenStore,exports.parameterStore=parameterStore,exports.restClient=restClient}));
43
+ ***************************************************************************** */function __extends(e,t){function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __rest$6(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function __decorate(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function __param(e,t){return function(n,r){t(n,r,e)}}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function __awaiter(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function __generator(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function __createBinding(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function __exportStar(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function __spreadArrays(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function __await(e){return this instanceof __await?(this.v=e,this):new __await(e)}function __asyncGenerator(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{!function(e){e.value instanceof __await?Promise.resolve(e.value.v).then(c,u):l(o[0][2],e)}(i[e](t))}catch(e){l(o[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function __asyncDelegator(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:__await(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function __asyncValues(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function __makeTemplateObject(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function __importStar(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function __importDefault(e){return e&&e.__esModule?e:{default:e}}function __classPrivateFieldGet(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function __classPrivateFieldSet(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var tslib_es6=Object.freeze({__proto__:null,get __assign(){return __assign},__asyncDelegator:__asyncDelegator,__asyncGenerator:__asyncGenerator,__asyncValues:__asyncValues,__await:__await,__awaiter:__awaiter,__classPrivateFieldGet:__classPrivateFieldGet,__classPrivateFieldSet:__classPrivateFieldSet,__createBinding:__createBinding,__decorate:__decorate,__exportStar:__exportStar,__extends:__extends,__generator:__generator,__importDefault:__importDefault,__importStar:__importStar,__makeTemplateObject:__makeTemplateObject,__metadata:__metadata,__param:__param,__read:__read,__rest:__rest$6,__spread:__spread,__spreadArrays:__spreadArrays,__values:__values}),require$$0$1=getAugmentedNamespace(tslib_es6),CryptoOperation={},hasRequiredCryptoOperation;function requireCryptoOperation(){return hasRequiredCryptoOperation||(hasRequiredCryptoOperation=1,Object.defineProperty(CryptoOperation,"__esModule",{value:!0})),CryptoOperation}var Key={},hasRequiredKey;function requireKey(){return hasRequiredKey||(hasRequiredKey=1,Object.defineProperty(Key,"__esModule",{value:!0})),Key}var KeyOperation={},hasRequiredKeyOperation;function requireKeyOperation(){return hasRequiredKeyOperation||(hasRequiredKeyOperation=1,Object.defineProperty(KeyOperation,"__esModule",{value:!0})),KeyOperation}var MsSubtleCrypto={},hasRequiredMsSubtleCrypto;function requireMsSubtleCrypto(){return hasRequiredMsSubtleCrypto||(hasRequiredMsSubtleCrypto=1,Object.defineProperty(MsSubtleCrypto,"__esModule",{value:!0})),MsSubtleCrypto}var MsWindow={},hasRequiredMsWindow,hasRequiredBuild,hasRequiredCrossPlatformSha256;function requireMsWindow(){if(hasRequiredMsWindow)return MsWindow;hasRequiredMsWindow=1,Object.defineProperty(MsWindow,"__esModule",{value:!0}),MsWindow.isMsWindow=void 0;var e=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];return MsWindow.isMsWindow=function(t){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(t)&&void 0!==t.msCrypto.subtle){var n=t.msCrypto,r=n.getRandomValues,i=n.subtle;return e.map((function(e){return i[e]})).concat(r).every((function(e){return"function"==typeof e}))}return!1},MsWindow}function requireBuild(){return hasRequiredBuild||(hasRequiredBuild=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=require$$0$1;t.__exportStar(requireCryptoOperation(),e),t.__exportStar(requireKey(),e),t.__exportStar(requireKeyOperation(),e),t.__exportStar(requireMsSubtleCrypto(),e),t.__exportStar(requireMsWindow(),e)}(build)),build}function requireCrossPlatformSha256(){if(hasRequiredCrossPlatformSha256)return crossPlatformSha256;hasRequiredCrossPlatformSha256=1,Object.defineProperty(crossPlatformSha256,"__esModule",{value:!0}),crossPlatformSha256.Sha256=void 0;var e=requireIe11Sha256(),t=requireWebCryptoSha256(),n=requireBuild$2(),r=requireBuild$1(),i=requireBuild(),o=require$$5,s=requireBuild$3(),a=function(){function a(s){(0,r.supportsWebCrypto)((0,o.locateWindow)())?this.hash=new t.Sha256(s):(0,i.isMsWindow)((0,o.locateWindow)())?this.hash=new e.Sha256(s):this.hash=new n.Sha256(s)}return a.prototype.update=function(e,t){this.hash.update((0,s.convertToBuffer)(e))},a.prototype.digest=function(){return this.hash.digest()},a.prototype.reset=function(){this.hash.reset()},a}();return crossPlatformSha256.Sha256=a,crossPlatformSha256}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebCryptoSha256=e.Ie11Sha256=void 0,require$$0$5.__exportStar(requireCrossPlatformSha256(),e);var t=requireIe11Sha256();Object.defineProperty(e,"Ie11Sha256",{enumerable:!0,get:function(){return t.Sha256}});var n=requireWebCryptoSha256();Object.defineProperty(e,"WebCryptoSha256",{enumerable:!0,get:function(){return n.Sha256}})}(build$4);var es5={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,c=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(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,r.key,r)}}var a=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&s(t.prototype,n),r&&s(t,r),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),c=a.default.find(s,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(n[c]);if(void 0!==u)return u}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}}if(o>0){var p=Object.keys(i),m=a.default.find(p,(function(e){return t.isBrowser(e,!0)}));if(void 0!==m)return this.compareVersion(i[m])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})}(es5);var es5Exports=es5.exports,bowser=getDefaultExportFromCjs(es5Exports);const defaultUserAgent=({serviceId:e,clientVersion:t})=>async()=>{const n="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,r=[["aws-sdk-js",t],["ua","2.0"],[`os/${n?.os?.name||"other"}`,n?.os?.version],["lang/js"],["md/browser",`${n?.browser?.name??"unknown"}_${n?.browser?.version??"unknown"}`]];return e&&r.push([`api/${e}`,t]),r},invalidProvider=e=>()=>Promise.reject(e),TEXT_ENCODER="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=e=>{if("string"==typeof e){if(TEXT_ENCODER)return TEXT_ENCODER.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},u="required",v="fn",w="argv",x="ref",a=!0,b="isSet",c="booleanEquals",d="error",e="endpoint",f="tree",g="PartitionResult",h="getAttr",i={[u]:!1,type:"String"},j={[u]:!0,default:!1,type:"Boolean"},k={[x]:"Endpoint"},l={[v]:c,[w]:[{[x]:"UseFIPS"},!0]},m={[v]:c,[w]:[{[x]:"UseDualStack"},!0]},n={},o={[v]:h,[w]:[{[x]:g},"supportsFIPS"]},p={[x]:g},q={[v]:c,[w]:[!0,{[v]:h,[w]:[p,"supportsDualStack"]}]},r=[l],s=[m],t=[{[x]:"Region"}],_data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:b,[w]:[k]}],rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:k,properties:n,headers:n},type:e}],type:f},{conditions:[{[v]:b,[w]:t}],rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:g}],rules:[{conditions:[l,m],rules:[{conditions:[{[v]:c,[w]:[a,o]},q],rules:[{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:r,rules:[{conditions:[{[v]:c,[w]:[o,a]}],rules:[{conditions:[{[v]:"stringEquals",[w]:[{[v]:h,[w]:[p,"name"]},"aws-us-gov"]}],endpoint:{url:"https://ssm.{Region}.amazonaws.com",properties:n,headers:n},type:e},{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:s,rules:[{conditions:[q],rules:[{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]},ruleSet=_data,defaultEndpointResolver=(e,t={})=>resolveEndpoint(ruleSet,{endpointParams:e,logger:t.logger});customEndpointFunctions.aws=awsEndpointFunctions;const getRuntimeConfig$1=e=>({apiVersion:"2014-11-06",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSSMHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer}],logger:e?.logger??new NoOpLogger,serviceId:e?.serviceId??"SSM",urlParser:e?.urlParser??parseUrl,utf8Decoder:e?.utf8Decoder??fromUtf8$3,utf8Encoder:e?.utf8Encoder??toUtf8$3}),memoize=(e,t,n)=>{let r,i,o,s=!1;return async t=>(o&&!t?.forceRefresh||(r=await(async()=>{i||(i=e());try{r=await i,o=!0,s=!1}finally{i=void 0}return r})()),r)},DEFAULTS_MODE_OPTIONS=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig=({defaultsMode:e}={})=>memoize((async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(isMobileBrowser()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${t}`)}})),isMobileBrowser=()=>{const e="undefined"!=typeof window&&window?.navigator?.userAgent?bowser.parse(window.navigator.userAgent):void 0,t=e?.platform?.type;return"tablet"===t||"mobile"===t},getRuntimeConfig=e=>{const t=resolveDefaultsModeConfig(e),n=()=>t().then(loadConfigsForDefaultMode),r=getRuntimeConfig$1(e);return{...r,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??defaultUserAgent({serviceId:r.serviceId,clientVersion:packageInfo.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS,region:e?.region??invalidProvider("Region is missing"),requestHandler:FetchHttpHandler.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE),sha256:e?.sha256??build$4.Sha256,streamCollector:e?.streamCollector??streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))}},getAwsRegionExtensionConfiguration=e=>{let t=async()=>{if(void 0===e.region)throw new Error("Region is missing from runtimeConfig");const t=e.region;return"string"==typeof t?t:t()};return{setRegion(e){t=e},region:()=>t}},resolveAwsRegionExtensionConfiguration=e=>({region:e.region()}),getHttpAuthExtensionConfiguration=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}},resolveHttpAuthRuntimeConfig=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),asPartial=e=>e,resolveRuntimeExtensions=(e,t)=>{const n={...asPartial(getAwsRegionExtensionConfiguration(e)),...asPartial(getDefaultExtensionConfiguration(e)),...asPartial(getHttpHandlerExtensionConfiguration(e)),...asPartial(getHttpAuthExtensionConfiguration(e))};return t.forEach((e=>e.configure(n))),{...e,...resolveAwsRegionExtensionConfiguration(n),...resolveDefaultRuntimeConfig(n),...resolveHttpHandlerRuntimeConfig(n),...resolveHttpAuthRuntimeConfig(n)}};class SSMClient extends Client{constructor(...[e]){const t=getRuntimeConfig(e||{}),n=resolveClientEndpointParameters(t),r=resolveRegionConfig(n),i=resolveEndpointConfig(r),o=resolveUserAgentConfig(resolveHostHeaderConfig(resolveRetryConfig(i))),s=resolveHttpAuthSchemeConfig(o),a=resolveRuntimeExtensions(s,e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(getRetryPlugin(this.config)),this.middlewareStack.use(getContentLengthPlugin(this.config)),this.middlewareStack.use(getHostHeaderPlugin(this.config)),this.middlewareStack.use(getLoggerPlugin(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(getUserAgentPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:this.getDefaultHttpAuthSchemeParametersProvider(),identityProviderConfigProvider:this.getIdentityProviderConfigProvider()})),this.middlewareStack.use(getHttpSigningPlugin(this.config))}destroy(){super.destroy()}getDefaultHttpAuthSchemeParametersProvider(){return defaultSSMHttpAuthSchemeParametersProvider}getIdentityProviderConfigProvider(){return async e=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials})}}class SSMServiceException extends ServiceException{constructor(e){super(e),Object.setPrototypeOf(this,SSMServiceException.prototype)}}class InternalServerError extends SSMServiceException{constructor(e){super({name:"InternalServerError",$fault:"server",...e}),this.name="InternalServerError",this.$fault="server",Object.setPrototypeOf(this,InternalServerError.prototype),this.Message=e.Message}}class InvalidResourceId extends SSMServiceException{constructor(e){super({name:"InvalidResourceId",$fault:"client",...e}),this.name="InvalidResourceId",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceId.prototype)}}class InvalidResourceType extends SSMServiceException{constructor(e){super({name:"InvalidResourceType",$fault:"client",...e}),this.name="InvalidResourceType",this.$fault="client",Object.setPrototypeOf(this,InvalidResourceType.prototype)}}class TooManyTagsError extends SSMServiceException{constructor(e){super({name:"TooManyTagsError",$fault:"client",...e}),this.name="TooManyTagsError",this.$fault="client",Object.setPrototypeOf(this,TooManyTagsError.prototype)}}class TooManyUpdates extends SSMServiceException{constructor(e){super({name:"TooManyUpdates",$fault:"client",...e}),this.name="TooManyUpdates",this.$fault="client",Object.setPrototypeOf(this,TooManyUpdates.prototype),this.Message=e.Message}}class AlreadyExistsException extends SSMServiceException{constructor(e){super({name:"AlreadyExistsException",$fault:"client",...e}),this.name="AlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,AlreadyExistsException.prototype),this.Message=e.Message}}class OpsItemConflictException extends SSMServiceException{constructor(e){super({name:"OpsItemConflictException",$fault:"client",...e}),this.name="OpsItemConflictException",this.$fault="client",Object.setPrototypeOf(this,OpsItemConflictException.prototype),this.Message=e.Message}}class OpsItemInvalidParameterException extends SSMServiceException{constructor(e){super({name:"OpsItemInvalidParameterException",$fault:"client",...e}),this.name="OpsItemInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,OpsItemInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class OpsItemLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsItemLimitExceededException",$fault:"client",...e}),this.name="OpsItemLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsItemLimitExceededException.prototype),this.ResourceTypes=e.ResourceTypes,this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class OpsItemNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemNotFoundException",$fault:"client",...e}),this.name="OpsItemNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemNotFoundException.prototype),this.Message=e.Message}}class OpsItemRelatedItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemRelatedItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAlreadyExistsException.prototype),this.Message=e.Message,this.ResourceUri=e.ResourceUri,this.OpsItemId=e.OpsItemId}}class DuplicateInstanceId extends SSMServiceException{constructor(e){super({name:"DuplicateInstanceId",$fault:"client",...e}),this.name="DuplicateInstanceId",this.$fault="client",Object.setPrototypeOf(this,DuplicateInstanceId.prototype)}}class InvalidCommandId extends SSMServiceException{constructor(e){super({name:"InvalidCommandId",$fault:"client",...e}),this.name="InvalidCommandId",this.$fault="client",Object.setPrototypeOf(this,InvalidCommandId.prototype)}}class InvalidInstanceId extends SSMServiceException{constructor(e){super({name:"InvalidInstanceId",$fault:"client",...e}),this.name="InvalidInstanceId",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceId.prototype),this.Message=e.Message}}class DoesNotExistException extends SSMServiceException{constructor(e){super({name:"DoesNotExistException",$fault:"client",...e}),this.name="DoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,DoesNotExistException.prototype),this.Message=e.Message}}class InvalidParameters extends SSMServiceException{constructor(e){super({name:"InvalidParameters",$fault:"client",...e}),this.name="InvalidParameters",this.$fault="client",Object.setPrototypeOf(this,InvalidParameters.prototype),this.Message=e.Message}}class AssociationAlreadyExists extends SSMServiceException{constructor(e){super({name:"AssociationAlreadyExists",$fault:"client",...e}),this.name="AssociationAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,AssociationAlreadyExists.prototype)}}class AssociationLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationLimitExceeded",$fault:"client",...e}),this.name="AssociationLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationLimitExceeded.prototype)}}class InvalidDocument extends SSMServiceException{constructor(e){super({name:"InvalidDocument",$fault:"client",...e}),this.name="InvalidDocument",this.$fault="client",Object.setPrototypeOf(this,InvalidDocument.prototype),this.Message=e.Message}}class InvalidDocumentVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentVersion",$fault:"client",...e}),this.name="InvalidDocumentVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentVersion.prototype),this.Message=e.Message}}class InvalidOutputLocation extends SSMServiceException{constructor(e){super({name:"InvalidOutputLocation",$fault:"client",...e}),this.name="InvalidOutputLocation",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputLocation.prototype)}}class InvalidSchedule extends SSMServiceException{constructor(e){super({name:"InvalidSchedule",$fault:"client",...e}),this.name="InvalidSchedule",this.$fault="client",Object.setPrototypeOf(this,InvalidSchedule.prototype),this.Message=e.Message}}class InvalidTag extends SSMServiceException{constructor(e){super({name:"InvalidTag",$fault:"client",...e}),this.name="InvalidTag",this.$fault="client",Object.setPrototypeOf(this,InvalidTag.prototype),this.Message=e.Message}}class InvalidTarget extends SSMServiceException{constructor(e){super({name:"InvalidTarget",$fault:"client",...e}),this.name="InvalidTarget",this.$fault="client",Object.setPrototypeOf(this,InvalidTarget.prototype),this.Message=e.Message}}class InvalidTargetMaps extends SSMServiceException{constructor(e){super({name:"InvalidTargetMaps",$fault:"client",...e}),this.name="InvalidTargetMaps",this.$fault="client",Object.setPrototypeOf(this,InvalidTargetMaps.prototype),this.Message=e.Message}}class UnsupportedPlatformType extends SSMServiceException{constructor(e){super({name:"UnsupportedPlatformType",$fault:"client",...e}),this.name="UnsupportedPlatformType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedPlatformType.prototype),this.Message=e.Message}}class DocumentAlreadyExists extends SSMServiceException{constructor(e){super({name:"DocumentAlreadyExists",$fault:"client",...e}),this.name="DocumentAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,DocumentAlreadyExists.prototype),this.Message=e.Message}}class DocumentLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentLimitExceeded",$fault:"client",...e}),this.name="DocumentLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentLimitExceeded.prototype),this.Message=e.Message}}class InvalidDocumentContent extends SSMServiceException{constructor(e){super({name:"InvalidDocumentContent",$fault:"client",...e}),this.name="InvalidDocumentContent",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentContent.prototype),this.Message=e.Message}}class InvalidDocumentSchemaVersion extends SSMServiceException{constructor(e){super({name:"InvalidDocumentSchemaVersion",$fault:"client",...e}),this.name="InvalidDocumentSchemaVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentSchemaVersion.prototype),this.Message=e.Message}}class MaxDocumentSizeExceeded extends SSMServiceException{constructor(e){super({name:"MaxDocumentSizeExceeded",$fault:"client",...e}),this.name="MaxDocumentSizeExceeded",this.$fault="client",Object.setPrototypeOf(this,MaxDocumentSizeExceeded.prototype),this.Message=e.Message}}class IdempotentParameterMismatch extends SSMServiceException{constructor(e){super({name:"IdempotentParameterMismatch",$fault:"client",...e}),this.name="IdempotentParameterMismatch",this.$fault="client",Object.setPrototypeOf(this,IdempotentParameterMismatch.prototype),this.Message=e.Message}}class ResourceLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Message=e.Message}}class OpsItemAccessDeniedException extends SSMServiceException{constructor(e){super({name:"OpsItemAccessDeniedException",$fault:"client",...e}),this.name="OpsItemAccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAccessDeniedException.prototype),this.Message=e.Message}}class OpsItemAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsItemAlreadyExistsException",$fault:"client",...e}),this.name="OpsItemAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsItemAlreadyExistsException.prototype),this.Message=e.Message,this.OpsItemId=e.OpsItemId}}class OpsMetadataAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"OpsMetadataAlreadyExistsException",$fault:"client",...e}),this.name="OpsMetadataAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataAlreadyExistsException.prototype)}}class OpsMetadataInvalidArgumentException extends SSMServiceException{constructor(e){super({name:"OpsMetadataInvalidArgumentException",$fault:"client",...e}),this.name="OpsMetadataInvalidArgumentException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataInvalidArgumentException.prototype)}}class OpsMetadataLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataLimitExceededException.prototype)}}class OpsMetadataTooManyUpdatesException extends SSMServiceException{constructor(e){super({name:"OpsMetadataTooManyUpdatesException",$fault:"client",...e}),this.name="OpsMetadataTooManyUpdatesException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataTooManyUpdatesException.prototype)}}class ResourceDataSyncAlreadyExistsException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncAlreadyExistsException",$fault:"client",...e}),this.name="ResourceDataSyncAlreadyExistsException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncAlreadyExistsException.prototype),this.SyncName=e.SyncName}}class ResourceDataSyncCountExceededException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncCountExceededException",$fault:"client",...e}),this.name="ResourceDataSyncCountExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncCountExceededException.prototype),this.Message=e.Message}}class ResourceDataSyncInvalidConfigurationException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncInvalidConfigurationException",$fault:"client",...e}),this.name="ResourceDataSyncInvalidConfigurationException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncInvalidConfigurationException.prototype),this.Message=e.Message}}class InvalidActivation extends SSMServiceException{constructor(e){super({name:"InvalidActivation",$fault:"client",...e}),this.name="InvalidActivation",this.$fault="client",Object.setPrototypeOf(this,InvalidActivation.prototype),this.Message=e.Message}}class InvalidActivationId extends SSMServiceException{constructor(e){super({name:"InvalidActivationId",$fault:"client",...e}),this.name="InvalidActivationId",this.$fault="client",Object.setPrototypeOf(this,InvalidActivationId.prototype),this.Message=e.Message}}class AssociationDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationDoesNotExist",$fault:"client",...e}),this.name="AssociationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationDoesNotExist.prototype),this.Message=e.Message}}class AssociatedInstances extends SSMServiceException{constructor(e){super({name:"AssociatedInstances",$fault:"client",...e}),this.name="AssociatedInstances",this.$fault="client",Object.setPrototypeOf(this,AssociatedInstances.prototype)}}class InvalidDocumentOperation extends SSMServiceException{constructor(e){super({name:"InvalidDocumentOperation",$fault:"client",...e}),this.name="InvalidDocumentOperation",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentOperation.prototype),this.Message=e.Message}}class InvalidDeleteInventoryParametersException extends SSMServiceException{constructor(e){super({name:"InvalidDeleteInventoryParametersException",$fault:"client",...e}),this.name="InvalidDeleteInventoryParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeleteInventoryParametersException.prototype),this.Message=e.Message}}class InvalidInventoryRequestException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryRequestException",$fault:"client",...e}),this.name="InvalidInventoryRequestException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryRequestException.prototype),this.Message=e.Message}}class InvalidOptionException extends SSMServiceException{constructor(e){super({name:"InvalidOptionException",$fault:"client",...e}),this.name="InvalidOptionException",this.$fault="client",Object.setPrototypeOf(this,InvalidOptionException.prototype),this.Message=e.Message}}class InvalidTypeNameException extends SSMServiceException{constructor(e){super({name:"InvalidTypeNameException",$fault:"client",...e}),this.name="InvalidTypeNameException",this.$fault="client",Object.setPrototypeOf(this,InvalidTypeNameException.prototype),this.Message=e.Message}}class OpsMetadataNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsMetadataNotFoundException",$fault:"client",...e}),this.name="OpsMetadataNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataNotFoundException.prototype)}}class ParameterNotFound extends SSMServiceException{constructor(e){super({name:"ParameterNotFound",$fault:"client",...e}),this.name="ParameterNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterNotFound.prototype)}}class ResourceInUseException extends SSMServiceException{constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),this.name="ResourceInUseException",this.$fault="client",Object.setPrototypeOf(this,ResourceInUseException.prototype),this.Message=e.Message}}class ResourceDataSyncNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncNotFoundException",$fault:"client",...e}),this.name="ResourceDataSyncNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncNotFoundException.prototype),this.SyncName=e.SyncName,this.SyncType=e.SyncType,this.Message=e.Message}}class MalformedResourcePolicyDocumentException extends SSMServiceException{constructor(e){super({name:"MalformedResourcePolicyDocumentException",$fault:"client",...e}),this.name="MalformedResourcePolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,MalformedResourcePolicyDocumentException.prototype),this.Message=e.Message}}class ResourceNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourceNotFoundException.prototype),this.Message=e.Message}}class ResourcePolicyConflictException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyConflictException",$fault:"client",...e}),this.name="ResourcePolicyConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyConflictException.prototype),this.Message=e.Message}}class ResourcePolicyInvalidParameterException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyInvalidParameterException",$fault:"client",...e}),this.name="ResourcePolicyInvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class ResourcePolicyNotFoundException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyNotFoundException",$fault:"client",...e}),this.name="ResourcePolicyNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyNotFoundException.prototype),this.Message=e.Message}}class TargetInUseException extends SSMServiceException{constructor(e){super({name:"TargetInUseException",$fault:"client",...e}),this.name="TargetInUseException",this.$fault="client",Object.setPrototypeOf(this,TargetInUseException.prototype),this.Message=e.Message}}class InvalidFilter extends SSMServiceException{constructor(e){super({name:"InvalidFilter",$fault:"client",...e}),this.name="InvalidFilter",this.$fault="client",Object.setPrototypeOf(this,InvalidFilter.prototype),this.Message=e.Message}}class InvalidNextToken extends SSMServiceException{constructor(e){super({name:"InvalidNextToken",$fault:"client",...e}),this.name="InvalidNextToken",this.$fault="client",Object.setPrototypeOf(this,InvalidNextToken.prototype),this.Message=e.Message}}class InvalidAssociationVersion extends SSMServiceException{constructor(e){super({name:"InvalidAssociationVersion",$fault:"client",...e}),this.name="InvalidAssociationVersion",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociationVersion.prototype),this.Message=e.Message}}class AssociationExecutionDoesNotExist extends SSMServiceException{constructor(e){super({name:"AssociationExecutionDoesNotExist",$fault:"client",...e}),this.name="AssociationExecutionDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,AssociationExecutionDoesNotExist.prototype),this.Message=e.Message}}class InvalidFilterKey extends SSMServiceException{constructor(e){super({name:"InvalidFilterKey",$fault:"client",...e}),this.name="InvalidFilterKey",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterKey.prototype)}}class InvalidFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidFilterValue",$fault:"client",...e}),this.name="InvalidFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterValue.prototype),this.Message=e.Message}}class AutomationExecutionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionNotFoundException",$fault:"client",...e}),this.name="AutomationExecutionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionNotFoundException.prototype),this.Message=e.Message}}class InvalidPermissionType extends SSMServiceException{constructor(e){super({name:"InvalidPermissionType",$fault:"client",...e}),this.name="InvalidPermissionType",this.$fault="client",Object.setPrototypeOf(this,InvalidPermissionType.prototype),this.Message=e.Message}}class UnsupportedOperatingSystem extends SSMServiceException{constructor(e){super({name:"UnsupportedOperatingSystem",$fault:"client",...e}),this.name="UnsupportedOperatingSystem",this.$fault="client",Object.setPrototypeOf(this,UnsupportedOperatingSystem.prototype),this.Message=e.Message}}class InvalidInstanceInformationFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstanceInformationFilterValue",$fault:"client",...e}),this.name="InvalidInstanceInformationFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstanceInformationFilterValue.prototype)}}class InvalidInstancePropertyFilterValue extends SSMServiceException{constructor(e){super({name:"InvalidInstancePropertyFilterValue",$fault:"client",...e}),this.name="InvalidInstancePropertyFilterValue",this.$fault="client",Object.setPrototypeOf(this,InvalidInstancePropertyFilterValue.prototype)}}class InvalidDeletionIdException extends SSMServiceException{constructor(e){super({name:"InvalidDeletionIdException",$fault:"client",...e}),this.name="InvalidDeletionIdException",this.$fault="client",Object.setPrototypeOf(this,InvalidDeletionIdException.prototype),this.Message=e.Message}}class InvalidFilterOption extends SSMServiceException{constructor(e){super({name:"InvalidFilterOption",$fault:"client",...e}),this.name="InvalidFilterOption",this.$fault="client",Object.setPrototypeOf(this,InvalidFilterOption.prototype)}}class OpsItemRelatedItemAssociationNotFoundException extends SSMServiceException{constructor(e){super({name:"OpsItemRelatedItemAssociationNotFoundException",$fault:"client",...e}),this.name="OpsItemRelatedItemAssociationNotFoundException",this.$fault="client",Object.setPrototypeOf(this,OpsItemRelatedItemAssociationNotFoundException.prototype),this.Message=e.Message}}class InvalidDocumentType extends SSMServiceException{constructor(e){super({name:"InvalidDocumentType",$fault:"client",...e}),this.name="InvalidDocumentType",this.$fault="client",Object.setPrototypeOf(this,InvalidDocumentType.prototype),this.Message=e.Message}}class UnsupportedCalendarException extends SSMServiceException{constructor(e){super({name:"UnsupportedCalendarException",$fault:"client",...e}),this.name="UnsupportedCalendarException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedCalendarException.prototype),this.Message=e.Message}}class InvalidPluginName extends SSMServiceException{constructor(e){super({name:"InvalidPluginName",$fault:"client",...e}),this.name="InvalidPluginName",this.$fault="client",Object.setPrototypeOf(this,InvalidPluginName.prototype)}}class InvocationDoesNotExist extends SSMServiceException{constructor(e){super({name:"InvocationDoesNotExist",$fault:"client",...e}),this.name="InvocationDoesNotExist",this.$fault="client",Object.setPrototypeOf(this,InvocationDoesNotExist.prototype)}}class UnsupportedFeatureRequiredException extends SSMServiceException{constructor(e){super({name:"UnsupportedFeatureRequiredException",$fault:"client",...e}),this.name="UnsupportedFeatureRequiredException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedFeatureRequiredException.prototype),this.Message=e.Message}}class InvalidAggregatorException extends SSMServiceException{constructor(e){super({name:"InvalidAggregatorException",$fault:"client",...e}),this.name="InvalidAggregatorException",this.$fault="client",Object.setPrototypeOf(this,InvalidAggregatorException.prototype),this.Message=e.Message}}class InvalidInventoryGroupException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryGroupException",$fault:"client",...e}),this.name="InvalidInventoryGroupException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryGroupException.prototype),this.Message=e.Message}}class InvalidResultAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidResultAttributeException",$fault:"client",...e}),this.name="InvalidResultAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidResultAttributeException.prototype),this.Message=e.Message}}class InvalidKeyId extends SSMServiceException{constructor(e){super({name:"InvalidKeyId",$fault:"client",...e}),this.name="InvalidKeyId",this.$fault="client",Object.setPrototypeOf(this,InvalidKeyId.prototype)}}class ParameterVersionNotFound extends SSMServiceException{constructor(e){super({name:"ParameterVersionNotFound",$fault:"client",...e}),this.name="ParameterVersionNotFound",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionNotFound.prototype)}}class ServiceSettingNotFound extends SSMServiceException{constructor(e){super({name:"ServiceSettingNotFound",$fault:"client",...e}),this.name="ServiceSettingNotFound",this.$fault="client",Object.setPrototypeOf(this,ServiceSettingNotFound.prototype),this.Message=e.Message}}class ParameterVersionLabelLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterVersionLabelLimitExceeded",$fault:"client",...e}),this.name="ParameterVersionLabelLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterVersionLabelLimitExceeded.prototype)}}class DocumentPermissionLimit extends SSMServiceException{constructor(e){super({name:"DocumentPermissionLimit",$fault:"client",...e}),this.name="DocumentPermissionLimit",this.$fault="client",Object.setPrototypeOf(this,DocumentPermissionLimit.prototype),this.Message=e.Message}}class ComplianceTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"ComplianceTypeCountLimitExceededException",$fault:"client",...e}),this.name="ComplianceTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ComplianceTypeCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidItemContentException extends SSMServiceException{constructor(e){super({name:"InvalidItemContentException",$fault:"client",...e}),this.name="InvalidItemContentException",this.$fault="client",Object.setPrototypeOf(this,InvalidItemContentException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class ItemSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"ItemSizeLimitExceededException",$fault:"client",...e}),this.name="ItemSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ItemSizeLimitExceededException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class TotalSizeLimitExceededException extends SSMServiceException{constructor(e){super({name:"TotalSizeLimitExceededException",$fault:"client",...e}),this.name="TotalSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,TotalSizeLimitExceededException.prototype),this.Message=e.Message}}class CustomSchemaCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"CustomSchemaCountLimitExceededException",$fault:"client",...e}),this.name="CustomSchemaCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,CustomSchemaCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"InvalidInventoryItemContextException",$fault:"client",...e}),this.name="InvalidInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,InvalidInventoryItemContextException.prototype),this.Message=e.Message}}class ItemContentMismatchException extends SSMServiceException{constructor(e){super({name:"ItemContentMismatchException",$fault:"client",...e}),this.name="ItemContentMismatchException",this.$fault="client",Object.setPrototypeOf(this,ItemContentMismatchException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class SubTypeCountLimitExceededException extends SSMServiceException{constructor(e){super({name:"SubTypeCountLimitExceededException",$fault:"client",...e}),this.name="SubTypeCountLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,SubTypeCountLimitExceededException.prototype),this.Message=e.Message}}class UnsupportedInventoryItemContextException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventoryItemContextException",$fault:"client",...e}),this.name="UnsupportedInventoryItemContextException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventoryItemContextException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class UnsupportedInventorySchemaVersionException extends SSMServiceException{constructor(e){super({name:"UnsupportedInventorySchemaVersionException",$fault:"client",...e}),this.name="UnsupportedInventorySchemaVersionException",this.$fault="client",Object.setPrototypeOf(this,UnsupportedInventorySchemaVersionException.prototype),this.Message=e.Message}}class HierarchyLevelLimitExceededException extends SSMServiceException{constructor(e){super({name:"HierarchyLevelLimitExceededException",$fault:"client",...e}),this.name="HierarchyLevelLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,HierarchyLevelLimitExceededException.prototype)}}class HierarchyTypeMismatchException extends SSMServiceException{constructor(e){super({name:"HierarchyTypeMismatchException",$fault:"client",...e}),this.name="HierarchyTypeMismatchException",this.$fault="client",Object.setPrototypeOf(this,HierarchyTypeMismatchException.prototype)}}class IncompatiblePolicyException extends SSMServiceException{constructor(e){super({name:"IncompatiblePolicyException",$fault:"client",...e}),this.name="IncompatiblePolicyException",this.$fault="client",Object.setPrototypeOf(this,IncompatiblePolicyException.prototype)}}class InvalidAllowedPatternException extends SSMServiceException{constructor(e){super({name:"InvalidAllowedPatternException",$fault:"client",...e}),this.name="InvalidAllowedPatternException",this.$fault="client",Object.setPrototypeOf(this,InvalidAllowedPatternException.prototype)}}class InvalidPolicyAttributeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyAttributeException",$fault:"client",...e}),this.name="InvalidPolicyAttributeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyAttributeException.prototype)}}class InvalidPolicyTypeException extends SSMServiceException{constructor(e){super({name:"InvalidPolicyTypeException",$fault:"client",...e}),this.name="InvalidPolicyTypeException",this.$fault="client",Object.setPrototypeOf(this,InvalidPolicyTypeException.prototype)}}class ParameterAlreadyExists extends SSMServiceException{constructor(e){super({name:"ParameterAlreadyExists",$fault:"client",...e}),this.name="ParameterAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,ParameterAlreadyExists.prototype)}}class ParameterLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterLimitExceeded",$fault:"client",...e}),this.name="ParameterLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterLimitExceeded.prototype)}}class ParameterMaxVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"ParameterMaxVersionLimitExceeded",$fault:"client",...e}),this.name="ParameterMaxVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,ParameterMaxVersionLimitExceeded.prototype)}}class ParameterPatternMismatchException extends SSMServiceException{constructor(e){super({name:"ParameterPatternMismatchException",$fault:"client",...e}),this.name="ParameterPatternMismatchException",this.$fault="client",Object.setPrototypeOf(this,ParameterPatternMismatchException.prototype)}}class PoliciesLimitExceededException extends SSMServiceException{constructor(e){super({name:"PoliciesLimitExceededException",$fault:"client",...e}),this.name="PoliciesLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,PoliciesLimitExceededException.prototype)}}class UnsupportedParameterType extends SSMServiceException{constructor(e){super({name:"UnsupportedParameterType",$fault:"client",...e}),this.name="UnsupportedParameterType",this.$fault="client",Object.setPrototypeOf(this,UnsupportedParameterType.prototype)}}class ResourcePolicyLimitExceededException extends SSMServiceException{constructor(e){super({name:"ResourcePolicyLimitExceededException",$fault:"client",...e}),this.name="ResourcePolicyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ResourcePolicyLimitExceededException.prototype),this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class FeatureNotAvailableException extends SSMServiceException{constructor(e){super({name:"FeatureNotAvailableException",$fault:"client",...e}),this.name="FeatureNotAvailableException",this.$fault="client",Object.setPrototypeOf(this,FeatureNotAvailableException.prototype),this.Message=e.Message}}class AutomationStepNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationStepNotFoundException",$fault:"client",...e}),this.name="AutomationStepNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationStepNotFoundException.prototype),this.Message=e.Message}}class InvalidAutomationSignalException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationSignalException",$fault:"client",...e}),this.name="InvalidAutomationSignalException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationSignalException.prototype),this.Message=e.Message}}class InvalidNotificationConfig extends SSMServiceException{constructor(e){super({name:"InvalidNotificationConfig",$fault:"client",...e}),this.name="InvalidNotificationConfig",this.$fault="client",Object.setPrototypeOf(this,InvalidNotificationConfig.prototype),this.Message=e.Message}}class InvalidOutputFolder extends SSMServiceException{constructor(e){super({name:"InvalidOutputFolder",$fault:"client",...e}),this.name="InvalidOutputFolder",this.$fault="client",Object.setPrototypeOf(this,InvalidOutputFolder.prototype)}}class InvalidRole extends SSMServiceException{constructor(e){super({name:"InvalidRole",$fault:"client",...e}),this.name="InvalidRole",this.$fault="client",Object.setPrototypeOf(this,InvalidRole.prototype),this.Message=e.Message}}class InvalidAssociation extends SSMServiceException{constructor(e){super({name:"InvalidAssociation",$fault:"client",...e}),this.name="InvalidAssociation",this.$fault="client",Object.setPrototypeOf(this,InvalidAssociation.prototype),this.Message=e.Message}}class AutomationDefinitionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotFoundException.prototype),this.Message=e.Message}}class AutomationDefinitionVersionNotFoundException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionVersionNotFoundException",$fault:"client",...e}),this.name="AutomationDefinitionVersionNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionVersionNotFoundException.prototype),this.Message=e.Message}}class AutomationExecutionLimitExceededException extends SSMServiceException{constructor(e){super({name:"AutomationExecutionLimitExceededException",$fault:"client",...e}),this.name="AutomationExecutionLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,AutomationExecutionLimitExceededException.prototype),this.Message=e.Message}}class InvalidAutomationExecutionParametersException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationExecutionParametersException",$fault:"client",...e}),this.name="InvalidAutomationExecutionParametersException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationExecutionParametersException.prototype),this.Message=e.Message}}const ParameterFilterSensitiveLog=e=>({...e,...e.Value&&{Value:SENSITIVE_STRING}}),GetParameterResultFilterSensitiveLog=e=>({...e,...e.Parameter&&{Parameter:ParameterFilterSensitiveLog(e.Parameter)}}),GetParametersResultFilterSensitiveLog=e=>({...e,...e.Parameters&&{Parameters:e.Parameters.map((e=>ParameterFilterSensitiveLog(e)))}});class AutomationDefinitionNotApprovedException extends SSMServiceException{constructor(e){super({name:"AutomationDefinitionNotApprovedException",$fault:"client",...e}),this.name="AutomationDefinitionNotApprovedException",this.$fault="client",Object.setPrototypeOf(this,AutomationDefinitionNotApprovedException.prototype),this.Message=e.Message}}class TargetNotConnected extends SSMServiceException{constructor(e){super({name:"TargetNotConnected",$fault:"client",...e}),this.name="TargetNotConnected",this.$fault="client",Object.setPrototypeOf(this,TargetNotConnected.prototype),this.Message=e.Message}}class InvalidAutomationStatusUpdateException extends SSMServiceException{constructor(e){super({name:"InvalidAutomationStatusUpdateException",$fault:"client",...e}),this.name="InvalidAutomationStatusUpdateException",this.$fault="client",Object.setPrototypeOf(this,InvalidAutomationStatusUpdateException.prototype),this.Message=e.Message}}class AssociationVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"AssociationVersionLimitExceeded",$fault:"client",...e}),this.name="AssociationVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,AssociationVersionLimitExceeded.prototype),this.Message=e.Message}}class InvalidUpdate extends SSMServiceException{constructor(e){super({name:"InvalidUpdate",$fault:"client",...e}),this.name="InvalidUpdate",this.$fault="client",Object.setPrototypeOf(this,InvalidUpdate.prototype),this.Message=e.Message}}class StatusUnchanged extends SSMServiceException{constructor(e){super({name:"StatusUnchanged",$fault:"client",...e}),this.name="StatusUnchanged",this.$fault="client",Object.setPrototypeOf(this,StatusUnchanged.prototype)}}class DocumentVersionLimitExceeded extends SSMServiceException{constructor(e){super({name:"DocumentVersionLimitExceeded",$fault:"client",...e}),this.name="DocumentVersionLimitExceeded",this.$fault="client",Object.setPrototypeOf(this,DocumentVersionLimitExceeded.prototype),this.Message=e.Message}}class DuplicateDocumentContent extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentContent",$fault:"client",...e}),this.name="DuplicateDocumentContent",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentContent.prototype),this.Message=e.Message}}class DuplicateDocumentVersionName extends SSMServiceException{constructor(e){super({name:"DuplicateDocumentVersionName",$fault:"client",...e}),this.name="DuplicateDocumentVersionName",this.$fault="client",Object.setPrototypeOf(this,DuplicateDocumentVersionName.prototype),this.Message=e.Message}}class OpsMetadataKeyLimitExceededException extends SSMServiceException{constructor(e){super({name:"OpsMetadataKeyLimitExceededException",$fault:"client",...e}),this.name="OpsMetadataKeyLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,OpsMetadataKeyLimitExceededException.prototype)}}class ResourceDataSyncConflictException extends SSMServiceException{constructor(e){super({name:"ResourceDataSyncConflictException",$fault:"client",...e}),this.name="ResourceDataSyncConflictException",this.$fault="client",Object.setPrototypeOf(this,ResourceDataSyncConflictException.prototype),this.Message=e.Message}}const se_GetParameterCommand=async(e,t)=>{const n=sharedHeaders("GetParameter");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},se_GetParametersCommand=async(e,t)=>{const n=sharedHeaders("GetParameters");let r;return r=JSON.stringify(_json(e)),buildHttpRpcRequest(t,n,"/",void 0,r)},de_GetParameterCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParameterResult(n);return{$metadata:deserializeMetadata(e),...r}},de_GetParametersCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody(e.body,t);let r={};r=de_GetParametersResult(n);return{$metadata:deserializeMetadata(e),...r}},de_CommandError=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},r=loadRestJsonErrorCode(e,n.body);switch(r){case"InternalServerError":case"com.amazonaws.ssm#InternalServerError":throw await de_InternalServerErrorRes(n);case"InvalidResourceId":case"com.amazonaws.ssm#InvalidResourceId":throw await de_InvalidResourceIdRes(n);case"InvalidResourceType":case"com.amazonaws.ssm#InvalidResourceType":throw await de_InvalidResourceTypeRes(n);case"TooManyTagsError":case"com.amazonaws.ssm#TooManyTagsError":throw await de_TooManyTagsErrorRes(n);case"TooManyUpdates":case"com.amazonaws.ssm#TooManyUpdates":throw await de_TooManyUpdatesRes(n);case"OpsItemConflictException":case"com.amazonaws.ssm#OpsItemConflictException":throw await de_OpsItemConflictExceptionRes(n);case"OpsItemInvalidParameterException":case"com.amazonaws.ssm#OpsItemInvalidParameterException":throw await de_OpsItemInvalidParameterExceptionRes(n);case"OpsItemLimitExceededException":case"com.amazonaws.ssm#OpsItemLimitExceededException":throw await de_OpsItemLimitExceededExceptionRes(n);case"OpsItemNotFoundException":case"com.amazonaws.ssm#OpsItemNotFoundException":throw await de_OpsItemNotFoundExceptionRes(n);case"OpsItemRelatedItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemRelatedItemAlreadyExistsException":throw await de_OpsItemRelatedItemAlreadyExistsExceptionRes(n);case"DuplicateInstanceId":case"com.amazonaws.ssm#DuplicateInstanceId":throw await de_DuplicateInstanceIdRes(n);case"InvalidCommandId":case"com.amazonaws.ssm#InvalidCommandId":throw await de_InvalidCommandIdRes(n);case"InvalidInstanceId":case"com.amazonaws.ssm#InvalidInstanceId":throw await de_InvalidInstanceIdRes(n);case"DoesNotExistException":case"com.amazonaws.ssm#DoesNotExistException":throw await de_DoesNotExistExceptionRes(n);case"InvalidParameters":case"com.amazonaws.ssm#InvalidParameters":throw await de_InvalidParametersRes(n);case"AssociationAlreadyExists":case"com.amazonaws.ssm#AssociationAlreadyExists":throw await de_AssociationAlreadyExistsRes(n);case"AssociationLimitExceeded":case"com.amazonaws.ssm#AssociationLimitExceeded":throw await de_AssociationLimitExceededRes(n);case"InvalidDocument":case"com.amazonaws.ssm#InvalidDocument":throw await de_InvalidDocumentRes(n);case"InvalidDocumentVersion":case"com.amazonaws.ssm#InvalidDocumentVersion":throw await de_InvalidDocumentVersionRes(n);case"InvalidOutputLocation":case"com.amazonaws.ssm#InvalidOutputLocation":throw await de_InvalidOutputLocationRes(n);case"InvalidSchedule":case"com.amazonaws.ssm#InvalidSchedule":throw await de_InvalidScheduleRes(n);case"InvalidTag":case"com.amazonaws.ssm#InvalidTag":throw await de_InvalidTagRes(n);case"InvalidTarget":case"com.amazonaws.ssm#InvalidTarget":throw await de_InvalidTargetRes(n);case"InvalidTargetMaps":case"com.amazonaws.ssm#InvalidTargetMaps":throw await de_InvalidTargetMapsRes(n);case"UnsupportedPlatformType":case"com.amazonaws.ssm#UnsupportedPlatformType":throw await de_UnsupportedPlatformTypeRes(n);case"DocumentAlreadyExists":case"com.amazonaws.ssm#DocumentAlreadyExists":throw await de_DocumentAlreadyExistsRes(n);case"DocumentLimitExceeded":case"com.amazonaws.ssm#DocumentLimitExceeded":throw await de_DocumentLimitExceededRes(n);case"InvalidDocumentContent":case"com.amazonaws.ssm#InvalidDocumentContent":throw await de_InvalidDocumentContentRes(n);case"InvalidDocumentSchemaVersion":case"com.amazonaws.ssm#InvalidDocumentSchemaVersion":throw await de_InvalidDocumentSchemaVersionRes(n);case"MaxDocumentSizeExceeded":case"com.amazonaws.ssm#MaxDocumentSizeExceeded":throw await de_MaxDocumentSizeExceededRes(n);case"IdempotentParameterMismatch":case"com.amazonaws.ssm#IdempotentParameterMismatch":throw await de_IdempotentParameterMismatchRes(n);case"ResourceLimitExceededException":case"com.amazonaws.ssm#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(n);case"OpsItemAccessDeniedException":case"com.amazonaws.ssm#OpsItemAccessDeniedException":throw await de_OpsItemAccessDeniedExceptionRes(n);case"OpsItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemAlreadyExistsException":throw await de_OpsItemAlreadyExistsExceptionRes(n);case"OpsMetadataAlreadyExistsException":case"com.amazonaws.ssm#OpsMetadataAlreadyExistsException":throw await de_OpsMetadataAlreadyExistsExceptionRes(n);case"OpsMetadataInvalidArgumentException":case"com.amazonaws.ssm#OpsMetadataInvalidArgumentException":throw await de_OpsMetadataInvalidArgumentExceptionRes(n);case"OpsMetadataLimitExceededException":case"com.amazonaws.ssm#OpsMetadataLimitExceededException":throw await de_OpsMetadataLimitExceededExceptionRes(n);case"OpsMetadataTooManyUpdatesException":case"com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":throw await de_OpsMetadataTooManyUpdatesExceptionRes(n);case"ResourceDataSyncAlreadyExistsException":case"com.amazonaws.ssm#ResourceDataSyncAlreadyExistsException":throw await de_ResourceDataSyncAlreadyExistsExceptionRes(n);case"ResourceDataSyncCountExceededException":case"com.amazonaws.ssm#ResourceDataSyncCountExceededException":throw await de_ResourceDataSyncCountExceededExceptionRes(n);case"ResourceDataSyncInvalidConfigurationException":case"com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(n);case"InvalidActivation":case"com.amazonaws.ssm#InvalidActivation":throw await de_InvalidActivationRes(n);case"InvalidActivationId":case"com.amazonaws.ssm#InvalidActivationId":throw await de_InvalidActivationIdRes(n);case"AssociationDoesNotExist":case"com.amazonaws.ssm#AssociationDoesNotExist":throw await de_AssociationDoesNotExistRes(n);case"AssociatedInstances":case"com.amazonaws.ssm#AssociatedInstances":throw await de_AssociatedInstancesRes(n);case"InvalidDocumentOperation":case"com.amazonaws.ssm#InvalidDocumentOperation":throw await de_InvalidDocumentOperationRes(n);case"InvalidDeleteInventoryParametersException":case"com.amazonaws.ssm#InvalidDeleteInventoryParametersException":throw await de_InvalidDeleteInventoryParametersExceptionRes(n);case"InvalidInventoryRequestException":case"com.amazonaws.ssm#InvalidInventoryRequestException":throw await de_InvalidInventoryRequestExceptionRes(n);case"InvalidOptionException":case"com.amazonaws.ssm#InvalidOptionException":throw await de_InvalidOptionExceptionRes(n);case"InvalidTypeNameException":case"com.amazonaws.ssm#InvalidTypeNameException":throw await de_InvalidTypeNameExceptionRes(n);case"OpsMetadataNotFoundException":case"com.amazonaws.ssm#OpsMetadataNotFoundException":throw await de_OpsMetadataNotFoundExceptionRes(n);case"ParameterNotFound":case"com.amazonaws.ssm#ParameterNotFound":throw await de_ParameterNotFoundRes(n);case"ResourceInUseException":case"com.amazonaws.ssm#ResourceInUseException":throw await de_ResourceInUseExceptionRes(n);case"ResourceDataSyncNotFoundException":case"com.amazonaws.ssm#ResourceDataSyncNotFoundException":throw await de_ResourceDataSyncNotFoundExceptionRes(n);case"MalformedResourcePolicyDocumentException":case"com.amazonaws.ssm#MalformedResourcePolicyDocumentException":throw await de_MalformedResourcePolicyDocumentExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.ssm#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes(n);case"ResourcePolicyConflictException":case"com.amazonaws.ssm#ResourcePolicyConflictException":throw await de_ResourcePolicyConflictExceptionRes(n);case"ResourcePolicyInvalidParameterException":case"com.amazonaws.ssm#ResourcePolicyInvalidParameterException":throw await de_ResourcePolicyInvalidParameterExceptionRes(n);case"ResourcePolicyNotFoundException":case"com.amazonaws.ssm#ResourcePolicyNotFoundException":throw await de_ResourcePolicyNotFoundExceptionRes(n);case"TargetInUseException":case"com.amazonaws.ssm#TargetInUseException":throw await de_TargetInUseExceptionRes(n);case"InvalidFilter":case"com.amazonaws.ssm#InvalidFilter":throw await de_InvalidFilterRes(n);case"InvalidNextToken":case"com.amazonaws.ssm#InvalidNextToken":throw await de_InvalidNextTokenRes(n);case"InvalidAssociationVersion":case"com.amazonaws.ssm#InvalidAssociationVersion":throw await de_InvalidAssociationVersionRes(n);case"AssociationExecutionDoesNotExist":case"com.amazonaws.ssm#AssociationExecutionDoesNotExist":throw await de_AssociationExecutionDoesNotExistRes(n);case"InvalidFilterKey":case"com.amazonaws.ssm#InvalidFilterKey":throw await de_InvalidFilterKeyRes(n);case"InvalidFilterValue":case"com.amazonaws.ssm#InvalidFilterValue":throw await de_InvalidFilterValueRes(n);case"AutomationExecutionNotFoundException":case"com.amazonaws.ssm#AutomationExecutionNotFoundException":throw await de_AutomationExecutionNotFoundExceptionRes(n);case"InvalidPermissionType":case"com.amazonaws.ssm#InvalidPermissionType":throw await de_InvalidPermissionTypeRes(n);case"UnsupportedOperatingSystem":case"com.amazonaws.ssm#UnsupportedOperatingSystem":throw await de_UnsupportedOperatingSystemRes(n);case"InvalidInstanceInformationFilterValue":case"com.amazonaws.ssm#InvalidInstanceInformationFilterValue":throw await de_InvalidInstanceInformationFilterValueRes(n);case"InvalidInstancePropertyFilterValue":case"com.amazonaws.ssm#InvalidInstancePropertyFilterValue":throw await de_InvalidInstancePropertyFilterValueRes(n);case"InvalidDeletionIdException":case"com.amazonaws.ssm#InvalidDeletionIdException":throw await de_InvalidDeletionIdExceptionRes(n);case"InvalidFilterOption":case"com.amazonaws.ssm#InvalidFilterOption":throw await de_InvalidFilterOptionRes(n);case"OpsItemRelatedItemAssociationNotFoundException":case"com.amazonaws.ssm#OpsItemRelatedItemAssociationNotFoundException":throw await de_OpsItemRelatedItemAssociationNotFoundExceptionRes(n);case"InvalidDocumentType":case"com.amazonaws.ssm#InvalidDocumentType":throw await de_InvalidDocumentTypeRes(n);case"UnsupportedCalendarException":case"com.amazonaws.ssm#UnsupportedCalendarException":throw await de_UnsupportedCalendarExceptionRes(n);case"InvalidPluginName":case"com.amazonaws.ssm#InvalidPluginName":throw await de_InvalidPluginNameRes(n);case"InvocationDoesNotExist":case"com.amazonaws.ssm#InvocationDoesNotExist":throw await de_InvocationDoesNotExistRes(n);case"UnsupportedFeatureRequiredException":case"com.amazonaws.ssm#UnsupportedFeatureRequiredException":throw await de_UnsupportedFeatureRequiredExceptionRes(n);case"InvalidAggregatorException":case"com.amazonaws.ssm#InvalidAggregatorException":throw await de_InvalidAggregatorExceptionRes(n);case"InvalidInventoryGroupException":case"com.amazonaws.ssm#InvalidInventoryGroupException":throw await de_InvalidInventoryGroupExceptionRes(n);case"InvalidResultAttributeException":case"com.amazonaws.ssm#InvalidResultAttributeException":throw await de_InvalidResultAttributeExceptionRes(n);case"InvalidKeyId":case"com.amazonaws.ssm#InvalidKeyId":throw await de_InvalidKeyIdRes(n);case"ParameterVersionNotFound":case"com.amazonaws.ssm#ParameterVersionNotFound":throw await de_ParameterVersionNotFoundRes(n);case"ServiceSettingNotFound":case"com.amazonaws.ssm#ServiceSettingNotFound":throw await de_ServiceSettingNotFoundRes(n);case"ParameterVersionLabelLimitExceeded":case"com.amazonaws.ssm#ParameterVersionLabelLimitExceeded":throw await de_ParameterVersionLabelLimitExceededRes(n);case"DocumentPermissionLimit":case"com.amazonaws.ssm#DocumentPermissionLimit":throw await de_DocumentPermissionLimitRes(n);case"ComplianceTypeCountLimitExceededException":case"com.amazonaws.ssm#ComplianceTypeCountLimitExceededException":throw await de_ComplianceTypeCountLimitExceededExceptionRes(n);case"InvalidItemContentException":case"com.amazonaws.ssm#InvalidItemContentException":throw await de_InvalidItemContentExceptionRes(n);case"ItemSizeLimitExceededException":case"com.amazonaws.ssm#ItemSizeLimitExceededException":throw await de_ItemSizeLimitExceededExceptionRes(n);case"TotalSizeLimitExceededException":case"com.amazonaws.ssm#TotalSizeLimitExceededException":throw await de_TotalSizeLimitExceededExceptionRes(n);case"CustomSchemaCountLimitExceededException":case"com.amazonaws.ssm#CustomSchemaCountLimitExceededException":throw await de_CustomSchemaCountLimitExceededExceptionRes(n);case"InvalidInventoryItemContextException":case"com.amazonaws.ssm#InvalidInventoryItemContextException":throw await de_InvalidInventoryItemContextExceptionRes(n);case"ItemContentMismatchException":case"com.amazonaws.ssm#ItemContentMismatchException":throw await de_ItemContentMismatchExceptionRes(n);case"SubTypeCountLimitExceededException":case"com.amazonaws.ssm#SubTypeCountLimitExceededException":throw await de_SubTypeCountLimitExceededExceptionRes(n);case"UnsupportedInventoryItemContextException":case"com.amazonaws.ssm#UnsupportedInventoryItemContextException":throw await de_UnsupportedInventoryItemContextExceptionRes(n);case"UnsupportedInventorySchemaVersionException":case"com.amazonaws.ssm#UnsupportedInventorySchemaVersionException":throw await de_UnsupportedInventorySchemaVersionExceptionRes(n);case"HierarchyLevelLimitExceededException":case"com.amazonaws.ssm#HierarchyLevelLimitExceededException":throw await de_HierarchyLevelLimitExceededExceptionRes(n);case"HierarchyTypeMismatchException":case"com.amazonaws.ssm#HierarchyTypeMismatchException":throw await de_HierarchyTypeMismatchExceptionRes(n);case"IncompatiblePolicyException":case"com.amazonaws.ssm#IncompatiblePolicyException":throw await de_IncompatiblePolicyExceptionRes(n);case"InvalidAllowedPatternException":case"com.amazonaws.ssm#InvalidAllowedPatternException":throw await de_InvalidAllowedPatternExceptionRes(n);case"InvalidPolicyAttributeException":case"com.amazonaws.ssm#InvalidPolicyAttributeException":throw await de_InvalidPolicyAttributeExceptionRes(n);case"InvalidPolicyTypeException":case"com.amazonaws.ssm#InvalidPolicyTypeException":throw await de_InvalidPolicyTypeExceptionRes(n);case"ParameterAlreadyExists":case"com.amazonaws.ssm#ParameterAlreadyExists":throw await de_ParameterAlreadyExistsRes(n);case"ParameterLimitExceeded":case"com.amazonaws.ssm#ParameterLimitExceeded":throw await de_ParameterLimitExceededRes(n);case"ParameterMaxVersionLimitExceeded":case"com.amazonaws.ssm#ParameterMaxVersionLimitExceeded":throw await de_ParameterMaxVersionLimitExceededRes(n);case"ParameterPatternMismatchException":case"com.amazonaws.ssm#ParameterPatternMismatchException":throw await de_ParameterPatternMismatchExceptionRes(n);case"PoliciesLimitExceededException":case"com.amazonaws.ssm#PoliciesLimitExceededException":throw await de_PoliciesLimitExceededExceptionRes(n);case"UnsupportedParameterType":case"com.amazonaws.ssm#UnsupportedParameterType":throw await de_UnsupportedParameterTypeRes(n);case"ResourcePolicyLimitExceededException":case"com.amazonaws.ssm#ResourcePolicyLimitExceededException":throw await de_ResourcePolicyLimitExceededExceptionRes(n);case"AlreadyExistsException":case"com.amazonaws.ssm#AlreadyExistsException":throw await de_AlreadyExistsExceptionRes(n);case"FeatureNotAvailableException":case"com.amazonaws.ssm#FeatureNotAvailableException":throw await de_FeatureNotAvailableExceptionRes(n);case"AutomationStepNotFoundException":case"com.amazonaws.ssm#AutomationStepNotFoundException":throw await de_AutomationStepNotFoundExceptionRes(n);case"InvalidAutomationSignalException":case"com.amazonaws.ssm#InvalidAutomationSignalException":throw await de_InvalidAutomationSignalExceptionRes(n);case"InvalidNotificationConfig":case"com.amazonaws.ssm#InvalidNotificationConfig":throw await de_InvalidNotificationConfigRes(n);case"InvalidOutputFolder":case"com.amazonaws.ssm#InvalidOutputFolder":throw await de_InvalidOutputFolderRes(n);case"InvalidRole":case"com.amazonaws.ssm#InvalidRole":throw await de_InvalidRoleRes(n);case"InvalidAssociation":case"com.amazonaws.ssm#InvalidAssociation":throw await de_InvalidAssociationRes(n);case"AutomationDefinitionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionNotFoundException":throw await de_AutomationDefinitionNotFoundExceptionRes(n);case"AutomationDefinitionVersionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":throw await de_AutomationDefinitionVersionNotFoundExceptionRes(n);case"AutomationExecutionLimitExceededException":case"com.amazonaws.ssm#AutomationExecutionLimitExceededException":throw await de_AutomationExecutionLimitExceededExceptionRes(n);case"InvalidAutomationExecutionParametersException":case"com.amazonaws.ssm#InvalidAutomationExecutionParametersException":throw await de_InvalidAutomationExecutionParametersExceptionRes(n);case"AutomationDefinitionNotApprovedException":case"com.amazonaws.ssm#AutomationDefinitionNotApprovedException":throw await de_AutomationDefinitionNotApprovedExceptionRes(n);case"TargetNotConnected":case"com.amazonaws.ssm#TargetNotConnected":throw await de_TargetNotConnectedRes(n);case"InvalidAutomationStatusUpdateException":case"com.amazonaws.ssm#InvalidAutomationStatusUpdateException":throw await de_InvalidAutomationStatusUpdateExceptionRes(n);case"AssociationVersionLimitExceeded":case"com.amazonaws.ssm#AssociationVersionLimitExceeded":throw await de_AssociationVersionLimitExceededRes(n);case"InvalidUpdate":case"com.amazonaws.ssm#InvalidUpdate":throw await de_InvalidUpdateRes(n);case"StatusUnchanged":case"com.amazonaws.ssm#StatusUnchanged":throw await de_StatusUnchangedRes(n);case"DocumentVersionLimitExceeded":case"com.amazonaws.ssm#DocumentVersionLimitExceeded":throw await de_DocumentVersionLimitExceededRes(n);case"DuplicateDocumentContent":case"com.amazonaws.ssm#DuplicateDocumentContent":throw await de_DuplicateDocumentContentRes(n);case"DuplicateDocumentVersionName":case"com.amazonaws.ssm#DuplicateDocumentVersionName":throw await de_DuplicateDocumentVersionNameRes(n);case"OpsMetadataKeyLimitExceededException":case"com.amazonaws.ssm#OpsMetadataKeyLimitExceededException":throw await de_OpsMetadataKeyLimitExceededExceptionRes(n);case"ResourceDataSyncConflictException":case"com.amazonaws.ssm#ResourceDataSyncConflictException":throw await de_ResourceDataSyncConflictExceptionRes(n);default:const t=n.body;return throwDefaultError({output:e,parsedBody:t,errorCode:r})}},de_AlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociatedInstancesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociatedInstances({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationExecutionDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationExecutionDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AssociationVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AssociationVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotApprovedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotApprovedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationDefinitionVersionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationDefinitionVersionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationExecutionNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationExecutionNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_AutomationStepNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new AutomationStepNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ComplianceTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ComplianceTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_CustomSchemaCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new CustomSchemaCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentPermissionLimitRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentPermissionLimit({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DocumentVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DocumentVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DoesNotExistExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DoesNotExistException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateDocumentVersionNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateDocumentVersionName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_DuplicateInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new DuplicateInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_FeatureNotAvailableExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new FeatureNotAvailableException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyLevelLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyLevelLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_HierarchyTypeMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new HierarchyTypeMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IdempotentParameterMismatchRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IdempotentParameterMismatch({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_IncompatiblePolicyExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new IncompatiblePolicyException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InternalServerErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InternalServerError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidActivationIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidActivationId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAggregatorExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAggregatorException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAllowedPatternExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAllowedPatternException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAssociationVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAssociationVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationExecutionParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationExecutionParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationSignalExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationSignalException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidAutomationStatusUpdateExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidAutomationStatusUpdateException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidCommandIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidCommandId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeleteInventoryParametersExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeleteInventoryParametersException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDeletionIdExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDeletionIdException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocument({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentContentRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentContent({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentOperationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentOperation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentSchemaVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentSchemaVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidDocumentVersionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidDocumentVersion({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilter({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterKeyRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterKey({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterOptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterOption({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstanceInformationFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstanceInformationFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInstancePropertyFilterValueRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInstancePropertyFilterValue({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryGroupExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryGroupException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidInventoryRequestExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidInventoryRequestException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidItemContentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidItemContentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidKeyIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidKeyId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNextTokenRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNextToken({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidNotificationConfigRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidNotificationConfig({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOptionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOptionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputFolderRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputFolder({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidOutputLocationRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidOutputLocation({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidParametersRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidParameters({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPermissionTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPermissionType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPluginNameRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPluginName({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidPolicyTypeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidPolicyTypeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceIdRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceId({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResourceTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResourceType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidResultAttributeExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidResultAttributeException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidRoleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidRole({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidScheduleRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidSchedule({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTagRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTag({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTarget({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTargetMapsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTargetMaps({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidTypeNameExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidTypeNameException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvalidUpdateRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvalidUpdate({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_InvocationDoesNotExistRes=async(e,t)=>{const n=e.body,r=_json(n),i=new InvocationDoesNotExist({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemContentMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemContentMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ItemSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ItemSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MalformedResourcePolicyDocumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MalformedResourcePolicyDocumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_MaxDocumentSizeExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new MaxDocumentSizeExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAccessDeniedExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAccessDeniedException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsItemRelatedItemAssociationNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsItemRelatedItemAssociationNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataInvalidArgumentExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataInvalidArgumentException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataKeyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataKeyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_OpsMetadataTooManyUpdatesExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new OpsMetadataTooManyUpdatesException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterAlreadyExistsRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterAlreadyExists({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterMaxVersionLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterMaxVersionLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterPatternMismatchExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterPatternMismatchException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionLabelLimitExceededRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionLabelLimitExceeded({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ParameterVersionNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ParameterVersionNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_PoliciesLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new PoliciesLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncAlreadyExistsException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncCountExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncCountExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncInvalidConfigurationExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncInvalidConfigurationException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceDataSyncNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceDataSyncNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourceNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourceNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyConflictExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyConflictException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyInvalidParameterException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ResourcePolicyNotFoundExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ResourcePolicyNotFoundException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_ServiceSettingNotFoundRes=async(e,t)=>{const n=e.body,r=_json(n),i=new ServiceSettingNotFound({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_StatusUnchangedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new StatusUnchanged({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_SubTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new SubTypeCountLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetInUseExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetInUseException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TargetNotConnectedRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TargetNotConnected({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyTagsErrorRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyTagsError({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TooManyUpdatesRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TooManyUpdates({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_TotalSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new TotalSizeLimitExceededException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedCalendarExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedCalendarException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedFeatureRequiredExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedFeatureRequiredException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventoryItemContextException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedInventorySchemaVersionExceptionRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedInventorySchemaVersionException({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedOperatingSystemRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedOperatingSystem({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedParameterTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedParameterType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_UnsupportedPlatformTypeRes=async(e,t)=>{const n=e.body,r=_json(n),i=new UnsupportedPlatformType({$metadata:deserializeMetadata(e),...r});return decorateServiceException(i,n)},de_GetParameterResult=(e,t)=>take(e,{Parameter:e=>de_Parameter(e)}),de_GetParametersResult=(e,t)=>take(e,{InvalidParameters:_json,Parameters:e=>de_ParameterList(e)}),de_Parameter=(e,t)=>take(e,{ARN:expectString,DataType:expectString,LastModifiedDate:e=>expectNonNull(parseEpochTimestamp(expectNumber(e))),Name:expectString,Selector:expectString,SourceResult:expectString,Type:expectString,Value:expectString,Version:expectLong}),de_ParameterList=(e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>de_Parameter(e)));return n},deserializeMetadata=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),throwDefaultError=withBaseException(SSMServiceException),buildHttpRpcRequest=async(e,t,n,r,i)=>{const{hostname:o,protocol:s="https",port:a,path:c}=await e.endpoint(),u={protocol:s,hostname:o,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==i&&(u.body=i),new HttpRequest(u)};function sharedHeaders(e){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AmazonSSM.${e}`}}class GetParameterCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameter",{}).n("SSMClient","GetParameterCommand").f(void 0,GetParameterResultFilterSensitiveLog).ser(se_GetParameterCommand).de(de_GetParameterCommand).build()){}class GetParametersCommand extends(Command.classBuilder().ep({...commonParams}).m((function(e,t,n,r){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin(n,e.getEndpointParameterInstructions())]})).s("AmazonSSM","GetParameters",{}).n("SSMClient","GetParametersCommand").f(void 0,GetParametersResultFilterSensitiveLog).ser(se_GetParametersCommand).de(de_GetParametersCommand).build()){}const version$1="6.2.0-7",REST_API_URL="https://api.allthings.me",OAUTH_URL="https://accounts.allthings.me",QUEUE_CONCURRENCY=void 0,QUEUE_DELAY=0,QUEUE_RESERVOIR=30,QUEUE_RESERVOIR_REFILL_INTERVAL=166,REQUEST_BACK_OFF_INTERVAL=200,REQUEST_MAX_RETRIES=50,DEFAULT_API_WRAPPER_OPTIONS={apiUrl:process.env.ALLTHINGS_REST_API_URL||REST_API_URL,clientId:process.env.ALLTHINGS_OAUTH_CLIENT_ID,clientSecret:process.env.ALLTHINGS_OAUTH_CLIENT_SECRET,oauthUrl:process.env.ALLTHINGS_OAUTH_URL||OAUTH_URL,password:process.env.ALLTHINGS_OAUTH_PASSWORD,requestBackOffInterval:REQUEST_BACK_OFF_INTERVAL,requestMaxRetries:REQUEST_MAX_RETRIES,scope:"user:profile",username:process.env.ALLTHINGS_OAUTH_USERNAME},USER_AGENT=`Allthings Node SDK REST Client/${version$1}`,DEFAULT_AWS_CONFIGURATION={region:"eu-central-2"};var __rest$5=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const DEFAULT_CLIENT_CONFIG={clientConfig:DEFAULT_AWS_CONFIGURATION,onlyDefault:!1,prefix:process.env.SSM_PARAM_PATH},getSecrets=async(e,t,n,r)=>{var i;if(t.onlyDefault)return r?[r]:[];try{const o=await e.send(new GetParametersCommand({Names:n.map((e=>t.prefix+e)),WithDecryption:!0})),s=null===(i=null==o?void 0:o.Parameters)||void 0===i?void 0:i.map((e=>{var t,n;return null!==(n=null!==(t=e.Value)&&void 0!==t?t:r)&&void 0!==n?n:""}));return s||(r?[r]:[])}catch(e){return t.logger&&t.logger(e),r?[r]:[]}},getSecret=async(e,t,n,r)=>{var i,o;if(console.log(t,n,{defaultValue:r}),t.onlyDefault)return r;try{const s=await e.send(new GetParameterCommand({Name:t.prefix+n,WithDecryption:!0}));return null!==(o=null===(i=null==s?void 0:s.Parameter)||void 0===i?void 0:i.Value)&&void 0!==o?o:r}catch(e){return t.logger&&t.logger(e),r}},parameterStore=e=>{const t=Object.assign(Object.assign({},DEFAULT_CLIENT_CONFIG),e),{clientConfig:n}=t,r=__rest$5(t,["clientConfig"]),i=new SSMClient(n);return{getSecret:(e,t)=>getSecret(i,r,e,t),getSecrets:(e,t)=>getSecrets(i,r,e,t)}};function createTokenStore(e){const t=new Map(Object.entries(e||{}));return{get:e=>t.get(e),reset:()=>t.clear(),set:e=>Object.entries(e).forEach((([e,n])=>t.set(e,n)))}}var queryString={},strictUriEncode=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],decodeComponents(n),decodeComponents(r))}function decode(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(singleMatcher)||[],n=1;n<t.length;n++)t=(e=decodeComponents(t,n).join("")).match(singleMatcher)||[];return e}}function customDecodeURIComponent(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=multiMatcher.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=decode(n[0]);r!==n[0]&&(t[n[0]]=r)}n=multiMatcher.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),o=0;o<i.length;o++){var s=i[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}var decodeUriComponent=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return customDecodeURIComponent(e)}},splitOnFirst=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},filterObj=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var s=r[o],a=e[s];(i?-1!==t.indexOf(s):t(s,a,e))&&(n[s]=a)}return n};!function(e){const t=strictUriEncode,n=decodeUriComponent,r=splitOnFirst,i=filterObj,o=Symbol("encodeFragmentIdentifier");function s(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,n){return n.encode?n.strict?t(e):encodeURIComponent(e):e}function c(e,t){return t.decode?n(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"colon-list-separator":return(e,n,r)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&c(n,e).includes(e.arrayFormatSeparator);n=o?c(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===n?n:c(n,e);r[t]=s};case"bracket-separator":return(t,n,r)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(r[t]=n?c(n,e):n);const o=null===n?[]:n.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==r[t]?r[t]=[].concat(r[t],o):r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,s]=r(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:c(s,t),n(c(e,t),s,i)}for(const e of Object.keys(i)){const n=i[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=p(n[e],t);else i[e]=p(n,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const n=i[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e}),Object.create(null))}e.extract=d,e.parse=m,e.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[",i,"]"].join("")]:[...n,[a(t,e),"[",a(i,e),"]=",a(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),"[]"].join("")]:[...n,[a(t,e),"[]=",a(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[a(t,e),":list="].join("")]:[...n,[a(t,e),":list=",a(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:(i=null===i?"":i,0===r.length?[[a(n,e),t,a(i,e)].join("")]:[[r,a(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,a(t,e)]:[...n,[a(t,e),"=",a(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((n=>{const i=e[n];return void 0===i?"":null===i?a(n,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?a(n,t)+"[]":i.reduce(r(n),[]).join("&"):a(n,t)+"="+a(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,i]=r(e,"#");return Object.assign({url:n.split("?")[0]||"",query:m(d(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:c(i,t)}:{})},e.stringifyUrl=(t,n)=>{n=Object.assign({encode:!0,strict:!0,[o]:!0},n);const r=l(t.url).split("?")[0]||"",i=e.extract(t.url),s=e.parse(i,{sort:!1}),c=Object.assign(s,t.query);let u=e.stringify(c,n);u&&(u=`?${u}`);let d=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(t.url);return t.fragmentIdentifier&&(d=`#${n[o]?a(t.fragmentIdentifier,n):t.fragmentIdentifier}`),`${r}${u}${d}`},e.pick=(t,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[o]:!1},r);const{url:s,query:a,fragmentIdentifier:c}=e.parseUrl(t,r);return e.stringifyUrl({url:s,query:i(a,n),fragmentIdentifier:c},r)},e.exclude=(t,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return e.pick(t,i,r)}}(queryString);var querystring=getDefaultExportFromCjs(queryString);const RESPONSE_TYPE$1="code",GRANT_TYPE$3="authorization_code",castToAuthorizationRequestParams$1=e=>{const{redirectUri:t,clientId:n,scope:r,state:i}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform authorization code grant redirect');if(!t)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant redirect');return Object.assign(Object.assign({client_id:n,redirect_uri:t,response_type:RESPONSE_TYPE$1},r?{scope:r}:{}),i?{state:i}:{})},isEligibleForClientRedirect$1=e=>{try{return!!castToAuthorizationRequestParams$1(e)}catch(e){return!1}},getRedirectUrl$1=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams$1(e),{skipEmptyString:!0,skipNull:!0})}`,castToTokenRequestParams$2=e=>{const{authorizationCode:t,redirectUri:n,clientId:r,clientSecret:i}=e;if(!r)throw new Error('Missing required "clientId" parameter to perform authorization code grant');if(!n)throw new Error('Missing required "redirectUri" parameter to perform authorization code grant');if(!t)throw new Error('Missing required "authorizationCode" parameter to perform authorization code grant');return Object.assign({client_id:r,code:t,grant_type:GRANT_TYPE$3,redirect_uri:n},i?{client_secret:i}:{})},isEligible$3=e=>{try{return!!castToTokenRequestParams$2(e)}catch(e){return!1}},requestToken$3=(e,t)=>e(castToTokenRequestParams$2(t));var browserPonyfill={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==commonjsGlobal&&commonjsGlobal,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in n,a="ArrayBuffer"in n;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function m(e){this.map={},e instanceof m?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&o&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=h(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(y)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}m.prototype.append=function(e,t){e=l(e),t=d(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},m.prototype.delete=function(e){delete this.map[l(e)]},m.prototype.get=function(e){return e=l(e),this.has(e)?this.map[e]:null},m.prototype.has=function(e){return this.map.hasOwnProperty(l(e))},m.prototype.set=function(e,t){this.map[l(e)]=d(t)},m.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},m.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),p(e)},m.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},m.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),p(e)},i&&(m.prototype[Symbol.iterator]=m.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(t=t||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new m(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new m(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),v.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function b(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function S(e,t){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new m(t.headers),this.url=t.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},_.call(E.prototype),_.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:0,statusText:""});return e.type="error",e};var w=[301,302,303,307,308];S.redirect=function(e,t){if(-1===w.indexOf(t))throw new RangeError("Invalid status code");return new S(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function x(e,r){return new Promise((function(i,s){var c=new E(e,r);if(c.signal&&c.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function l(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new m,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout((function(){i(new S(r,n))}),0)},u.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){s(new t.DOMException("Aborted","AbortError"))}),0)},u.open(c.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?u.withCredentials=!0:"omit"===c.credentials&&(u.withCredentials=!1),"responseType"in u&&(o?u.responseType="blob":a&&c.headers.get("Content-Type")&&-1!==c.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof m?c.headers.forEach((function(e,t){u.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){u.setRequestHeader(e,d(r.headers[e]))})),c.signal&&(c.signal.addEventListener("abort",l),u.onreadystatechange=function(){4===u.readyState&&c.signal.removeEventListener("abort",l)}),u.send(void 0===c._bodyInit?null:c._bodyInit)}))}x.polyfill=!0,n.fetch||(n.fetch=x,n.Headers=m,n.Request=E,n.Response=S),t.Headers=m,t.Request=E,t.Response=S,t.fetch=x}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports,fetch$1=getDefaultExportFromCjs(browserPonyfillExports);const SUBSCRIPTIONS=process.env.DEBUG&&process.env.DEBUG.split(",").map((e=>e.trim()))||[];function makeLogger(e){return["log","info","warn","error"].reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:function(...t){return(SUBSCRIPTIONS.includes("*")||SUBSCRIPTIONS.includes(e)||SUBSCRIPTIONS.includes(e.toLocaleLowerCase()))&&console[n](`${e}:`,...t),!0}})),{})}const logger=makeLogger("OAuth Token Request"),makeFetchTokenRequester=e=>async t=>{try{const n=await fetch$1(e,{body:querystring.stringify(t,{skipEmptyString:!0,skipNull:!0}),cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded",accept:"application/json","user-agent":USER_AGENT},method:"POST",mode:"cors"});if(200!==n.status)throw n;const{access_token:r,refresh_token:i,expires_in:o}=await n.json();return{accessToken:r,expiresIn:o,refreshToken:i}}catch(e){if(!e.status)throw e;const t=`HTTP ${e.status} — ${e.statusText}`;throw logger.error(t,e.response),new Error(`HTTP ${e.status} — ${e.statusText}. Could not get token.`)}},GRANT_TYPE$2="refresh_token",castToTokenRequestParams$1=e=>{const{clientId:t,clientSecret:n,refreshToken:r,scope:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform refresh token grant');if(!r)throw new Error('Missing required "refreshToken" parameter to perform refresh token grant');return Object.assign(Object.assign({client_id:t,grant_type:GRANT_TYPE$2,refresh_token:r},n?{client_secret:n}:{}),i?{scope:i}:{})},isEligible$2=e=>{try{return!!castToTokenRequestParams$1(e)}catch(e){return!1}},requestToken$2=(e,t)=>e(castToTokenRequestParams$1(t));async function requestAndSaveToStore(e,t){const n=await e();return t.set(n),n}const partial=(e,...t)=>(...n)=>e(...t,...n);async function until(e,t,n,r=0){const i=await t(n,r);return await e(i,r)?i:until(e,t,i,r+1)}function fnClearInterval(e){return clearInterval(e),!0}function pseudoRandomString(e=16){let t="";for(;t.length<e;)t+=Math.random().toString(36).substr(2);return t.substr(0,e)}async function del(e,t,n,r,i){return e("delete",t,{body:n,headers:i},r)}async function get(e,t,n,r,i){return e("get",t,{headers:i,query:n},r)}var __rest$4=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumGender,EnumUserType,EnumCommunicationPreferenceChannel,EnumUserPermissionRole,EnumUserPermissionObjectType;!function(e){e.female="female",e.male="male"}(EnumGender||(EnumGender={})),function(e){e.allthingsUser="allthings_user",e.allthingsContent="allthings_content",e.customer="customer",e.demoContent="demo_content",e.demoPublic="demo_public",e.partner="partner"}(EnumUserType||(EnumUserType={})),exports.EnumCommunicationPreferenceChannel=void 0,EnumCommunicationPreferenceChannel=exports.EnumCommunicationPreferenceChannel||(exports.EnumCommunicationPreferenceChannel={}),EnumCommunicationPreferenceChannel.push="push",EnumCommunicationPreferenceChannel.email="email",exports.EnumUserPermissionRole=void 0,EnumUserPermissionRole=exports.EnumUserPermissionRole||(exports.EnumUserPermissionRole={}),EnumUserPermissionRole.appAdmin="app-admin",EnumUserPermissionRole.appOwner="app-owner",EnumUserPermissionRole.articlesAgent="articles-agent",EnumUserPermissionRole.articlesViewOnly="articles-view-only",EnumUserPermissionRole.bookableAssetAgent="bookable-asset-agent",EnumUserPermissionRole.bookingAgent="booking-agent",EnumUserPermissionRole.cockpitManager="cockpit-manager",EnumUserPermissionRole.dataConnectorAdmin="data-connector-admin",EnumUserPermissionRole.documentAdmin="doc-admin",EnumUserPermissionRole.externalAgent="external-agent",EnumUserPermissionRole.globalOrgAdmin="global-org-admin",EnumUserPermissionRole.globalUserAdmin="global-user-admin",EnumUserPermissionRole.orgAdmin="org-admin",EnumUserPermissionRole.orgTeamManager="org-team-manager",EnumUserPermissionRole.pinboardAgent="pinboard-agent",EnumUserPermissionRole.platformOwner="platform-owner",EnumUserPermissionRole.qa="qa",EnumUserPermissionRole.serviceCenterAgent="service-center-agent",EnumUserPermissionRole.serviceCenterManager="service-center-manager",EnumUserPermissionRole.setup="setup",EnumUserPermissionRole.tenantManager="tenant-manager",exports.EnumUserPermissionObjectType=void 0,EnumUserPermissionObjectType=exports.EnumUserPermissionObjectType||(exports.EnumUserPermissionObjectType={}),EnumUserPermissionObjectType.app="App",EnumUserPermissionObjectType.group="Group",EnumUserPermissionObjectType.property="Property",EnumUserPermissionObjectType.unit="Unit";const remapUserResult=e=>{const{tenantIDs:t}=e,n=__rest$4(e,["tenantIDs"]);return Object.assign(Object.assign({},n),{tenantIds:t})},remapEmbeddedUser=e=>e.users?e.users.map(remapUserResult):[];async function userCreate(e,t,n,r){return e.post("/v1/users",Object.assign(Object.assign({},r),{creationContext:t,username:n}))}async function getUsers(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/users",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i.map(remapUserResult)},total:o}}async function getCurrentUser(e){return remapUserResult(await e.get("/v1/me"))}async function userGetById(e,t){return remapUserResult(await e.get(`/v1/users/${t}`))}async function userUpdateById(e,t,n){const{tenantIds:r}=n,i=__rest$4(n,["tenantIds"]);return remapUserResult(await e.patch(`/v1/users/${t}`,Object.assign(Object.assign({},i),{tenantIDs:r})))}async function userCreatePermission(e,t,n){const{objectId:r}=n,i=__rest$4(n,["objectId"]),o=await e.post(`/v1/users/${t}/permissions`,Object.assign(Object.assign({},i),{objectID:r})),{objectID:s}=o,a=__rest$4(o,["objectID"]);return Object.assign(Object.assign({},a),{objectId:s})}async function userCreatePermissionBatch(e,t,n){const{objectId:r,objectType:i,roles:o,startDate:s,endDate:a}=n,c={batch:o.map((e=>({endDate:a&&a.toISOString(),objectID:r,objectType:i,restrictions:[],role:e,startDate:s&&s.toISOString()})))};return!await e.post(`/v1/users/${t}/permissions`,c)}async function userGetPermissions(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/roles?limit=-1`);return n.map((e=>{var{objectID:t}=e,n=__rest$4(e,["objectID"]);return Object.assign(Object.assign({},n),{objectId:t})}))}async function userDeletePermission(e,t){return!await e.delete(`/v1/permissions/${t}`)}async function userGetUtilisationPeriods(e,t){const{_embedded:{items:n}}=await e.get(`/v1/users/${t}/utilisation-periods`);return n}async function userCheckInToUtilisationPeriod(e,t,n){const{email:r}=await e.userGetById(t);return e.utilisationPeriodCheckInUser(n,{email:r})}async function userGetByEmail(e,t,n=1,r=1e3){return e.getUsers(n,r,{email:t})}async function userChangePassword(e,t,n,r){return!await e.put(`/v1/users/${t}/password`,{currentPassword:n,plainPassword:r})}async function agentCreate(e,t,n,r,i,o,s){const a=await e.userCreate(t,r,Object.assign(Object.assign({},i),{type:EnumUserType.customer})),c=await e.post(`/v1/property-managers/${n}/users`,Object.assign({userID:a.id},s&&{externalAgentCompany:s}));return!((void 0===o||o)&&await e.post(`/v1/users/${a.id}/invitations`))&&Object.assign(Object.assign({},a),c)}async function agentCreatePermissions(e,t,n,r,i,o,s){return e.userCreatePermissionBatch(t,{endDate:s,objectId:n,objectType:r,restrictions:[],roles:i,startDate:o})}async function appCreate(e,t,n){return e.post(`/v1/users/${t}/apps`,Object.assign(Object.assign({availableLocales:{0:"de_DE"}},n),{siteUrl:n.siteUrl.replace("_","")}))}async function appGetById(e,t){return e.get(`/v1/apps/${t}`)}async function bookingGetById(e,t){return e.get(`/v1/bookings/${t}`)}async function bookingUpdateById(e,t,n){return e.patch(`/v1/bookings/${t}`,n)}async function bucketGet(e,t){return e.get(`/v1/buckets/${t}`)}async function bucketCreate(e,t){return e.post("/v1/buckets",{channels:t.channels,name:t.name})}async function bucketAddFile(e,t,n){return""===await e.post(`/v1/buckets/${t}/files`,{id:n})}async function bucketRemoveFile(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files/${n}`)}async function bucketRemoveFilesInPath(e,t,n){return""===await e.delete(`/v1/buckets/${t}/files`,{folder:n.path})}const createManyFiles=async(e,t)=>await Promise.all(e.map((async e=>{try{return await t.fileCreate({file:e.content,name:e.filename})}catch(e){return e}})));async function createManyFilesSorted(e,t){const n=await createManyFiles(e,t);return{error:n.filter((e=>e instanceof Error)),success:n.filter((e=>!(e instanceof Error))).map((e=>e.id))}}async function conversationGetById(e,t){return e.get(`/v1/conversations/${t}`)}async function conversationCreateMessage(e,t,n){const r=`/v1/conversations/${t}/messages`,i=n.attachments&&n.attachments.length?{content:{description:n.body,files:(await createManyFilesSorted(n.attachments,e)).success},createdBy:n.createdBy,inputChannel:n.inputChannel,internal:!1,type:"file"}:{content:{content:n.body},createdBy:n.createdBy,inputChannel:n.inputChannel,type:"text"};return e.post(r,i)}async function fileCreate(e,t){return e.post("/v1/files",{formData:{file:[t.file,t.name],path:t.path||""}})}async function fileDelete(e,t){return""===await e.delete(`/v1/files/${t}`)}var __rest$3=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};async function groupCreate(e,t,n){const{propertyManagerId:r}=n,i=__rest$3(n,["propertyManagerId"]);return e.post(`/v1/properties/${t}/groups`,Object.assign(Object.assign({},i),{propertyManagerID:r}))}async function groupGetById(e,t){const n=await e.get(`/v1/groups/${t}`),{propertyManagerID:r}=n,i=__rest$3(n,["propertyManagerID"]);return Object.assign(Object.assign({},i),{propertyManagerId:r})}async function groupUpdateById(e,t,n){return e.patch(`/v1/groups/${t}`,n)}async function getGroups(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/groups",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:o}}async function lookupIds(e,t,n){return e.post(`/v1/id-lookup/${t}/${n.resource}`,Object.assign(Object.assign({externalIds:"string"==typeof n.externalIds?[n.externalIds]:n.externalIds},n.parentId?{parentId:n.parentId}:{}),n.userType?{userType:n.userType}:{}))}function stringToDate(e){return new Date(Date.parse(e))}function dateToString(e){return e.toISOString()}var __rest$2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumNotificationCategory,EnumNotificationType,EnumNotificationSettingsValue;function remapNotificationResult(e){var{createdAt:t,objectID:n,referencedObjectID:r}=e,i=__rest$2(e,["createdAt","objectID","referencedObjectID"]);return Object.assign({createdAt:stringToDate(t),objectId:n,referencedObjectId:r},i)}async function notificationsGetByUser(e,t,n=1,r=-1){const{_embedded:{items:i},total:o,metaData:s}=await e.get(`/v1/users/${t}/notifications?page=${n}&limit=${r}`);return{_embedded:{items:i.map(remapNotificationResult)},metaData:s,total:o}}async function notificationsUpdateReadByUser(e,t,n=new Date){return e.patch(`/v1/users/${t}/notifications`,{lastReadAt:dateToString(n)})}async function notificationUpdateRead(e,t){return remapNotificationResult(await e.patch(`/v1/notifications/${t}`,{read:!0}))}function remapKeys(e,t){return Object.entries(e).reduce(((e,n)=>Object.assign(Object.assign({},e),{[t(n[0])]:n[1]})),{})}function camelCaseToDash(e){return e.replace(/([A-Z])/g,(e=>`-${e[0].toLowerCase()}`))}function dashCaseToCamel(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}async function notificationSettingsUpdateByUser(e,t,n){const r=await e.patch(`/v1/users/${t}/notification-settings`,{notificationSettings:remapKeys(n,camelCaseToDash)});return remapKeys(r,dashCaseToCamel)}async function notificationSettingsResetByUser(e,t){return remapKeys(await e.delete(`/v1/users/${t}/notification-settings`),dashCaseToCamel)}async function propertyCreate(e,t,n){return e.post(`/v1/apps/${t}/properties`,n)}async function propertyGetById(e,t){return e.get(`/v1/properties/${t}`)}async function propertyUpdateById(e,t,n){return e.patch(`/v1/properties/${t}`,n)}async function getProperties(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/properties",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:o}}!function(e){e.events="events",e.hintsAndTips="hints-and-tips",e.lostAndFound="lost-and-found",e.localDeals="local-deals",e.localEvents="local-events",e.miscellaneous="miscellaneous",e.deals="deals",e.messages="messages",e.adminMessages="admin-messages",e.newThingsToGive="new-things-to-give",e.newThingsForSale="new-things-for-sale",e.surveys="surveys",e.supportOffer="support-offer",e.supportRequest="support-request",e.sustainability="sustainability",e.localServices="local-services",e.services="services",e.ticketDigestEmail="ticket-digest-email",e.appDigestEmail="app-digest-email",e.newFile="new-file"}(EnumNotificationCategory||(EnumNotificationCategory={})),function(e){e.clipboardThing="clipboard-thing",e.comment="comment",e.communityArticle="community-article",e.newFile="new-file",e.ticketComment="ticket-comment",e.welcomeNotification="welcome-notification"}(EnumNotificationType||(EnumNotificationType={})),function(e){e.never="never",e.immediately="immediately",e.daily="daily",e.weekly="weekly",e.biweekly="biweekly",e.monthly="monthly"}(EnumNotificationSettingsValue||(EnumNotificationSettingsValue={}));var __rest$1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};const remapRegistationCodeResult=e=>{const{tenantID:t}=e,n=__rest$1(e,["tenantID"]);return Object.assign(Object.assign({},n),{externalId:t})};async function registrationCodeCreate(e,t,n,r={permanent:!1}){const{externalId:i}=r,o=__rest$1(r,["externalId"]);return remapRegistationCodeResult(await e.post("/v1/registration-codes",Object.assign(Object.assign({code:t,utilisationPeriods:"string"==typeof n?[n]:n},i?{tenantID:i}:{}),o)))}async function registrationCodeUpdateById(e,t,n){return remapRegistationCodeResult(await e.patch(`/v1/registration-codes/${t}`,n))}async function registrationCodeGetById(e,t){return remapRegistationCodeResult(await e.get(`/v1/invitations/${t}`))}async function registrationCodeDelete(e,t){return""===await e.delete(`/v1/invitations/${t}`)}async function serviceProviderCreate(e,t){return e.post("/v1/service-providers",t)}async function serviceProviderGetById(e,t){return e.get(`/v1/service-providers/${t}`)}async function serviceProviderUpdateById(e,t,n){return e.patch(`/v1/service-providers/${t}`,n)}var ETicketStatus,ETrafficLightColor,EnumUnitObjectType,EnumUnitType,EnumUserRelationType;async function ticketGetById(e,t){return e.get(`/v1/tickets/${t}`)}async function ticketCreateOnUser(e,t,n,r){return e.post(`/v1/users/${t}/tickets`,Object.assign(Object.assign({},r),{files:r.files?(await createManyFilesSorted(r.files,e)).success:[],utilisationPeriod:n}))}async function ticketCreateOnServiceProvider(e,t,n){return e.post(`/v1/property-managers/${t}/tickets`,Object.assign(Object.assign({},n),{files:n.files?(await createManyFilesSorted(n.files,e)).success:[]}))}async function unitCreate(e,t,n){return e.post(`/v1/groups/${t}/units`,n)}async function unitGetById(e,t){return e.get(`/v1/units/${t}`)}async function unitUpdateById(e,t,n){return e.patch(`/v1/units/${t}`,n)}async function getUnits(e,t=1,n=-1,r={}){const{_embedded:{items:i},total:o}=await e.get("/v1/units",{filter:JSON.stringify(r),limit:n,page:t});return{_embedded:{items:i},total:o}}async function userRelationCreate(e,t,n){return e.post(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,readOnly:n.readOnly,role:n.role})}async function userRelationDelete(e,t,n){return e.delete(`/v1/users/${t}/user-relations/${n.type}`,{ids:n.ids,level:n.level,role:n.role})}async function userRelationsGetByUser(e,t){return e.get(`/v1/users/${t}/user-relations`)}!function(e){e.CLOSED="closed",e.WAITING_FOR_AGENT="waiting-for-agent",e.WAITING_FOR_CUSTOMER="waiting-for-customer",e.WAITING_FOR_EXTERNAL="waiting-for-external"}(ETicketStatus||(ETicketStatus={})),function(e){e.GREEN="green",e.RED="red",e.YELLOW="yellow"}(ETrafficLightColor||(ETrafficLightColor={})),exports.EnumUnitObjectType=void 0,EnumUnitObjectType=exports.EnumUnitObjectType||(exports.EnumUnitObjectType={}),EnumUnitObjectType.adjoiningRoom="adjoining-room",EnumUnitObjectType.advertisingSpace="advertising-space",EnumUnitObjectType.aerial="aerial",EnumUnitObjectType.apartmentBuilding="apartment-building",EnumUnitObjectType.atm="atm",EnumUnitObjectType.atmRoom="atm-room",EnumUnitObjectType.attic="attic",EnumUnitObjectType.atticFlat="attic-flat",EnumUnitObjectType.bank="bank",EnumUnitObjectType.basment="basment",EnumUnitObjectType.bikeShed="bike-shed",EnumUnitObjectType.buildingLaw="building-law",EnumUnitObjectType.cafeteria="cafeteria",EnumUnitObjectType.caretakerRoom="caretaker-room",EnumUnitObjectType.carport="carport",EnumUnitObjectType.cellar="cellar",EnumUnitObjectType.commercialProperty="commercial-property",EnumUnitObjectType.commonRoom="common-room",EnumUnitObjectType.deliveryZone="delivery-zone",EnumUnitObjectType.diverse="diverse",EnumUnitObjectType.doubleParkingSpace="double-parking-space",EnumUnitObjectType.engineeringRoom="engineering-room",EnumUnitObjectType.entertainment="entertainment",EnumUnitObjectType.environment="environment",EnumUnitObjectType.estate="estate",EnumUnitObjectType.fillingStation="filling-station",EnumUnitObjectType.fitnessCenter="fitness-center",EnumUnitObjectType.flat="flat",EnumUnitObjectType.freeZone="free-zone",EnumUnitObjectType.garage="garage",EnumUnitObjectType.garden="garden",EnumUnitObjectType.gardenFlat="garden-flat",EnumUnitObjectType.heatingFacilities="heating-facilities",EnumUnitObjectType.hotel="hotel",EnumUnitObjectType.incidentalRentalExpenses="incidental-rental-expenses",EnumUnitObjectType.industry="industry",EnumUnitObjectType.kiosk="kiosk",EnumUnitObjectType.kitchen="kitchen",EnumUnitObjectType.loft="loft",EnumUnitObjectType.machine="machine",EnumUnitObjectType.maisonette="maisonette",EnumUnitObjectType.medicalPractice="medical-practice",EnumUnitObjectType.mopedShed="moped-shed",EnumUnitObjectType.motorcycleParkingSpace="motorcycle-parking-space",EnumUnitObjectType.office="office",EnumUnitObjectType.oneFamilyHouse="one-family-house",EnumUnitObjectType.parkingBox="parking-box",EnumUnitObjectType.parkingGarage="parking-garage",EnumUnitObjectType.parkingSpace="parking-space",EnumUnitObjectType.parkingSpaces="parking-spaces",EnumUnitObjectType.penthouse="penthouse",EnumUnitObjectType.productionPlant="production-plant",EnumUnitObjectType.pub="pub",EnumUnitObjectType.publicArea="public-area",EnumUnitObjectType.restaurant="restaurant",EnumUnitObjectType.retirementHome="retirement-home",EnumUnitObjectType.salesFloor="sales-floor",EnumUnitObjectType.school="school",EnumUnitObjectType.shelter="shelter",EnumUnitObjectType.storage="storage",EnumUnitObjectType.store="store",EnumUnitObjectType.storeroom="storeroom",EnumUnitObjectType.studio="studio",EnumUnitObjectType.terrace="terrace",EnumUnitObjectType.toilets="toilets",EnumUnitObjectType.utilityRoom="utility-room",EnumUnitObjectType.variableParkingSpace="variable-parking-space",EnumUnitObjectType.variableRoom="variable-room",EnumUnitObjectType.visitorParkingSpace="visitor-parking-space",EnumUnitObjectType.workshop="workshop",exports.EnumUnitType=void 0,EnumUnitType=exports.EnumUnitType||(exports.EnumUnitType={}),EnumUnitType.rented="rented",EnumUnitType.owned="owned",exports.EnumUserRelationType=void 0,EnumUserRelationType=exports.EnumUserRelationType||(exports.EnumUserRelationType={}),EnumUserRelationType.isResponsible="is-responsible";var __rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},EnumUtilisationPeriodType;async function utilisationPeriodCreate(e,t,n){const r=await e.post(`/v1/units/${t}/utilisation-periods`,n),{tenantIDs:i,_embedded:o}=r,s=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},s),{invitations:o.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(o)})}async function utilisationPeriodGetById(e,t){const n=await e.get(`/v1/utilisation-periods/${t}`),{tenantIDs:r,_embedded:i}=n,o=__rest(n,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},o),{invitations:i.invitations.map(remapRegistationCodeResult),tenantIds:r,users:remapEmbeddedUser(i)})}async function utilisationPeriodUpdateById(e,t,n){const r=await e.patch(`/v1/utilisation-periods/${t}`,n),{tenantIDs:i,_embedded:o}=r,s=__rest(r,["tenantIDs","_embedded"]);return Object.assign(Object.assign({},s),{invitations:o.invitations.map(remapRegistationCodeResult),tenantIds:i,users:remapEmbeddedUser(o)})}async function utilisationPeriodDelete(e,t){return!await e.delete(`/v1/utilisation-periods/${t}/soft`)}async function utilisationPeriodCheckInUser(e,t,n){return await e.post(`/v1/utilisation-periods/${t}/users`,{email:n.email})&&e.utilisationPeriodGetById(t)}async function utilisationPeriodCheckOutUser(e,t,n){return""===await e.delete(`/v1/utilisation-periods/${t}/users/${n}`)}async function utilisationPeriodAddRegistrationCode(e,t,n,r,i=!1){return e.post(`/v1/utilisation-periods/${t}/registration-codes`,{code:n,permanent:i,tenant:r})}async function patch(e,t,n,r,i){return e("patch",t,{body:n,headers:i},r)}async function post(e,t,n,r,i){return e("post",t,{body:n,headers:i},r)}async function put(e,t,n,r,i){return e("put",t,{body:n,headers:i},r)}exports.EnumUtilisationPeriodType=void 0,EnumUtilisationPeriodType=exports.EnumUtilisationPeriodType||(exports.EnumUtilisationPeriodType={}),EnumUtilisationPeriodType.tenant="tenant",EnumUtilisationPeriodType.ownership="ownership",EnumUtilisationPeriodType.vacant="vacant";var parser$3={},DLList$2;parser$3.load=function(e,t,n={}){var r,i,o;for(r in t)o=t[r],n[r]=null!=(i=e[r])?i:o;return n},parser$3.overwrite=function(e,t,n={}){var r,i;for(r in e)i=e[r],void 0!==t[r]&&(n[r]=i);return n},DLList$2=class{constructor(e,t){this.incr=e,this.decr=t,this._first=null,this._last=null,this.length=0}push(e){var t;this.length++,"function"==typeof this.incr&&this.incr(),t={value:e,prev:this._last,next:null},null!=this._last?(this._last.next=t,this._last=t):this._first=this._last=t}shift(){var e;if(null!=this._first)return this.length--,"function"==typeof this.decr&&this.decr(),e=this._first.value,null!=(this._first=this._first.next)?this._first.prev=null:this._last=null,e}first(){if(null!=this._first)return this._first.value}getArray(){var e,t,n;for(e=this._first,n=[];null!=e;)n.push((t=e,e=e.next,t.value));return n}forEachShift(e){var t;for(t=this.shift();null!=t;)e(t),t=this.shift()}debug(){var e,t,n,r,i;for(e=this._first,i=[];null!=e;)i.push((t=e,e=e.next,{value:t.value,prev:null!=(n=t.prev)?n.value:void 0,next:null!=(r=t.next)?r.value:void 0}));return i}};var DLList_1=DLList$2,Events$1;function asyncGeneratorStep$4(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$4(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$4(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$4(o,r,i,s,a,"throw",e)}s(void 0)}))}}Events$1=class{constructor(e){if(this.instance=e,this._events={},null!=this.instance.on||null!=this.instance.once||null!=this.instance.removeAllListeners)throw new Error("An Emitter already exists for this object");this.instance.on=(e,t)=>this._addListener(e,"many",t),this.instance.once=(e,t)=>this._addListener(e,"once",t),this.instance.removeAllListeners=(e=null)=>null!=e?delete this._events[e]:this._events={}}_addListener(e,t,n){var r;return null==(r=this._events)[e]&&(r[e]=[]),this._events[e].push({cb:n,status:t}),this.instance}listenerCount(e){return null!=this._events[e]?this._events[e].length:0}trigger(e,...t){var n=this;return _asyncToGenerator$4((function*(){var r,i;try{if("debug"!==e&&n.trigger("debug",`Event triggered: ${e}`,t),null==n._events[e])return;return n._events[e]=n._events[e].filter((function(e){return"none"!==e.status})),i=n._events[e].map(function(){var e=_asyncToGenerator$4((function*(e){var r,i;if("none"!==e.status){"once"===e.status&&(e.status="none");try{return"function"==typeof(null!=(i="function"==typeof e.cb?e.cb(...t):void 0)?i.then:void 0)?yield i:i}catch(e){return r=e,n.trigger("error",r),null}}}));return function(t){return e.apply(this,arguments)}}()),(yield Promise.all(i)).find((function(e){return null!=e}))}catch(e){return r=e,n.trigger("error",r),null}}))()}};var Events_1=Events$1,DLList$1,Events,Queues;DLList$1=DLList_1,Events=Events_1,Queues=class{constructor(e){this.Events=new Events(this),this._length=0,this._lists=function(){var t,n,r;for(r=[],t=1,n=e;1<=n?t<=n:t>=n;1<=n?++t:--t)r.push(new DLList$1((()=>this.incr()),(()=>this.decr())));return r}.call(this)}incr(){if(0==this._length++)return this.Events.trigger("leftzero")}decr(){if(0==--this._length)return this.Events.trigger("zero")}push(e){return this._lists[e.options.priority].push(e)}queued(e){return null!=e?this._lists[e].length:this._length}shiftAll(e){return this._lists.forEach((function(t){return t.forEachShift(e)}))}getFirst(e=this._lists){var t,n,r;for(t=0,n=e.length;t<n;t++)if((r=e[t]).length>0)return r;return[]}shiftLastFrom(e){return this.getFirst(this._lists.slice(e).reverse()).shift()}};var Queues_1=Queues,BottleneckError_1,hasRequiredBottleneckError,BottleneckError$3,DEFAULT_PRIORITY,Job,NUM_PRIORITIES,parser$2;function requireBottleneckError(){return hasRequiredBottleneckError?BottleneckError_1:(hasRequiredBottleneckError=1,e=class extends Error{},BottleneckError_1=e);var e}function asyncGeneratorStep$3(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$3(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$3(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$3(o,r,i,s,a,"throw",e)}s(void 0)}))}}NUM_PRIORITIES=10,DEFAULT_PRIORITY=5,parser$2=parser$3,BottleneckError$3=requireBottleneckError(),Job=class{constructor(e,t,n,r,i,o,s,a){this.task=e,this.args=t,this.rejectOnDrop=i,this.Events=o,this._states=s,this.Promise=a,this.options=parser$2.load(n,r),this.options.priority=this._sanitizePriority(this.options.priority),this.options.id===r.id&&(this.options.id=`${this.options.id}-${this._randomIndex()}`),this.promise=new this.Promise(((e,t)=>{this._resolve=e,this._reject=t})),this.retryCount=0}_sanitizePriority(e){var t;return(t=~~e!==e?DEFAULT_PRIORITY:e)<0?0:t>NUM_PRIORITIES-1?NUM_PRIORITIES-1:t}_randomIndex(){return Math.random().toString(36).slice(2)}doDrop({error:e,message:t="This job has been dropped by Bottleneck"}={}){return!!this._states.remove(this.options.id)&&(this.rejectOnDrop&&this._reject(null!=e?e:new BottleneckError$3(t)),this.Events.trigger("dropped",{args:this.args,options:this.options,task:this.task,promise:this.promise}),!0)}_assertStatus(e){var t;if((t=this._states.jobStatus(this.options.id))!==e&&("DONE"!==e||null!==t))throw new BottleneckError$3(`Invalid job status ${t}, expected ${e}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`)}doReceive(){return this._states.start(this.options.id),this.Events.trigger("received",{args:this.args,options:this.options})}doQueue(e,t){return this._assertStatus("RECEIVED"),this._states.next(this.options.id),this.Events.trigger("queued",{args:this.args,options:this.options,reachedHWM:e,blocked:t})}doRun(){return 0===this.retryCount?(this._assertStatus("QUEUED"),this._states.next(this.options.id)):this._assertStatus("EXECUTING"),this.Events.trigger("scheduled",{args:this.args,options:this.options})}doExecute(e,t,n,r){var i=this;return _asyncToGenerator$3((function*(){var o,s,a;0===i.retryCount?(i._assertStatus("RUNNING"),i._states.next(i.options.id)):i._assertStatus("EXECUTING"),s={args:i.args,options:i.options,retryCount:i.retryCount},i.Events.trigger("executing",s);try{if(a=yield null!=e?e.schedule(i.options,i.task,...i.args):i.task(...i.args),t())return i.doDone(s),yield r(i.options,s),i._assertStatus("DONE"),i._resolve(a)}catch(e){return o=e,i._onFailure(o,s,t,n,r)}}))()}doExpire(e,t,n){var r,i;return this._states.jobStatus("RUNNING"===this.options.id)&&this._states.next(this.options.id),this._assertStatus("EXECUTING"),i={args:this.args,options:this.options,retryCount:this.retryCount},r=new BottleneckError$3(`This job timed out after ${this.options.expiration} ms.`),this._onFailure(r,i,e,t,n)}_onFailure(e,t,n,r,i){var o=this;return _asyncToGenerator$3((function*(){var s,a;if(n())return null!=(s=yield o.Events.trigger("failed",e,t))?(a=~~s,o.Events.trigger("retry",`Retrying ${o.options.id} after ${a} ms`,t),o.retryCount++,r(a)):(o.doDone(t),yield i(o.options,t),o._assertStatus("DONE"),o._reject(e))}))()}doDone(e){return this._assertStatus("EXECUTING"),this._states.next(this.options.id),this.Events.trigger("done",e)}};var Job_1=Job,BottleneckError$2,LocalDatastore,parser$1;function asyncGeneratorStep$2(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$2(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$2(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$2(o,r,i,s,a,"throw",e)}s(void 0)}))}}parser$1=parser$3,BottleneckError$2=requireBottleneckError(),LocalDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.clientId=this.instance._randomIndex(),parser$1.load(n,n,this),this._nextRequest=this._lastReservoirRefresh=this._lastReservoirIncrease=Date.now(),this._running=0,this._done=0,this._unblockTime=0,this.ready=this.Promise.resolve(),this.clients={},this._startHeartbeat()}_startHeartbeat(){var e;return null==this.heartbeat&&(null!=this.storeOptions.reservoirRefreshInterval&&null!=this.storeOptions.reservoirRefreshAmount||null!=this.storeOptions.reservoirIncreaseInterval&&null!=this.storeOptions.reservoirIncreaseAmount)?"function"==typeof(e=this.heartbeat=setInterval((()=>{var e,t,n,r,i;if(r=Date.now(),null!=this.storeOptions.reservoirRefreshInterval&&r>=this._lastReservoirRefresh+this.storeOptions.reservoirRefreshInterval&&(this._lastReservoirRefresh=r,this.storeOptions.reservoir=this.storeOptions.reservoirRefreshAmount,this.instance._drainAll(this.computeCapacity())),null!=this.storeOptions.reservoirIncreaseInterval&&r>=this._lastReservoirIncrease+this.storeOptions.reservoirIncreaseInterval){var o=this.storeOptions;if(e=o.reservoirIncreaseAmount,n=o.reservoirIncreaseMaximum,i=o.reservoir,this._lastReservoirIncrease=r,(t=null!=n?Math.min(e,n-i):e)>0)return this.storeOptions.reservoir+=t,this.instance._drainAll(this.computeCapacity())}}),this.heartbeatInterval)).unref?e.unref():void 0:clearInterval(this.heartbeat)}__publish__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t.instance.Events.trigger("message",e.toString())}))()}__disconnect__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),clearInterval(t.heartbeat),t.Promise.resolve()}))()}yieldLoop(e=0){return new this.Promise((function(t,n){return setTimeout(t,e)}))}computePenalty(){var e;return null!=(e=this.storeOptions.penalty)?e:15*this.storeOptions.minTime||5e3}__updateSettings__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),parser$1.overwrite(e,e,t.storeOptions),t._startHeartbeat(),t.instance._drainAll(t.computeCapacity()),!0}))()}__running__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._running}))()}__queued__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.instance.queued()}))()}__done__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e._done}))()}__groupCheck__(e){var t=this;return _asyncToGenerator$2((function*(){return yield t.yieldLoop(),t._nextRequest+t.timeout<e}))()}computeCapacity(){var e,t,n=this.storeOptions;return e=n.maxConcurrent,t=n.reservoir,null!=e&&null!=t?Math.min(e-this._running,t):null!=e?e-this._running:null!=t?t:null}conditionsCheck(e){var t;return null==(t=this.computeCapacity())||e<=t}__incrementReservoir__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=t.storeOptions.reservoir+=e,t.instance._drainAll(t.computeCapacity()),n}))()}__currentReservoir__(){var e=this;return _asyncToGenerator$2((function*(){return yield e.yieldLoop(),e.storeOptions.reservoir}))()}isBlocked(e){return this._unblockTime>=e}check(e,t){return this.conditionsCheck(e)&&this._nextRequest-t<=0}__check__(e){var t=this;return _asyncToGenerator$2((function*(){var n;return yield t.yieldLoop(),n=Date.now(),t.check(e,n)}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$2((function*(){var e,n;return yield r.yieldLoop(),e=Date.now(),r.conditionsCheck(t)?(r._running+=t,null!=r.storeOptions.reservoir&&(r.storeOptions.reservoir-=t),n=Math.max(r._nextRequest-e,0),r._nextRequest=e+n+r.storeOptions.minTime,{success:!0,wait:n,reservoir:r.storeOptions.reservoir}):{success:!1}}))()}strategyIsBlock(){return 3===this.storeOptions.strategy}__submit__(e,t){var n=this;return _asyncToGenerator$2((function*(){var r,i,o;if(yield n.yieldLoop(),null!=n.storeOptions.maxConcurrent&&t>n.storeOptions.maxConcurrent)throw new BottleneckError$2(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${n.storeOptions.maxConcurrent}`);return i=Date.now(),o=null!=n.storeOptions.highWater&&e===n.storeOptions.highWater&&!n.check(t,i),(r=n.strategyIsBlock()&&(o||n.isBlocked(i)))&&(n._unblockTime=i+n.computePenalty(),n._nextRequest=n._unblockTime+n.storeOptions.minTime,n.instance._dropAllQueued()),{reachedHWM:o,blocked:r,strategy:n.storeOptions.strategy}}))()}__free__(e,t){var n=this;return _asyncToGenerator$2((function*(){return yield n.yieldLoop(),n._running-=t,n._done+=t,n.instance._drainAll(n.computeCapacity()),{running:n._running}}))()}};var LocalDatastore_1=LocalDatastore,Scripts={},require$$0={"blacklist_client.lua":"local blacklist = ARGV[num_static_argv + 1]\n\nif redis.call('zscore', client_last_seen_key, blacklist) then\n redis.call('zadd', client_last_seen_key, 0, blacklist)\nend\n\n\nreturn {}\n","check.lua":"local weight = tonumber(ARGV[num_static_argv + 1])\n\nlocal capacity = process_tick(now, false)['capacity']\nlocal nextRequest = tonumber(redis.call('hget', settings_key, 'nextRequest'))\n\nreturn conditions_check(capacity, weight) and nextRequest - now <= 0\n","conditions_check.lua":"local conditions_check = function (capacity, weight)\n return capacity == nil or weight <= capacity\nend\n","current_reservoir.lua":"return process_tick(now, false)['reservoir']\n","done.lua":"process_tick(now, false)\n\nreturn tonumber(redis.call('hget', settings_key, 'done'))\n","free.lua":"local index = ARGV[num_static_argv + 1]\n\nredis.call('zadd', job_expirations_key, 0, index)\n\nreturn process_tick(now, false)['running']\n","get_time.lua":"redis.replicate_commands()\n\nlocal get_time = function ()\n local time = redis.call('time')\n\n return tonumber(time[1]..string.sub(time[2], 1, 3))\nend\n","group_check.lua":"return not (redis.call('exists', settings_key) == 1)\n","heartbeat.lua":"process_tick(now, true)\n","increment_reservoir.lua":"local incr = tonumber(ARGV[num_static_argv + 1])\n\nredis.call('hincrby', settings_key, 'reservoir', incr)\n\nlocal reservoir = process_tick(now, true)['reservoir']\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn reservoir\n","init.lua":"local clear = tonumber(ARGV[num_static_argv + 1])\nlocal limiter_version = ARGV[num_static_argv + 2]\nlocal num_local_argv = num_static_argv + 2\n\nif clear == 1 then\n redis.call('del', unpack(KEYS))\nend\n\nif redis.call('exists', settings_key) == 0 then\n -- Create\n local args = {'hmset', settings_key}\n\n for i = num_local_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\n end\n\n redis.call(unpack(args))\n redis.call('hmset', settings_key,\n 'nextRequest', now,\n 'lastReservoirRefresh', now,\n 'lastReservoirIncrease', now,\n 'running', 0,\n 'done', 0,\n 'unblockTime', 0,\n 'capacityPriorityCounter', 0\n )\n\nelse\n -- Apply migrations\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'version'\n )\n local id = settings[1]\n local current_version = settings[2]\n\n if current_version ~= limiter_version then\n local version_digits = {}\n for k, v in string.gmatch(current_version, \"([^.]+)\") do\n table.insert(version_digits, tonumber(k))\n end\n\n -- 2.10.0\n if version_digits[2] < 10 then\n redis.call('hsetnx', settings_key, 'reservoirRefreshInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirRefreshAmount', '')\n redis.call('hsetnx', settings_key, 'lastReservoirRefresh', '')\n redis.call('hsetnx', settings_key, 'done', 0)\n redis.call('hset', settings_key, 'version', '2.10.0')\n end\n\n -- 2.11.1\n if version_digits[2] < 11 or (version_digits[2] == 11 and version_digits[3] < 1) then\n if redis.call('hstrlen', settings_key, 'lastReservoirRefresh') == 0 then\n redis.call('hmset', settings_key,\n 'lastReservoirRefresh', now,\n 'version', '2.11.1'\n )\n end\n end\n\n -- 2.14.0\n if version_digits[2] < 14 then\n local old_running_key = 'b_'..id..'_running'\n local old_executing_key = 'b_'..id..'_executing'\n\n if redis.call('exists', old_running_key) == 1 then\n redis.call('rename', old_running_key, job_weights_key)\n end\n if redis.call('exists', old_executing_key) == 1 then\n redis.call('rename', old_executing_key, job_expirations_key)\n end\n redis.call('hset', settings_key, 'version', '2.14.0')\n end\n\n -- 2.15.2\n if version_digits[2] < 15 or (version_digits[2] == 15 and version_digits[3] < 2) then\n redis.call('hsetnx', settings_key, 'capacityPriorityCounter', 0)\n redis.call('hset', settings_key, 'version', '2.15.2')\n end\n\n -- 2.17.0\n if version_digits[2] < 17 then\n redis.call('hsetnx', settings_key, 'clientTimeout', 10000)\n redis.call('hset', settings_key, 'version', '2.17.0')\n end\n\n -- 2.18.0\n if version_digits[2] < 18 then\n redis.call('hsetnx', settings_key, 'reservoirIncreaseInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseAmount', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseMaximum', '')\n redis.call('hsetnx', settings_key, 'lastReservoirIncrease', now)\n redis.call('hset', settings_key, 'version', '2.18.0')\n end\n\n end\n\n process_tick(now, false)\nend\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","process_tick.lua":"local process_tick = function (now, always_publish)\n\n local compute_capacity = function (maxConcurrent, running, reservoir)\n if maxConcurrent ~= nil and reservoir ~= nil then\n return math.min((maxConcurrent - running), reservoir)\n elseif maxConcurrent ~= nil then\n return maxConcurrent - running\n elseif reservoir ~= nil then\n return reservoir\n else\n return nil\n end\n end\n\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'running',\n 'reservoir',\n 'reservoirRefreshInterval',\n 'reservoirRefreshAmount',\n 'lastReservoirRefresh',\n 'reservoirIncreaseInterval',\n 'reservoirIncreaseAmount',\n 'reservoirIncreaseMaximum',\n 'lastReservoirIncrease',\n 'capacityPriorityCounter',\n 'clientTimeout'\n )\n local id = settings[1]\n local maxConcurrent = tonumber(settings[2])\n local running = tonumber(settings[3])\n local reservoir = tonumber(settings[4])\n local reservoirRefreshInterval = tonumber(settings[5])\n local reservoirRefreshAmount = tonumber(settings[6])\n local lastReservoirRefresh = tonumber(settings[7])\n local reservoirIncreaseInterval = tonumber(settings[8])\n local reservoirIncreaseAmount = tonumber(settings[9])\n local reservoirIncreaseMaximum = tonumber(settings[10])\n local lastReservoirIncrease = tonumber(settings[11])\n local capacityPriorityCounter = tonumber(settings[12])\n local clientTimeout = tonumber(settings[13])\n\n local initial_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n --\n -- Process 'running' changes\n --\n local expired = redis.call('zrangebyscore', job_expirations_key, '-inf', '('..now)\n\n if #expired > 0 then\n redis.call('zremrangebyscore', job_expirations_key, '-inf', '('..now)\n\n local flush_batch = function (batch, acc)\n local weights = redis.call('hmget', job_weights_key, unpack(batch))\n redis.call('hdel', job_weights_key, unpack(batch))\n local clients = redis.call('hmget', job_clients_key, unpack(batch))\n redis.call('hdel', job_clients_key, unpack(batch))\n\n -- Calculate sum of removed weights\n for i = 1, #weights do\n acc['total'] = acc['total'] + (tonumber(weights[i]) or 0)\n end\n\n -- Calculate sum of removed weights by client\n local client_weights = {}\n for i = 1, #clients do\n local removed = tonumber(weights[i]) or 0\n if removed > 0 then\n acc['client_weights'][clients[i]] = (acc['client_weights'][clients[i]] or 0) + removed\n end\n end\n end\n\n local acc = {\n ['total'] = 0,\n ['client_weights'] = {}\n }\n local batch_size = 1000\n\n -- Compute changes to Zsets and apply changes to Hashes\n for i = 1, #expired, batch_size do\n local batch = {}\n for j = i, math.min(i + batch_size - 1, #expired) do\n table.insert(batch, expired[j])\n end\n\n flush_batch(batch, acc)\n end\n\n -- Apply changes to Zsets\n if acc['total'] > 0 then\n redis.call('hincrby', settings_key, 'done', acc['total'])\n running = tonumber(redis.call('hincrby', settings_key, 'running', -acc['total']))\n end\n\n for client, weight in pairs(acc['client_weights']) do\n redis.call('zincrby', client_running_key, -weight, client)\n end\n end\n\n --\n -- Process 'reservoir' changes\n --\n local reservoirRefreshActive = reservoirRefreshInterval ~= nil and reservoirRefreshAmount ~= nil\n if reservoirRefreshActive and now >= lastReservoirRefresh + reservoirRefreshInterval then\n reservoir = reservoirRefreshAmount\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirRefresh', now\n )\n end\n\n local reservoirIncreaseActive = reservoirIncreaseInterval ~= nil and reservoirIncreaseAmount ~= nil\n if reservoirIncreaseActive and now >= lastReservoirIncrease + reservoirIncreaseInterval then\n local num_intervals = math.floor((now - lastReservoirIncrease) / reservoirIncreaseInterval)\n local incr = reservoirIncreaseAmount * num_intervals\n if reservoirIncreaseMaximum ~= nil then\n incr = math.min(incr, reservoirIncreaseMaximum - (reservoir or 0))\n end\n if incr > 0 then\n reservoir = (reservoir or 0) + incr\n end\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirIncrease', lastReservoirIncrease + (num_intervals * reservoirIncreaseInterval)\n )\n end\n\n --\n -- Clear unresponsive clients\n --\n local unresponsive = redis.call('zrangebyscore', client_last_seen_key, '-inf', (now - clientTimeout))\n local unresponsive_lookup = {}\n local terminated_clients = {}\n for i = 1, #unresponsive do\n unresponsive_lookup[unresponsive[i]] = true\n if tonumber(redis.call('zscore', client_running_key, unresponsive[i])) == 0 then\n table.insert(terminated_clients, unresponsive[i])\n end\n end\n if #terminated_clients > 0 then\n redis.call('zrem', client_running_key, unpack(terminated_clients))\n redis.call('hdel', client_num_queued_key, unpack(terminated_clients))\n redis.call('zrem', client_last_registered_key, unpack(terminated_clients))\n redis.call('zrem', client_last_seen_key, unpack(terminated_clients))\n end\n\n --\n -- Broadcast capacity changes\n --\n local final_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n if always_publish or (initial_capacity ~= nil and final_capacity == nil) then\n -- always_publish or was not unlimited, now unlimited\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n\n elseif initial_capacity ~= nil and final_capacity ~= nil and final_capacity > initial_capacity then\n -- capacity was increased\n -- send the capacity message to the limiter having the lowest number of running jobs\n -- the tiebreaker is the limiter having not registered a job in the longest time\n\n local lowest_concurrency_value = nil\n local lowest_concurrency_clients = {}\n local lowest_concurrency_last_registered = {}\n local client_concurrencies = redis.call('zrange', client_running_key, 0, -1, 'withscores')\n\n for i = 1, #client_concurrencies, 2 do\n local client = client_concurrencies[i]\n local concurrency = tonumber(client_concurrencies[i+1])\n\n if (\n lowest_concurrency_value == nil or lowest_concurrency_value == concurrency\n ) and (\n not unresponsive_lookup[client]\n ) and (\n tonumber(redis.call('hget', client_num_queued_key, client)) > 0\n ) then\n lowest_concurrency_value = concurrency\n table.insert(lowest_concurrency_clients, client)\n local last_registered = tonumber(redis.call('zscore', client_last_registered_key, client))\n table.insert(lowest_concurrency_last_registered, last_registered)\n end\n end\n\n if #lowest_concurrency_clients > 0 then\n local position = 1\n local earliest = lowest_concurrency_last_registered[1]\n\n for i,v in ipairs(lowest_concurrency_last_registered) do\n if v < earliest then\n position = i\n earliest = v\n end\n end\n\n local next_client = lowest_concurrency_clients[position]\n redis.call('publish', 'b_'..id,\n 'capacity-priority:'..(final_capacity or '')..\n ':'..next_client..\n ':'..capacityPriorityCounter\n )\n redis.call('hincrby', settings_key, 'capacityPriorityCounter', '1')\n else\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n end\n end\n\n return {\n ['capacity'] = final_capacity,\n ['running'] = running,\n ['reservoir'] = reservoir\n }\nend\n","queued.lua":"local clientTimeout = tonumber(redis.call('hget', settings_key, 'clientTimeout'))\nlocal valid_clients = redis.call('zrangebyscore', client_last_seen_key, (now - clientTimeout), 'inf')\nlocal client_queued = redis.call('hmget', client_num_queued_key, unpack(valid_clients))\n\nlocal sum = 0\nfor i = 1, #client_queued do\n sum = sum + tonumber(client_queued[i])\nend\n\nreturn sum\n","refresh_expiration.lua":"local refresh_expiration = function (now, nextRequest, groupTimeout)\n\n if groupTimeout ~= nil then\n local ttl = (nextRequest + groupTimeout) - now\n\n for i = 1, #KEYS do\n redis.call('pexpire', KEYS[i], ttl)\n end\n end\n\nend\n","refs.lua":"local settings_key = KEYS[1]\nlocal job_weights_key = KEYS[2]\nlocal job_expirations_key = KEYS[3]\nlocal job_clients_key = KEYS[4]\nlocal client_running_key = KEYS[5]\nlocal client_num_queued_key = KEYS[6]\nlocal client_last_registered_key = KEYS[7]\nlocal client_last_seen_key = KEYS[8]\n\nlocal now = tonumber(ARGV[1])\nlocal client = ARGV[2]\n\nlocal num_static_argv = 2\n","register.lua":"local index = ARGV[num_static_argv + 1]\nlocal weight = tonumber(ARGV[num_static_argv + 2])\nlocal expiration = tonumber(ARGV[num_static_argv + 3])\n\nlocal state = process_tick(now, false)\nlocal capacity = state['capacity']\nlocal reservoir = state['reservoir']\n\nlocal settings = redis.call('hmget', settings_key,\n 'nextRequest',\n 'minTime',\n 'groupTimeout'\n)\nlocal nextRequest = tonumber(settings[1])\nlocal minTime = tonumber(settings[2])\nlocal groupTimeout = tonumber(settings[3])\n\nif conditions_check(capacity, weight) then\n\n redis.call('hincrby', settings_key, 'running', weight)\n redis.call('hset', job_weights_key, index, weight)\n if expiration ~= nil then\n redis.call('zadd', job_expirations_key, now + expiration, index)\n end\n redis.call('hset', job_clients_key, index, client)\n redis.call('zincrby', client_running_key, weight, client)\n redis.call('hincrby', client_num_queued_key, client, -1)\n redis.call('zadd', client_last_registered_key, now, client)\n\n local wait = math.max(nextRequest - now, 0)\n local newNextRequest = now + wait + minTime\n\n if reservoir == nil then\n redis.call('hset', settings_key,\n 'nextRequest', newNextRequest\n )\n else\n reservoir = reservoir - weight\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'nextRequest', newNextRequest\n )\n end\n\n refresh_expiration(now, newNextRequest, groupTimeout)\n\n return {true, wait, reservoir}\n\nelse\n return {false}\nend\n","register_client.lua":"local queued = tonumber(ARGV[num_static_argv + 1])\n\n-- Could have been re-registered concurrently\nif not redis.call('zscore', client_last_seen_key, client) then\n redis.call('zadd', client_running_key, 0, client)\n redis.call('hset', client_num_queued_key, client, queued)\n redis.call('zadd', client_last_registered_key, 0, client)\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n\nreturn {}\n","running.lua":"return process_tick(now, false)['running']\n","submit.lua":"local queueLength = tonumber(ARGV[num_static_argv + 1])\nlocal weight = tonumber(ARGV[num_static_argv + 2])\n\nlocal capacity = process_tick(now, false)['capacity']\n\nlocal settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'highWater',\n 'nextRequest',\n 'strategy',\n 'unblockTime',\n 'penalty',\n 'minTime',\n 'groupTimeout'\n)\nlocal id = settings[1]\nlocal maxConcurrent = tonumber(settings[2])\nlocal highWater = tonumber(settings[3])\nlocal nextRequest = tonumber(settings[4])\nlocal strategy = tonumber(settings[5])\nlocal unblockTime = tonumber(settings[6])\nlocal penalty = tonumber(settings[7])\nlocal minTime = tonumber(settings[8])\nlocal groupTimeout = tonumber(settings[9])\n\nif maxConcurrent ~= nil and weight > maxConcurrent then\n return redis.error_reply('OVERWEIGHT:'..weight..':'..maxConcurrent)\nend\n\nlocal reachedHWM = (highWater ~= nil and queueLength == highWater\n and not (\n conditions_check(capacity, weight)\n and nextRequest - now <= 0\n )\n)\n\nlocal blocked = strategy == 3 and (reachedHWM or unblockTime >= now)\n\nif blocked then\n local computedPenalty = penalty\n if computedPenalty == nil then\n if minTime == 0 then\n computedPenalty = 5000\n else\n computedPenalty = 15 * minTime\n end\n end\n\n local newNextRequest = now + computedPenalty + minTime\n\n redis.call('hmset', settings_key,\n 'unblockTime', now + computedPenalty,\n 'nextRequest', newNextRequest\n )\n\n local clients_queued_reset = redis.call('hkeys', client_num_queued_key)\n local queued_reset = {}\n for i = 1, #clients_queued_reset do\n table.insert(queued_reset, clients_queued_reset[i])\n table.insert(queued_reset, 0)\n end\n redis.call('hmset', client_num_queued_key, unpack(queued_reset))\n\n redis.call('publish', 'b_'..id, 'blocked:')\n\n refresh_expiration(now, newNextRequest, groupTimeout)\nend\n\nif not blocked and not reachedHWM then\n redis.call('hincrby', client_num_queued_key, client, 1)\nend\n\nreturn {reachedHWM, blocked, strategy}\n","update_settings.lua":"local args = {'hmset', settings_key}\n\nfor i = num_static_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\nend\n\nredis.call(unpack(args))\n\nprocess_tick(now, true)\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","validate_client.lua":"if not redis.call('zscore', client_last_seen_key, client) then\n return redis.error_reply('UNKNOWN_CLIENT')\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n","validate_keys.lua":"if not (redis.call('exists', settings_key) == 1) then\n return redis.error_reply('SETTINGS_KEY_NOT_FOUND')\nend\n"},hasRequiredScripts,RedisConnection_1,hasRequiredRedisConnection,IORedisConnection_1,hasRequiredIORedisConnection,BottleneckError$1,IORedisConnection,RedisConnection,RedisDatastore,parser;function requireScripts(){return hasRequiredScripts||(hasRequiredScripts=1,function(e){var t,n,r;t={refs:(n=require$$0)["refs.lua"],validate_keys:n["validate_keys.lua"],validate_client:n["validate_client.lua"],refresh_expiration:n["refresh_expiration.lua"],process_tick:n["process_tick.lua"],conditions_check:n["conditions_check.lua"],get_time:n["get_time.lua"]},e.allKeys=function(e){return[`b_${e}_settings`,`b_${e}_job_weights`,`b_${e}_job_expirations`,`b_${e}_job_clients`,`b_${e}_client_running`,`b_${e}_client_num_queued`,`b_${e}_client_last_registered`,`b_${e}_client_last_seen`]},r={init:{keys:e.allKeys,headers:["process_tick"],refresh_expiration:!0,code:n["init.lua"]},group_check:{keys:e.allKeys,headers:[],refresh_expiration:!1,code:n["group_check.lua"]},register_client:{keys:e.allKeys,headers:["validate_keys"],refresh_expiration:!1,code:n["register_client.lua"]},blacklist_client:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["blacklist_client.lua"]},heartbeat:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["heartbeat.lua"]},update_settings:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["update_settings.lua"]},running:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["running.lua"]},queued:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["queued.lua"]},done:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["done.lua"]},check:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!1,code:n["check.lua"]},submit:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["submit.lua"]},register:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["register.lua"]},free:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["free.lua"]},current_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["current_reservoir.lua"]},increment_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["increment_reservoir.lua"]}},e.names=Object.keys(r),e.keys=function(e,t){return r[e].keys(t)},e.payload=function(e){var n;return n=r[e],Array.prototype.concat(t.refs,n.headers.map((function(e){return t[e]})),n.refresh_expiration?t.refresh_expiration:"",n.code).join("\n")}}(Scripts)),Scripts}function requireRedisConnection(){if(hasRequiredRedisConnection)return RedisConnection_1;function asyncGeneratorStep(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep(o,r,i,s,a,"throw",e)}s(void 0)}))}}var Events,RedisConnection,Scripts,parser;return hasRequiredRedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),RedisConnection=function(){class RedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("redis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null==this.client&&(this.client=this.Redis.createClient(this.clientOptions)),this.subscriber=this.client.duplicate(),this.limiters={},this.shas={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>this._loadScripts())).then((()=>({client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),e.ready?n():e.once("ready",n))))}_loadScript(e){return new this.Promise(((t,n)=>{var r;return r=Scripts.payload(e),this.client.multi([["script","load",r]]).exec(((r,i)=>null!=r?n(r):(this.shas[e]=i[0],t(i[0]))))}))}_loadScripts(){return this.Promise.all(Scripts.names.map((e=>this._loadScript(e))))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){return yield t.ready,new t.Promise(((n,r)=>t.client.multi([e]).exec_atomic((function(e,t){return null!=e?r(e):n(t[0])}))))}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>{var i;return i=r=>{if(r===t)return this.subscriber.removeListener("subscribe",i),this.limiters[t]=e,n()},this.subscriber.on("subscribe",i),this.subscriber.subscribe(t)})))))}__removeLimiter__(e){var t=this;return this.Promise.all([e.channel(),e.channel_client()].map(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield new t.Promise(((n,r)=>t.subscriber.unsubscribe(e,(function(t,i){return null!=t?r(t):i===e?n():void 0}))))),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}()))}__scriptArgs__(e,t,n,r){var i;return i=Scripts.keys(e,t),[this.shas[e],i.length].concat(i,n,r)}__scriptFn__(e){return this.client.evalsha.bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,this.client.end(e),this.subscriber.end(e),this.Promise.resolve()}}return RedisConnection.prototype.datastore="redis",RedisConnection.prototype.defaults={Redis:null,clientOptions:{},client:null,Promise:Promise,Events:null},RedisConnection}.call(void 0),RedisConnection_1=RedisConnection,RedisConnection_1}function requireIORedisConnection(){if(hasRequiredIORedisConnection)return IORedisConnection_1;function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep(o,r,i,s,a,"throw",e)}s(void 0)}))}}var Events,IORedisConnection,Scripts,parser;return hasRequiredIORedisConnection=1,parser=parser$3,Events=Events_1,Scripts=requireScripts(),IORedisConnection=function(){class IORedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("ioredis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null!=this.clusterNodes?(this.client=new this.Redis.Cluster(this.clusterNodes,this.clientOptions),this.subscriber=new this.Redis.Cluster(this.clusterNodes,this.clientOptions)):null!=this.client&&null==this.client.duplicate?this.subscriber=new this.Redis.Cluster(this.client.startupNodes,this.client.options):(null==this.client&&(this.client=new this.Redis(this.clientOptions)),this.subscriber=this.client.duplicate()),this.limiters={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then((()=>(this._loadScripts(),{client:this.client,subscriber:this.subscriber})))}_setup(e,t){return e.setMaxListeners(0),new this.Promise(((n,r)=>(e.on("error",(e=>this.Events.trigger("error",e))),t&&e.on("message",((e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0})),"ready"===e.status?n():e.once("ready",n))))}_loadScripts(){return Scripts.names.forEach((e=>this.client.defineCommand(e,{lua:Scripts.payload(e)})))}__runCommand__(e){var t=this;return _asyncToGenerator((function*(){yield t.ready;var n=_slicedToArray(yield t.client.pipeline([e]).exec(),1),r=_slicedToArray(n[0],2);return r[0],r[1]}))()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map((t=>new this.Promise(((n,r)=>this.subscriber.subscribe(t,(()=>(this.limiters[t]=e,n()))))))))}__removeLimiter__(e){var t=this;return[e.channel(),e.channel_client()].forEach(function(){var e=_asyncToGenerator((function*(e){return t.terminated||(yield t.subscriber.unsubscribe(e)),delete t.limiters[e]}));return function(t){return e.apply(this,arguments)}}())}__scriptArgs__(e,t,n,r){var i;return[(i=Scripts.keys(e,t)).length].concat(i,n,r)}__scriptFn__(e){return this.client[e].bind(this.client)}disconnect(e=!0){var t,n,r,i;for(t=0,r=(i=Object.keys(this.limiters)).length;t<r;t++)n=i[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,e?this.Promise.all([this.client.quit(),this.subscriber.quit()]):(this.client.disconnect(),this.subscriber.disconnect(),this.Promise.resolve())}}return IORedisConnection.prototype.datastore="ioredis",IORedisConnection.prototype.defaults={Redis:null,clientOptions:{},clusterNodes:null,client:null,Promise:Promise,Events:null},IORedisConnection}.call(void 0),IORedisConnection_1=IORedisConnection,IORedisConnection_1}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep$1(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator$1(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep$1(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep$1(o,r,i,s,a,"throw",e)}s(void 0)}))}}parser=parser$3,BottleneckError$1=requireBottleneckError(),RedisConnection=requireRedisConnection(),IORedisConnection=requireIORedisConnection(),RedisDatastore=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.originalId=this.instance.id,this.clientId=this.instance._randomIndex(),parser.load(n,n,this),this.clients={},this.capacityPriorityCounters={},this.sharedConnection=null!=this.connection,null==this.connection&&(this.connection="redis"===this.instance.datastore?new RedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,Promise:this.Promise,Events:this.instance.Events}):"ioredis"===this.instance.datastore?new IORedisConnection({Redis:this.Redis,clientOptions:this.clientOptions,clusterNodes:this.clusterNodes,Promise:this.Promise,Events:this.instance.Events}):void 0),this.instance.connection=this.connection,this.instance.datastore=this.connection.datastore,this.ready=this.connection.ready.then((e=>(this.clients=e,this.runScript("init",this.prepareInitSettings(this.clearDatastore))))).then((()=>this.connection.__addLimiter__(this.instance))).then((()=>this.runScript("register_client",[this.instance.queued()]))).then((()=>{var e;return"function"==typeof(e=this.heartbeat=setInterval((()=>this.runScript("heartbeat",[]).catch((e=>this.instance.Events.trigger("error",e)))),this.heartbeatInterval)).unref&&e.unref(),this.clients}))}__publish__(e){var t=this;return _asyncToGenerator$1((function*(){return(yield t.ready).client.publish(t.instance.channel(),`message:${e.toString()}`)}))()}onMessage(e,t){var n=this;return _asyncToGenerator$1((function*(){var e,r,i,o,s,a,c,u,l,d;try{c=t.indexOf(":");var p=[t.slice(0,c),t.slice(c+1)];if(i=p[1],"capacity"===(d=p[0]))return yield n.instance._drainAll(i.length>0?~~i:void 0);if("capacity-priority"===d){var m=_slicedToArray(i.split(":"),3);return l=m[0],u=m[1],r=m[2],e=l.length>0?~~l:void 0,u===n.clientId?(o=yield n.instance._drainAll(e),a=null!=e?e-(o||0):"",yield n.clients.client.publish(n.instance.channel(),`capacity-priority:${a}::${r}`)):""===u?(clearTimeout(n.capacityPriorityCounters[r]),delete n.capacityPriorityCounters[r],n.instance._drainAll(e)):n.capacityPriorityCounters[r]=setTimeout(_asyncToGenerator$1((function*(){var t;try{return delete n.capacityPriorityCounters[r],yield n.runScript("blacklist_client",[u]),yield n.instance._drainAll(e)}catch(e){return t=e,n.instance.Events.trigger("error",t)}})),1e3)}if("message"===d)return n.instance.Events.trigger("message",i);if("blocked"===d)return yield n.instance._dropAllQueued()}catch(e){return s=e,n.instance.Events.trigger("error",s)}}))()}__disconnect__(e){return clearInterval(this.heartbeat),this.sharedConnection?this.connection.__removeLimiter__(this.instance):this.connection.disconnect(e)}runScript(e,t){var n=this;return _asyncToGenerator$1((function*(){return"init"!==e&&"register_client"!==e&&(yield n.ready),new n.Promise(((r,i)=>{var o,s;return o=[Date.now(),n.clientId].concat(t),n.instance.Events.trigger("debug",`Calling Redis script: ${e}.lua`,o),s=n.connection.__scriptArgs__(e,n.originalId,o,(function(e,t){return null!=e?i(e):r(t)})),n.connection.__scriptFn__(e)(...s)})).catch((r=>"SETTINGS_KEY_NOT_FOUND"===r.message?"heartbeat"===e?n.Promise.resolve():n.runScript("init",n.prepareInitSettings(!1)).then((()=>n.runScript(e,t))):"UNKNOWN_CLIENT"===r.message?n.runScript("register_client",[n.instance.queued()]).then((()=>n.runScript(e,t))):n.Promise.reject(r)))}))()}prepareArray(e){var t,n,r,i;for(r=[],t=0,n=e.length;t<n;t++)i=e[t],r.push(null!=i?i.toString():"");return r}prepareObject(e){var t,n,r;for(n in t=[],e)r=e[n],t.push(n,null!=r?r.toString():"");return t}prepareInitSettings(e){var t;return(t=this.prepareObject(Object.assign({},this.storeOptions,{id:this.originalId,version:this.instance.version,groupTimeout:this.timeout,clientTimeout:this.clientTimeout}))).unshift(e?1:0,this.instance.version),t}convertBool(e){return!!e}__updateSettings__(e){var t=this;return _asyncToGenerator$1((function*(){return yield t.runScript("update_settings",t.prepareObject(e)),parser.overwrite(e,e,t.storeOptions)}))()}__running__(){return this.runScript("running",[])}__queued__(){return this.runScript("queued",[])}__done__(){return this.runScript("done",[])}__groupCheck__(){var e=this;return _asyncToGenerator$1((function*(){return e.convertBool(yield e.runScript("group_check",[]))}))()}__incrementReservoir__(e){return this.runScript("increment_reservoir",[e])}__currentReservoir__(){return this.runScript("current_reservoir",[])}__check__(e){var t=this;return _asyncToGenerator$1((function*(){return t.convertBool(yield t.runScript("check",t.prepareArray([e])))}))()}__register__(e,t,n){var r=this;return _asyncToGenerator$1((function*(){var i,o,s,a=_slicedToArray(yield r.runScript("register",r.prepareArray([e,t,n])),3);return o=a[0],s=a[1],i=a[2],{success:r.convertBool(o),wait:s,reservoir:i}}))()}__submit__(e,t){var n=this;return _asyncToGenerator$1((function*(){var r,i,o,s,a;try{var c=_slicedToArray(yield n.runScript("submit",n.prepareArray([e,t])),3);return s=c[0],r=c[1],a=c[2],{reachedHWM:n.convertBool(s),blocked:n.convertBool(r),strategy:a}}catch(e){if(0===(i=e).message.indexOf("OVERWEIGHT")){var u=_slicedToArray(i.message.split(":"),3);throw u[0],t=u[1],o=u[2],new BottleneckError$1(`Impossible to add a job having a weight of ${t} to a limiter having a maxConcurrent setting of ${o}`)}throw i}}))()}__free__(e,t){var n=this;return _asyncToGenerator$1((function*(){return{running:yield n.runScript("free",n.prepareArray([e]))}}))()}};var RedisDatastore_1=RedisDatastore,BottleneckError,States;BottleneckError=requireBottleneckError(),States=class{constructor(e){this.status=e,this._jobs={},this.counts=this.status.map((function(){return 0}))}next(e){var t,n;return n=(t=this._jobs[e])+1,null!=t&&n<this.status.length?(this.counts[t]--,this.counts[n]++,this._jobs[e]++):null!=t?(this.counts[t]--,delete this._jobs[e]):void 0}start(e){return 0,this._jobs[e]=0,this.counts[0]++}remove(e){var t;return null!=(t=this._jobs[e])&&(this.counts[t]--,delete this._jobs[e]),null!=t}jobStatus(e){var t;return null!=(t=this.status[this._jobs[e]])?t:null}statusJobs(e){var t,n,r,i;if(null!=e){if((n=this.status.indexOf(e))<0)throw new BottleneckError(`status must be one of ${this.status.join(", ")}`);for(t in i=[],r=this._jobs)r[t]===n&&i.push(t);return i}return Object.keys(this._jobs)}statusCounts(){return this.counts.reduce(((e,t,n)=>(e[this.status[n]]=t,e)),{})}};var States_1=States,DLList,Sync;function asyncGeneratorStep(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(e){asyncGeneratorStep(o,r,i,s,a,"next",e)}function a(e){asyncGeneratorStep(o,r,i,s,a,"throw",e)}s(void 0)}))}}DLList=DLList_1,Sync=class{constructor(e,t){this.schedule=this.schedule.bind(this),this.name=e,this.Promise=t,this._running=0,this._queue=new DLList}isEmpty(){return 0===this._queue.length}_tryToRun(){var e=this;return _asyncToGenerator((function*(){var t,n,r,i,o,s,a;if(e._running<1&&e._queue.length>0){e._running++;var c=e._queue.shift();return a=c.task,t=c.args,o=c.resolve,i=c.reject,n=yield _asyncToGenerator((function*(){try{return s=yield a(...t),function(){return o(s)}}catch(e){return r=e,function(){return i(r)}}}))(),e._running--,e._tryToRun(),n()}}))()}schedule(e,...t){var n,r,i;return i=r=null,n=new this.Promise((function(e,t){return i=e,r=t})),this._queue.push({task:e,args:t,resolve:i,reject:r}),this._tryToRun(),n}};var Sync_1=Sync;const version="2.19.5";var require$$8={version:version},Group_1,hasRequiredGroup,Batcher_1,hasRequiredBatcher,Bottleneck_1,hasRequiredBottleneck;function requireGroup(){if(hasRequiredGroup)return Group_1;function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function t(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=e.apply(n,r);function a(e){t(s,i,o,a,c,"next",e)}function c(e){t(s,i,o,a,c,"throw",e)}a(void 0)}))}}var r,i,o,s,a,c;return hasRequiredGroup=1,c=parser$3,r=Events_1,s=requireRedisConnection(),o=requireIORedisConnection(),a=requireScripts(),i=function(){class t{constructor(e={}){this.deleteKey=this.deleteKey.bind(this),this.limiterOptions=e,c.load(this.limiterOptions,this.defaults,this),this.Events=new r(this),this.instances={},this.Bottleneck=requireBottleneck(),this._startAutoCleanup(),this.sharedConnection=null!=this.connection,null==this.connection&&("redis"===this.limiterOptions.datastore?this.connection=new s(Object.assign({},this.limiterOptions,{Events:this.Events})):"ioredis"===this.limiterOptions.datastore&&(this.connection=new o(Object.assign({},this.limiterOptions,{Events:this.Events}))))}key(e=""){var t;return null!=(t=this.instances[e])?t:(()=>{var t;return t=this.instances[e]=new this.Bottleneck(Object.assign(this.limiterOptions,{id:`${this.id}-${e}`,timeout:this.timeout,connection:this.connection})),this.Events.trigger("created",t,e),t})()}deleteKey(e=""){var t=this;return n((function*(){var n,r;return r=t.instances[e],t.connection&&(n=yield t.connection.__runCommand__(["del",...a.allKeys(`${t.id}-${e}`)])),null!=r&&(delete t.instances[e],yield r.disconnect()),null!=r||n>0}))()}limiters(){var e,t,n,r;for(e in n=[],t=this.instances)r=t[e],n.push({key:e,limiter:r});return n}keys(){return Object.keys(this.instances)}clusterKeys(){var t=this;return n((function*(){var n,r,i,o,s,a,c;if(null==t.connection)return t.Promise.resolve(t.keys());for(s=[],n=null,c=`b_${t.id}-`.length,9;0!==n;){var u=e(yield t.connection.__runCommand__(["scan",null!=n?n:0,"match",`b_${t.id}-*_settings`,"count",1e4]),2);for(n=~~u[0],i=0,a=(r=u[1]).length;i<a;i++)o=r[i],s.push(o.slice(c,-9))}return s}))()}_startAutoCleanup(){var e,t=this;return clearInterval(this.interval),"function"==typeof(e=this.interval=setInterval(n((function*(){var e,n,r,i,o,s;for(n in o=Date.now(),i=[],r=t.instances){s=r[n];try{(yield s._store.__groupCheck__(o))?i.push(t.deleteKey(n)):i.push(void 0)}catch(t){e=t,i.push(s.Events.trigger("error",e))}}return i})),this.timeout/2)).unref?e.unref():void 0}updateSettings(e={}){if(c.overwrite(e,this.defaults,this),c.overwrite(e,e,this.limiterOptions),null!=e.timeout)return this._startAutoCleanup()}disconnect(e=!0){var t;if(!this.sharedConnection)return null!=(t=this.connection)?t.disconnect(e):void 0}}return t.prototype.defaults={timeout:3e5,connection:null,Promise:Promise,id:"group-key"},t}.call(void 0),Group_1=i}function requireBatcher(){return hasRequiredBatcher?Batcher_1:(hasRequiredBatcher=1,n=parser$3,t=Events_1,e=function(){class e{constructor(e={}){this.options=e,n.load(this.options,this.defaults,this),this.Events=new t(this),this._arr=[],this._resetPromise(),this._lastFlush=Date.now()}_resetPromise(){return this._promise=new this.Promise(((e,t)=>this._resolve=e))}_flush(){return clearTimeout(this._timeout),this._lastFlush=Date.now(),this._resolve(),this.Events.trigger("batch",this._arr),this._arr=[],this._resetPromise()}add(e){var t;return this._arr.push(e),t=this._promise,this._arr.length===this.maxSize?this._flush():null!=this.maxTime&&1===this._arr.length&&(this._timeout=setTimeout((()=>this._flush()),this.maxTime)),t}}return e.prototype.defaults={maxTime:null,maxSize:null,Promise:Promise},e}.call(void 0),Batcher_1=e);var e,t,n}function requireBottleneck(){if(hasRequiredBottleneck)return Bottleneck_1;function e(e,t){return r(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(e,t)||n()}function t(e){return r(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(e){if(Array.isArray(e))return e}function i(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var s=e.apply(t,n);function a(e){i(s,r,o,a,c,"next",e)}function c(e){i(s,r,o,a,c,"throw",e)}a(void 0)}))}}hasRequiredBottleneck=1;var s,a,c,u,l,d,p,m,h,f=[].splice;return 10,5,h=parser$3,l=Queues_1,c=Job_1,u=LocalDatastore_1,d=RedisDatastore_1,a=Events_1,p=States_1,m=Sync_1,s=function(){class n{constructor(e={},...t){var r,i;this._addToQueue=this._addToQueue.bind(this),this._validateOptions(e,t),h.load(e,this.instanceDefaults,this),this._queues=new l(10),this._scheduled={},this._states=new p(["RECEIVED","QUEUED","RUNNING","EXECUTING"].concat(this.trackDoneStatus?["DONE"]:[])),this._limiter=null,this.Events=new a(this),this._submitLock=new m("submit",this.Promise),this._registerLock=new m("register",this.Promise),i=h.load(e,this.storeDefaults,{}),this._store=function(){if("redis"===this.datastore||"ioredis"===this.datastore||null!=this.connection)return r=h.load(e,this.redisStoreDefaults,{}),new d(this,i,r);if("local"===this.datastore)return r=h.load(e,this.localStoreDefaults,{}),new u(this,i,r);throw new n.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`)}.call(this),this._queues.on("leftzero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.ref?e.ref():void 0})),this._queues.on("zero",(()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.unref?e.unref():void 0}))}_validateOptions(e,t){if(null==e||"object"!=typeof e||0!==t.length)throw new n.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.")}ready(){return this._store.ready}clients(){return this._store.clients}channel(){return`b_${this.id}`}channel_client(){return`b_${this.id}_${this._store.clientId}`}publish(e){return this._store.__publish__(e)}disconnect(e=!0){return this._store.__disconnect__(e)}chain(e){return this._limiter=e,this}queued(e){return this._queues.queued(e)}clusterQueued(){return this._store.__queued__()}empty(){return 0===this.queued()&&this._submitLock.isEmpty()}running(){return this._store.__running__()}done(){return this._store.__done__()}jobStatus(e){return this._states.jobStatus(e)}jobs(e){return this._states.statusJobs(e)}counts(){return this._states.statusCounts()}_randomIndex(){return Math.random().toString(36).slice(2)}check(e=1){return this._store.__check__(e)}_clearGlobalState(e){return null!=this._scheduled[e]&&(clearTimeout(this._scheduled[e].expiration),delete this._scheduled[e],!0)}_free(e,t,n,r){var i=this;return o((function*(){var t,o;try{if(o=(yield i._store.__free__(e,n.weight)).running,i.Events.trigger("debug",`Freed ${n.id}`,r),0===o&&i.empty())return i.Events.trigger("idle")}catch(e){return t=e,i.Events.trigger("error",t)}}))()}_run(e,t,n){var r,i,o;return t.doRun(),r=this._clearGlobalState.bind(this,e),o=this._run.bind(this,e,t),i=this._free.bind(this,e,t),this._scheduled[e]={timeout:setTimeout((()=>t.doExecute(this._limiter,r,o,i)),n),expiration:null!=t.options.expiration?setTimeout((function(){return t.doExpire(r,o,i)}),n+t.options.expiration):void 0,job:t}}_drainOne(e){return this._registerLock.schedule((()=>{var t,n,r,i,o;if(0===this.queued())return this.Promise.resolve(null);o=this._queues.getFirst();var s=r=o.first();return i=s.options,t=s.args,null!=e&&i.weight>e?this.Promise.resolve(null):(this.Events.trigger("debug",`Draining ${i.id}`,{args:t,options:i}),n=this._randomIndex(),this._store.__register__(n,i.weight,i.expiration).then((({success:e,wait:s,reservoir:a})=>{var c;return this.Events.trigger("debug",`Drained ${i.id}`,{success:e,args:t,options:i}),e?(o.shift(),(c=this.empty())&&this.Events.trigger("empty"),0===a&&this.Events.trigger("depleted",c),this._run(n,r,s),this.Promise.resolve(i.weight)):this.Promise.resolve(null)})))}))}_drainAll(e,t=0){return this._drainOne(e).then((n=>{var r;return null!=n?(r=null!=e?e-n:e,this._drainAll(r,t+n)):this.Promise.resolve(t)})).catch((e=>this.Events.trigger("error",e)))}_dropAllQueued(e){return this._queues.shiftAll((function(t){return t.doDrop({message:e})}))}stop(e={}){var t,r;return e=h.load(e,this.stopDefaults),r=e=>{var t;return t=()=>{var t;return(t=this._states.counts)[0]+t[1]+t[2]+t[3]===e},new this.Promise(((e,n)=>t()?e():this.on("done",(()=>{if(t())return this.removeAllListeners("done"),e()}))))},t=e.dropWaitingJobs?(this._run=function(t,n){return n.doDrop({message:e.dropErrorMessage})},this._drainOne=()=>this.Promise.resolve(null),this._registerLock.schedule((()=>this._submitLock.schedule((()=>{var t,n,i;for(t in n=this._scheduled)i=n[t],"RUNNING"===this.jobStatus(i.job.options.id)&&(clearTimeout(i.timeout),clearTimeout(i.expiration),i.job.doDrop({message:e.dropErrorMessage}));return this._dropAllQueued(e.dropErrorMessage),r(0)}))))):this.schedule({priority:9,weight:0},(()=>r(1))),this._receive=function(t){return t._reject(new n.prototype.BottleneckError(e.enqueueErrorMessage))},this.stop=()=>this.Promise.reject(new n.prototype.BottleneckError("stop() has already been called")),t}_addToQueue(e){var t=this;return o((function*(){var r,i,o,s,a,c,u;r=e.args,s=e.options;try{var l=yield t._store.__submit__(t.queued(),s.weight);a=l.reachedHWM,i=l.blocked,u=l.strategy}catch(n){return o=n,t.Events.trigger("debug",`Could not queue ${s.id}`,{args:r,options:s,error:o}),e.doDrop({error:o}),!1}return i?(e.doDrop(),!0):a&&(null!=(c=u===n.prototype.strategy.LEAK?t._queues.shiftLastFrom(s.priority):u===n.prototype.strategy.OVERFLOW_PRIORITY?t._queues.shiftLastFrom(s.priority+1):u===n.prototype.strategy.OVERFLOW?e:void 0)&&c.doDrop(),null==c||u===n.prototype.strategy.OVERFLOW)?(null==c&&e.doDrop(),a):(e.doQueue(a,i),t._queues.push(e),yield t._drainAll(),a)}))()}_receive(e){return null!=this._states.jobStatus(e.options.id)?(e._reject(new n.prototype.BottleneckError(`A job with the same id already exists (id=${e.options.id})`)),!1):(e.doReceive(),this._submitLock.schedule(this._addToQueue,e))}submit(...n){var r,i,o,s,a,u,l,d,p;"function"==typeof n[0]?(u=t(n),i=u[0],n=u.slice(1),l=e(f.call(n,-1),1),r=l[0],s=h.load({},this.jobDefaults)):(s=(d=t(n))[0],i=d[1],n=d.slice(2),p=e(f.call(n,-1),1),r=p[0],s=h.load(s,this.jobDefaults));return a=(...e)=>new this.Promise((function(t,n){return i(...e,(function(...e){return(null!=e[0]?n:t)(e)}))})),(o=new c(a,n,s,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise)).promise.then((function(e){return"function"==typeof r?r(...e):void 0})).catch((function(e){return Array.isArray(e)?"function"==typeof r?r(...e):void 0:"function"==typeof r?r(e):void 0})),this._receive(o)}schedule(...e){var n,r,i;if("function"==typeof e[0]){var o=t(e);i=o[0],e=o.slice(1),r={}}else{var s=t(e);r=s[0],i=s[1],e=s.slice(2)}return n=new c(i,e,r,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise),this._receive(n),n.promise}wrap(e){var t,n;return t=this.schedule.bind(this),(n=function(...n){return t(e.bind(this),...n)}).withOptions=function(n,...r){return t(n,e,...r)},n}updateSettings(e={}){var t=this;return o((function*(){return yield t._store.__updateSettings__(h.overwrite(e,t.storeDefaults)),h.overwrite(e,t.instanceDefaults,t),t}))()}currentReservoir(){return this._store.__currentReservoir__()}incrementReservoir(e=0){return this._store.__incrementReservoir__(e)}}return n.default=n,n.Events=a,n.version=n.prototype.version=require$$8.version,n.strategy=n.prototype.strategy={LEAK:1,OVERFLOW:2,OVERFLOW_PRIORITY:4,BLOCK:3},n.BottleneckError=n.prototype.BottleneckError=requireBottleneckError(),n.Group=n.prototype.Group=requireGroup(),n.RedisConnection=n.prototype.RedisConnection=requireRedisConnection(),n.IORedisConnection=n.prototype.IORedisConnection=requireIORedisConnection(),n.Batcher=n.prototype.Batcher=requireBatcher(),n.prototype.jobDefaults={priority:5,weight:1,expiration:null,id:"<no-id>"},n.prototype.storeDefaults={maxConcurrent:null,minTime:0,highWater:null,strategy:n.prototype.strategy.LEAK,penalty:null,reservoir:null,reservoirRefreshInterval:null,reservoirRefreshAmount:null,reservoirIncreaseInterval:null,reservoirIncreaseAmount:null,reservoirIncreaseMaximum:null},n.prototype.localStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:250},n.prototype.redisStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:5e3,clientTimeout:1e4,Redis:null,clientOptions:{},clusterNodes:null,clearDatastore:!1,connection:null},n.prototype.instanceDefaults={datastore:"local",connection:null,id:"<no-id>",rejectOnDrop:!0,trackDoneStatus:!1,Promise:Promise},n.prototype.stopDefaults={enqueueErrorMessage:"This limiter has been stopped and cannot accept new jobs.",dropWaitingJobs:!0,dropErrorMessage:"This limiter has been stopped."},n}.call(void 0),Bottleneck_1=s}var lib=requireBottleneck(),Bottleneck=getDefaultExportFromCjs(lib),browser="object"==typeof self?self.FormData:window.FormData,FormDataModule=getDefaultExportFromCjs(browser);const GRANT_TYPE$1="client_credentials",castClientOptionsToRequestParams=e=>{const{scope:t,clientId:n,clientSecret:r}=e;if(!n)throw new Error('Missing required "clientId" parameter to perform client credentials grant');if(!r)throw new Error('Missing required "clientSecret" parameter to perform client credentials grant');return Object.assign({client_id:n,client_secret:r,grant_type:GRANT_TYPE$1},t?{scope:t}:{})},isEligible$1=e=>{try{return!!castClientOptionsToRequestParams(e)}catch(e){return!1}},requestToken$1=(e,t)=>e(castClientOptionsToRequestParams(t)),RESPONSE_TYPE="token",castToAuthorizationRequestParams=e=>{const{clientId:t,scope:n,state:r,redirectUri:i}=e;if(!t)throw new Error('Missing required "clientId" parameter to perform implicit grant');return Object.assign(Object.assign({client_id:t,redirect_uri:i||window.location.href,response_type:RESPONSE_TYPE},n?{scope:n}:{}),r?{state:r}:{})},isEligibleForClientRedirect=e=>{try{return!!castToAuthorizationRequestParams(e)}catch(e){return!1}},getRedirectUrl=e=>`${e.oauthUrl}/oauth/authorize?${querystring.stringify(castToAuthorizationRequestParams(e),{skipEmptyString:!0,skipNull:!0})}`,GRANT_TYPE="password",castToTokenRequestParams=e=>{const{username:t,password:n,scope:r,clientId:i,clientSecret:o}=e;if(!i)throw new Error('Missing required "clientId" parameter to perform password grant');if(!t)throw new Error('Missing required "username" parameter to perform password grant');if(!n)throw new Error('Missing required "password" parameter to perform password grant');return Object.assign(Object.assign({client_id:i,grant_type:GRANT_TYPE,password:n,username:t},r?{scope:r}:{}),o?{client_secret:o}:{})},isEligible=e=>{try{return!!castToTokenRequestParams(e)}catch(e){return!1}},requestToken=(e,t)=>e(castToTokenRequestParams(t));async function maybeUpdateToken(e,t,n,r=!1){if(!r&&e.get("accessToken"))return;const i=Object.assign(Object.assign({},n),{refreshToken:e.get("refreshToken")});if(isEligible$2(i))return e.set(await requestToken$2(t,i));if(isEligible(n))return e.set(await requestToken(t,n));if("undefined"!=typeof window&&n.implicit){const t=querystring.parse(window.location.hash),r=t&&t.access_token;if(r)return window.history.replaceState({},"",window.location.href.split("#")[0]),e.set({accessToken:r});if(isEligibleForClientRedirect(n))return void(window.location.href=getRedirectUrl(n))}return!r&&isEligible$3(n)?e.set(await requestToken$3(t,n)):n.authorizationRedirect&&isEligibleForClientRedirect$1(n)?n.authorizationRedirect(getRedirectUrl$1(n)):isEligible$1(n)?e.set(await requestToken$1(t,n)):void 0}function sleep(e){return new Promise((t=>setTimeout((()=>t(!0)),e)))}const requestLogger=makeLogger("REST API Request"),responseLogger=makeLogger("REST API Response"),RETRYABLE_STATUS_CODES=[401,408,429,502,503,504],TOKEN_REFRESH_STATUS_CODES=[401],queue=new Bottleneck({maxConcurrent:QUEUE_CONCURRENCY,minTime:QUEUE_DELAY,reservoir:QUEUE_RESERVOIR}),refillIntervalSet=new Set;function isFormData(e){return void 0!==e&&void 0!==e.formData}function refillReservoir(){if(0===refillIntervalSet.size){const e=setInterval((async()=>{const t=await queue.currentReservoir();return queue.empty()&&0===await queue.running()&&t>10?await queue.incrementReservoir(1)&&fnClearInterval(e)&&refillIntervalSet.delete(e):t<QUEUE_RESERVOIR?queue.incrementReservoir(1):fnClearInterval(e)&&refillIntervalSet.delete(e)}),QUEUE_RESERVOIR_REFILL_INTERVAL);return refillIntervalSet.add(e)}return refillIntervalSet}async function makeResultFromResponse(e){return RETRYABLE_STATUS_CODES.includes(e.status)?e.clone():e.ok?"application/json"!==e.headers.get("content-type")&&204!==e.status?new Error(`Response content type was "${e.headers.get("content-type")}" but expected JSON`):{body:204===e.status?"":await e.json(),status:e.status}:new Error(`${e.status} ${e.statusText}\n\n${await e.text()}`)}function responseWasSuccessful(e){return!RETRYABLE_STATUS_CODES.includes(e.status)}function makeApiRequest(e,t,n,r,i,o,s){return async(a,c)=>{if(c>0){if(c>n.requestMaxRetries){const e=`Maximum number of retries reached while retrying ${a.method} request ${a.path}.`;throw requestLogger.error(e),new Error(e)}requestLogger.warn(`Warning: encountered ${a.status}. Retrying ${a.method} request ${a.path} (retry #${c}).`),await sleep(Math.ceil(Math.random()*n.requestBackOffInterval*2**c))}if(await maybeUpdateToken(e,t,n,c>0&&TOKEN_REFRESH_STATUS_CODES.includes(a.status)),!e.get("accessToken"))throw new Error("Unable to get OAuth2 access token.");try{return refillReservoir()&&await queue.schedule((async()=>{var t,a,c;const u=r.toUpperCase(),l=o&&o.query?(i.includes("?")?"&":"?")+querystring.stringify(o.query,{skipEmptyString:!0,skipNull:!0}):"",d=`${n.apiUrl}/api${i}${l}`,p=o&&o.body,m=isFormData(p),h=isFormData(p)?p.formData:{},f=Object.entries(h).reduce(((e,[t,n])=>(e.append.apply(e,[t].concat(n)),e)),new FormDataModule),y=Object.assign(Object.assign(Object.assign(Object.assign({accept:"application/json",authorization:`Bearer ${e.get("accessToken")}`,"X-Allthings-Caller":`${n.serviceName?n.serviceName:process.env.SEVICE_NAME?process.env.SEVICE_NAME:"unknown service name"} --- clientID ${null!==(c=null!==(a=null===(t=n.clientId)||void 0===t?void 0:t.split("_")[0])&&void 0!==a?a:n.clientId)&&void 0!==c?c:"no client id present"}`},m?{}:{"content-type":"application/json"}),"undefined"==typeof window&&"undefined"==typeof document&&{"user-agent":USER_AGENT}),o&&o.headers?o.headers:{}),m&&f.getHeaders?f.getHeaders():{});process.env.LOG_REQUEST&&console.log({sdkLogs:{method:u,url:d}}),requestLogger.log(u,d,{body:p,headers:y});const g={body:m?f:JSON.stringify(p)},_=await fetch$1(d,Object.assign({cache:"no-cache",credentials:"omit",headers:y,method:u,mode:"cors"},m||p?g:{})),v=await makeResultFromResponse(_);return responseLogger.log(u,d,v instanceof Error?{error:v}:{body:v.body,status:_.status}),v instanceof Error&&s?{body:v.message,status:_.status}:v}))}catch(e){return e}}}async function request(e,t,n,r,i,o,s){const a=await until(responseWasSuccessful,makeApiRequest(e,t,n,r,i,o,s));if(a instanceof Error)throw requestLogger.log("Request Error",a,o),a;return s?a:a.body}const API_METHODS=[agentCreate,agentCreatePermissions,appCreate,appGetById,bucketCreate,bucketAddFile,bucketRemoveFile,bucketRemoveFilesInPath,bucketGet,conversationGetById,conversationCreateMessage,fileCreate,fileDelete,notificationSettingsResetByUser,notificationSettingsUpdateByUser,groupCreate,groupGetById,groupUpdateById,getGroups,lookupIds,notificationsGetByUser,notificationUpdateRead,notificationsUpdateReadByUser,propertyCreate,propertyGetById,propertyUpdateById,getProperties,serviceProviderCreate,serviceProviderGetById,serviceProviderUpdateById,registrationCodeCreate,registrationCodeUpdateById,registrationCodeDelete,registrationCodeGetById,ticketCreateOnUser,ticketCreateOnServiceProvider,ticketGetById,unitCreate,unitGetById,unitUpdateById,getUnits,userCreate,userGetById,userUpdateById,userChangePassword,userCreatePermission,userCreatePermissionBatch,userGetPermissions,userDeletePermission,userCheckInToUtilisationPeriod,userGetUtilisationPeriods,userGetByEmail,getCurrentUser,getUsers,userRelationCreate,userRelationDelete,userRelationsGetByUser,utilisationPeriodCreate,utilisationPeriodDelete,utilisationPeriodGetById,utilisationPeriodUpdateById,utilisationPeriodCheckInUser,utilisationPeriodCheckOutUser,utilisationPeriodAddRegistrationCode,bookingUpdateById,bookingGetById];function restClient(e=DEFAULT_API_WRAPPER_OPTIONS){const t=Object.assign(Object.assign({},DEFAULT_API_WRAPPER_OPTIONS),e);if(void 0===t.apiUrl)throw new Error("API URL is undefined.");if(void 0===t.oauthUrl)throw new Error("OAuth2 URL is undefined.");if(!t.clientId&&!t.accessToken&&!t.tokenStore&&"undefined"==typeof window)throw new Error('Missing required "clientId" or "accessToken" parameter .');const n=makeFetchTokenRequester(`${t.oauthUrl}/oauth/token`),r=t.tokenStore||createTokenStore({accessToken:t.accessToken,refreshToken:t.refreshToken}),i=partial(request,r,n,t),o=partial(del,i),s=partial(get,i),a=partial(post,i),c=partial(patch,i),u=partial(put,i),l={authorizationCode:{getUri:(e=t.state||pseudoRandomString())=>partial(getRedirectUrl$1,Object.assign(Object.assign({},t),{state:e}))(),requestToken:e=>requestAndSaveToStore(partial(requestToken$3,n,Object.assign(Object.assign({},t),{authorizationCode:e||t.authorizationCode})),r)},generateState:pseudoRandomString,refreshToken:e=>requestAndSaveToStore(partial(requestToken$2,n,Object.assign(Object.assign({},t),{refreshToken:e||r.get("refreshToken")})),r)},d=API_METHODS.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:(...e)=>t(d,...e)})),{delete:o,get:s,oauth:l,options:t,patch:c,post:a,put:u});return d}var EnumResource,EnumCountryCode,EnumLocale,EnumTimezone,EnumServiceProviderType,EnumCommunicationMethodType,EnumInputChannel,EnumLookupUserType;exports.EnumResource=void 0,EnumResource=exports.EnumResource||(exports.EnumResource={}),EnumResource.group="group",EnumResource.property="property",EnumResource.serviceProvider="propertyManager",EnumResource.registrationCode="registrationCode",EnumResource.unit="unit",EnumResource.user="user",EnumResource.utilisationPeriod="utilisationPeriod",exports.EnumCountryCode=void 0,EnumCountryCode=exports.EnumCountryCode||(exports.EnumCountryCode={}),EnumCountryCode.CH="CH",EnumCountryCode.DE="DE",EnumCountryCode.FR="FR",EnumCountryCode.IT="IT",EnumCountryCode.NL="NL",EnumCountryCode.PT="PT",EnumCountryCode.US="US",exports.EnumLocale=void 0,EnumLocale=exports.EnumLocale||(exports.EnumLocale={}),EnumLocale.ch_de="ch_DE",EnumLocale.ch_fr="ch_FR",EnumLocale.ch_it="ch_it",EnumLocale.de_DE="de_DE",EnumLocale.it_IT="it_IT",EnumLocale.fr_FR="fr_FR",EnumLocale.pt_PT="pt_PT",EnumLocale.en_US="en_US",exports.EnumTimezone=void 0,EnumTimezone=exports.EnumTimezone||(exports.EnumTimezone={}),EnumTimezone.EuropeBerlin="Europe/Berlin",EnumTimezone.EuropeLondon="Europe/London",EnumTimezone.EuropeSofia="Europe/Sofia",EnumTimezone.EuropeZurich="Europe/Zurich",EnumTimezone.UTC="UTC",exports.EnumServiceProviderType=void 0,EnumServiceProviderType=exports.EnumServiceProviderType||(exports.EnumServiceProviderType={}),EnumServiceProviderType.propertyManager="property-manager",EnumServiceProviderType.craftspeople="craftspeople",exports.EnumCommunicationMethodType=void 0,EnumCommunicationMethodType=exports.EnumCommunicationMethodType||(exports.EnumCommunicationMethodType={}),EnumCommunicationMethodType.email="email",exports.EnumInputChannel=void 0,EnumInputChannel=exports.EnumInputChannel||(exports.EnumInputChannel={}),EnumInputChannel.APP="app",EnumInputChannel.COCKPIT="cockpit",EnumInputChannel.CRAFTSMEN="craftsmen",EnumInputChannel.EMAIL="email",EnumInputChannel.PHONE="phone",EnumInputChannel.WHATS_APP="whats_app",exports.EnumLookupUserType=void 0,EnumLookupUserType=exports.EnumLookupUserType||(exports.EnumLookupUserType={}),EnumLookupUserType.agent="agent",EnumLookupUserType.tenant="tenant",exports.DEFAULT_PARAMETER_STORE_CLIENT_CONFIG=DEFAULT_CLIENT_CONFIG,exports.createTokenStore=createTokenStore,exports.parameterStore=parameterStore,exports.restClient=restClient}));