UNPKG

anux-common

Version:

[![Build Status](https://travis-ci.com/Anupheaus/anux-common.svg?branch=master)](https://travis-ci.com/Anupheaus/anux-common) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/dd0e0bd3a96247a5a78c02a812f949f8)](https://www.codacy.com/app/Anuphea

1 lines 50.8 kB
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["anux-common"]=t():e["anux-common"]=t()}(global,(function(){return(()=>{"use strict";var e={9775:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationToken=void 0;const o=r(8041);class CancellationToken{constructor(){this._isCancelled=!1,this._callbacks=[],this._reason=void 0,this._isDisposed=!1}static create(){return new CancellationToken}get isCancelled(){return this._isCancelled}get reason(){return this._reason}cancel(e){this._isDisposed||this._isCancelled||(this._isCancelled=!0,this._reason=null!=e?e:"",this.callAllCallbacks())}onCancelled(e){return!this._isDisposed&&(this._isCancelled&&null!=this._reason?e(this._reason):this._callbacks.push(e),this._isCancelled)}dispose(){this._isDisposed=!0,this._callbacks.length=0}callAllCallbacks(){const e=this._reason;null!=e&&(this._callbacks.forEach((t=>t(e))),this._callbacks.length=0)}}n([o.bind],CancellationToken.prototype,"cancel",null),n([o.bind],CancellationToken.prototype,"onCancelled",null),n([o.bind],CancellationToken.prototype,"dispose",null),t.CancellationToken=CancellationToken},1274:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(9775),t),o(r(9912),t)},9912:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1357:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0;const isPrototype=e=>Object.getOwnPropertyNames(e).includes("constructor");function defineGetterOn(e,t,r){var n;null==(null===(n=Reflect.getOwnPropertyDescriptor(e,t))||void 0===n?void 0:n.get)&&Reflect.defineProperty(e,t,{get(){return isPrototype(this)?r:r.bind(this)},configurable:!0,enumerable:!0})}t.bind=function bind(e,t,r){if(!t)throw new Error("@bind decorator can only be applied to methods not a class");if(!r)throw new Error("@bind decorator can only be applied to methods not a variable");if(!r.value)return r;const n=r.value;return{get(){return isPrototype(this)?(defineGetterOn(this,t,n),n):n.bind(this)},set(e){defineGetterOn(this,t,e)},configurable:!0,enumerable:!0}}},8041:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(1357),t),o(r(2700),t)},2700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0,t.throttle=function throttle(e){const{timeout:t,ignoreArguments:r=!1}="number"==typeof e?{timeout:e}:e,n=Math.uniqueId();return(e,o,i)=>{if(!o)throw new Error("@throttle decorator can only be applied to methods not a class");if(!i)throw new Error("@throttle decorator can only be applied to methods not a variable");if(!i.value)return i;const s=i.value,a=new Map;return{value:function(...e){const o=!0===r?n:Object.hash({args:e});if(a.has(o))return a.get(o);const i=s.apply(this,e);return a.set(o,i),setTimeout((()=>{a.delete(o)}),t),i},configurable:!0,enumerable:!0,writable:!1}}}},1506:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArgumentInvalidError=void 0;const n=r(5885);class ArgumentInvalidError extends n.BaseError{constructor(e,t){super({message:`The argument '${e}' was invalid.`,info:{value:t}},ArgumentInvalidError)}}t.ArgumentInvalidError=ArgumentInvalidError},5885:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseError=void 0;class BaseError extends Error{constructor(e,t){var r,n;super(e.message),this.name=null!==(r=e.name)&&void 0!==r?r:this.constructor.name,this.code=null!==(n=e.code)&&void 0!==n?n:500,this.info=e.info,this.internalError=e.internalError,Object.setPrototypeOf(this,t.prototype)}toJSON(){const{message:e,name:t,code:r,info:n,internalError:o,stack:i}=this;return{name:t,message:e,code:r,info:n?JSON.stringify(n):void 0,internalError:o,stack:i}}}t.BaseError=BaseError},2844:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5885),t),o(r(8020),t),o(r(1506),t),o(r(3322),t),o(r(8341),t),o(r(9758),t),o(r(4679),t)},8020:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InternalError=void 0;const n=r(5885);class InternalError extends n.BaseError{constructor(e,t,r){t instanceof Error&&(r=t,t=void 0),super({message:e,code:500,info:t,internalError:r},InternalError)}}t.InternalError=InternalError},3322:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NotImplementedError=void 0;const n=r(5885);class NotImplementedError extends n.BaseError{constructor(e,t){super({code:404,message:e,info:t},NotImplementedError)}}t.NotImplementedError=NotImplementedError},4679:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectDisposedError=void 0;const n=r(5885);class ObjectDisposedError extends n.BaseError{constructor(e){super({message:e=e||"This instance has been disposed."},ObjectDisposedError)}}t.ObjectDisposedError=ObjectDisposedError},9758:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SecurityError=void 0;const n=r(5885);class SecurityError extends n.BaseError{constructor(e,t,r){super({message:e,code:403,info:t,internalError:r},SecurityError)}}t.SecurityError=SecurityError},8341:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValidationError=void 0;const n=r(5885);class ValidationError extends n.BaseError{constructor(e,t){super({message:e,info:{path:t}},ValidationError)}}t.ValidationError=ValidationError},3651:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Event=void 0;const n=r(2844),o=Symbol("handlerRemoved"),i=new WeakMap;t.Event={create(){const e=[],event=t=>{if(!i.has(event))throw new n.ObjectDisposedError("Unable to subscribe to an event after it has been disposed.");return e.push(t),()=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)}};return i.set(event,{handlers:e,isEnabled:!0}),event},raise(e,...t){const r=i.get(e);if(!r)throw new n.ObjectDisposedError("Unable to invoke event after it has been disposed.");const{handlers:s,isEnabled:a}=r;if(!a)return[];let c=!1;const l=s.map((e=>{if(!s.includes(e))return o;const r=e(...t);return r instanceof Promise&&(c=!0),r})).filter((e=>e!==o));return c?Promise.all(l):l},enable(e){const t=i.get(e);if(!t)throw new n.ObjectDisposedError("Unable to enable an event after it has been disposed.");t.isEnabled=!0},disable(e){const t=i.get(e);if(!t)throw new n.ObjectDisposedError("Unable to disable an event after it has been disposed.");t.isEnabled=!1},setEnabled(e,t){const r=i.get(e);if(!r)throw new n.ObjectDisposedError("Unable to change the state of an event after it has been disposed.");r.isEnabled=t},getSubscriptionCountFor(e){const t=i.get(e);if(!t)throw new n.ObjectDisposedError("Unable to count the subscriptions of an event after it has been disposed.");return t.handlers.length},isEnabled(e){const t=i.get(e);if(!t)throw new n.ObjectDisposedError("Unable to determine the state of an event after it has been disposed.");return t.isEnabled},dispose(...e){let t=!1;if(e.forEach((e=>{i.has(e)?i.delete(e):t=!0})),t)throw new n.ObjectDisposedError("Unable to dispose of event as it has already been disposed.")}}},861:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(3651),t)},2985:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(5277);Object.extendPrototype(Array.prototype,n.ArrayExtensions.prototype),Object.extendPrototype(Array,n.ArrayConstructorExtensions.prototype)},5277:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayConstructorExtensions=t.ArrayExtensions=void 0,r(6830);const n=r(5357),o=r(2844),i=r(2335);function isRecord(e){return null!=e&&"object"==typeof e&&"id"in e}function performUpsert(e,t,r,n,o){const i=e.slice();let s;if(-1!==t){const n=e[t],a=r(e[t],t),c=!(null==o||t===o);if(["string","number","boolean"].includes(typeof n)){if(s=a,n===s&&!c)return e}else if(s=Object.merge({},n,a),Reflect.areShallowEqual(s,n)&&!c)return e;i.splice(t,1)}else{if("function"!=typeof n)return e;s=n()}return"number"!=typeof o&&(o=-1===t?e.length:t),i.splice(o,0,s),i}r(6185);const s=[];t.ArrayExtensions=class ArrayExtensions{mapMany(e){const t=this.map(e);let r=[];return t.chunk(65534).forEach((e=>{r=Array.prototype.concat.apply(r,e)})),r}flatten(){const e=[],parseArrayItem=t=>{t instanceof Array?t.forEach(parseArrayItem):e.push(t)};return parseArrayItem(this),e}groupBy(e){const t=new Map;return this.forEach(((r,n)=>{return o=e(r,n,Array.from(t.keys())),t.set(o,(null!==(i=t.get(o))&&void 0!==i?i:[]).concat(r));var o,i})),t}ofType(e){return"string"==typeof e?this.filter((t=>typeof t===e)).cast():this.filter((t=>t instanceof e)).cast()}cast(){return this}single(e){const t=e?this.filter(e):this;if(t.length>1)throw new Error("Multiple items were found when only one was expected.");if(1===t.length)return t[0]}first(e){if(0!==this.length)return"function"!=typeof e?this[0]:this.find(e)}last(e){if(0!==this.length)return"function"!=typeof e?this[this.length-1]:this.slice().reverse().find(e)}clone(){return this.slice()}remove(e){let t=this.indexOf(e);if(-1===t)return this;const r=this.slice();do{r.splice(t,1),t=r.indexOf(e)}while(t>=0);return r}removeMany(e){return this.filter((t=>-1===e.indexOf(t)))}removeAt(e){const t=this.slice();return t.splice(e,1),t}removeByFilter(e){if("function"!=typeof e)throw new o.ArgumentInvalidError("filter");let t=!1;const r=this.slice();for(let n=r.length-1;n>=0;n--)e(r[n],n)&&(r.splice(n,1),t=!0);return t?r:this}removeById(e){return this.removeByFilter((t=>isRecord(t)&&t.id===e))}indexOfId(e){return this.findIndex((t=>isRecord(t)&&t.id===e))}findById(e){return this.find((t=>isRecord(t)&&t.id===e))}upsert(e,t){return performUpsert(this,isRecord(e)?this.indexOfId(e.id):this.indexOf(e),(()=>e),(()=>e),t)}upsertMany(e,t){let r=this;return e.forEach(((e,n)=>r=null==t?r.upsert(e):r.upsert(e,t+n))),r}upsertWhere(e,t){let r=!1;const n=this.map(((n,o)=>e(n,o)?(r=!0,Object.merge({},n,t(n,o))):n));return r?n:n.concat(t(void 0,n.length))}replace(e,t){const r=isRecord(e)?this.indexOfId(e.id):"number"==typeof t?Math.max(t,-1):-1;return-1===r?this:performUpsert(this,r,(()=>e),void 0,t)}replaceMany(e,t){let r=this;return e.forEach(((e,n)=>r=null==t?r.replace(e):r.replace(e,t+n))),r}update(e,t){if("function"==typeof e){const r=e;let n,o=!1;for(let e=0;e<this.length;e++)r(this[e],e)&&(o=!0,n=null!=n?n:this.slice(),n=performUpsert(n,e,null!=t?t:e=>e,void 0,e));return o?n:this}if(isRecord(e)){return-1===this.indexOfId(e.id)?this:this.insert(e)}return this}insert(e,t){if(-1!==(isRecord(e)?this.indexOfId(e.id):this.indexOf(e)))throw new o.InternalError("The item being inserted already exists in this array.");const r=this.slice();return t=null==t?this.length-1:t,r.splice(t,0,e),r}chunk(e){const t=Math.ceil(this.length/e),r=new Array;for(let n=0;n<t;n++)r.push(this.slice(n*e,(n+1)*e));return r}clear(){this.length=0}move(e,t){const r=this.slice(),n=r.splice(e,1);return r.splice(t,0,n[0]),r}orderBy(e,t=i.SortDirections.Ascending){let r=e;return"function"==typeof e&&(r=[{delegate:e,direction:t}]),r instanceof Array?this.slice().sort(((e,t)=>{for(const n of r){const r=n.delegate(e),o=n.delegate(t),s=r<o?-1:r>o?1:0;if(0!==s)return(n.direction===i.SortDirections.Descending?-1:1)*s}return 0})):this}removeNull(){return this.filter((e=>null!=e))}except(e){const t=this.slice().filter((t=>t&&isRecord(t)&&null!=t.id?null==e.findById(t.id):!e.includes(t)));return t.length===this.length?this:t}distinct(e=(e=>e)){const t=new Array,r=new Array;return this.forEach(((n,o)=>{const i=e(n,o);t.includes(i)||(t.push(i),r.push(n))})),r.length===this.length?this:r}equals(e,t=!0){if(this===e||0===this.length&&0===e.length)return!0;if(this.length!==e.length)return!1;const r=t?this.slice().sort():this,n=t?e.slice().sort():e;for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0}sum(e){const t="function"==typeof e?e:e=>e;return this.reduce(((e,r,n)=>e+t(r,n,this[n-1],this[n+1])),0)}min(e){var t;const r="function"==typeof e?e:e=>e;return null!==(t=this.map(((e,t,n)=>r(e,t,n[t-1],n[t+1]))).sort(((e,t)=>null!=e&&null!=t?e-t:null==e?1:null==t?-1:0)).first())&&void 0!==t?t:0}max(e){var t;const r="function"==typeof e?e:e=>e;return null!==(t=this.map(((e,t,n)=>r(e,t,n[t-1],n[t+1]))).sort(((e,t)=>null!=e&&null!=t?e-t:null==e?-1:null==t?1:0)).last())&&void 0!==t?t:0}average(e){"function"!=typeof e&&(e=e=>e);const t=[];for(let r=0;r<this.length;r++){const n=e(this[r],r,this[r-1],this[r+1]);"number"==typeof n&&t.push(n)}return t.length>0?t.sum()/t.length:0}aggregate(e,t){const r=t;switch(e){case"max":return this.max(r);case"min":return this.min(r);case"average":return this.average(r);default:return this.sum(r)}}absorb(e){return e.length<65535?Array.prototype.push.apply(this,e):e.chunk(65534).forEach((e=>Array.prototype.push.apply(this,e))),this}any(){return this[Math.floor(Math.random()*this.length)]}takeUntil(e,t=!1){const r=[];for(let n=0;n<this.length;n++){const o=this[n];if(e(o,n)){t&&r.push(o);break}r.push(o)}return r}diff(e,t){t="function"==typeof t?t:(e,t)=>isRecord(e)&&isRecord(t)?e.id===t.id:e===t;const r=e.map(((e,t)=>({item:e,index:t}))),n={added:[],removed:[],matched:[]};return this.forEach(((e,o)=>{let i=!1;r.some(((s,a)=>{const{item:c,index:l}=s;if(null==t?void 0:t(e,c,o,l))return i=!0,n.matched.push({sourceItem:e,targetItem:c}),r.splice(a,1),!0})),i||n.removed.push(e)})),n.added.push(...r.map((e=>e.item))),n}ids(){const e=[];for(const t of this)isRecord(t)&&e.push(t.id);return e}mergeWith(e,t){const r=Object.assign({matchBy:(e,t)=>e===t||isRecord(e)&&isRecord(t)&&null!=e.id&&e.id===t.id,updateMatched:n.MergeWithUpdateOperations.KeepSource,updateUnmatched:e=>e,createBy:e=>e,removeUnmatched:!1,addNew:!0,matchOrder:!1},t);let o=[],i=!1;if(r.matchOrder)return o=e.mergeWith(this,{matchBy:(e,t)=>r.matchBy(t,e),updateMatched:(e,t,n,o)=>{const s=r.updateMatched(t,e,o,n);return o===n&&s===t||(i=!0),s},updateUnmatched:e=>(i=!0,r.createBy(e)),createBy:e=>(i=!0,e),removeUnmatched:e=>"function"==typeof r.addNew?!r.addNew(e):!r.addNew,addNew:e=>"function"==typeof r.removeUnmatched?!r.removeUnmatched(e):!r.removeUnmatched,matchOrder:!1}),o===e?o.slice():i?o:this;const s=[];if(this.forEach(((t,n)=>{let a=!1;if(e.forEach(((e,c)=>{if(r.matchBy(t,e)){const l=r.updateMatched(t,e,n,c);l!==t&&(i=!0),o.push(l),s.push(e),a=!0}})),!a)if("function"==typeof r.removeUnmatched?r.removeUnmatched(t):r.removeUnmatched)i=!0;else{const e=r.updateUnmatched(t);e!==t&&(i=!0),o.push(e)}})),"function"==typeof r.addNew||r.addNew){const t="function"==typeof r.addNew?r.addNew:()=>!0,n=e.except(s).filter(t).map(r.createBy);n.length>0&&(o.absorb(n),i=!0)}return i?o:this}syncWith(e,t){return this.mergeWith(e,Object.assign(Object.assign({},t),{removeUnmatched:!0,matchOrder:!0}))}take(e){return 0===this.length||this.length<=e?this:0===e?[]:this.slice(0,e)}takeLast(e){return 0===this.length||this.length<=e?this:0===e?[]:this.slice(this.length-e)}skip(e){return 0===this.length||0===e?this:this.length<e?[]:this.slice(e)}toMap(e){const throwError=e=>{throw new Error(`Item at index ${e} of this array is not a record and no createKey delegate was provided to generate the key.`)};return new Map(this.map(((t,r,n)=>[e?e(t,r,n):isRecord(t)?t.id:throwError(r),t])))}toSet(){return new Set(this)}};t.ArrayConstructorExtensions=class ArrayConstructorExtensions{ofSize(e){return new Array(e).fill(void 0,0,e)}empty(){return s}}},1989:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),r(6830);const o=n(r(7246));Object.extendPrototype(Date.prototype,class DateExtensions{clone(){return new Date(this)}add(e,t){e=parseInt(`${e}`),e=(()=>{switch(t){case"days":return 24*e*60*60*1e3;case"hours":return 60*e*60*1e3;case"minutes":return 60*e*1e3;case"seconds":return 1e3*e}})();const r=this.clone();return r.setTime(r.getTime()+e),r}format(e){return o.default(this,null!=e?e:"isoDateTime")}}.prototype),Object.extendPrototype(Date,class DateConstructorExtensions{timeTaken(e){if(e instanceof Date)return Date.timeTaken(e.getTime());if("number"==typeof e)return Date.now()-e;throw new Error("The epoch time or date you provided to timeTaken was invalid.")}}.prototype)},5876:()=>{},9097:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(2985);const n=r(2844),o=new RegExp(/^\s{4}at\s(\S+)\s\((.*?):(\d+):(\d+)\)$/,"gmi"),emptyFunction=()=>{},emptyAsyncFunction=()=>Promise.resolve();Object.addMethods(Function.prototype,[function setName(e){return Object.defineProperty(this,"name",{value:e,enumerable:!1,configurable:!0,writable:!1}),this},function wrap(e,t){const r=Reflect.getDefinition(e,this.name);if(!r)throw new n.InternalError(`Unable to find the original definition for method ${this.name} on ${e.constructor.name}.`);const o=r.value;if("function"!=typeof o)throw new n.InternalError(`The original definition for member ${this.name} on ${e.constructor.name} was not a method.`);const i=function method(...r){return t(r,(t=>o.apply(e,t)))};i.setName(this.name),Object.defineProperty(e,this.name,{value:i,configurable:!0,enumerable:!1,writable:!1})},function empty(){return emptyFunction},function emptyAsync(){return emptyAsyncFunction},function getStackTrace(){var e;const t=(null!==(e=(new Error).stack)&&void 0!==e?e:"").match(o);return!t||t.length<2?[]:t.skip(1).map((e=>{const t=new RegExp(o,"gmi").exec(e);if(null==t)return;return{methodName:t[1],file:t[2],line:parseInt(t[3],10),column:parseInt(t[4],10)}})).removeNull()}])},4485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},637:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),r(6830),r(2985),r(5876),r(9097),r(428),r(6695),r(6185),r(197),r(1173),r(9169),o(r(2684),t),o(r(4485),t),o(r(1989),t),o(r(2703),t),o(r(6695),t)},2684:(e,t)=>{function parseArguments(e,t,r,n,o,i){return void 0===n?t&&(void 0===r||typeof e===r):(o=o||n,i=i||(e=>e),!t||void 0!==r&&typeof t!==r?o():i(e))}Object.defineProperty(t,"__esModule",{value:!0}),t.is=t.IsNot=t.Is=void 0;class Is{get not(){return r}null(e,t){return"number"==typeof t&&(t=void 0),parseArguments(e,null==e,void 0,t,(()=>e),(()=>!t||t()))}function(e){return"function"==typeof e&&!e.toString().startsWith("class ")}class(e){return"function"==typeof e&&e.toString().startsWith("class ")}prototype(e){return!(!this.object(e)||"function"!=typeof e.constructor||!Object.getOwnPropertyNames(e).includes("constructor"))||!!this.class(e)}array(e){return e instanceof Array}promise(e){if(t.is.null(e))return!1;if(e instanceof Promise)return!0;const r=e;return t.is.function(r.catch)&&t.is.function(r.then)}guid(e){return!!t.is.string(e)&&/^[{(]?[0-9A-F]{8}[-]?(?:[0-9A-F]{4}[-]?){3}[0-9A-F]{12}[)}]?$/gim.test(e)}keyValuePair(e){return!!t.is.object(e)&&(Object.prototype.hasOwnProperty.call(e,"key")&&Object.prototype.hasOwnProperty.call(e,"value"))}object(e){return"object"==typeof e&&!this.array(e)&&!this.null(e)&&!this.date(e)}plainObject(e){if("object"!=typeof e||null===e)return!1;if(t.is.function(Object.getPrototypeOf)){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}date(e,r){const n=e instanceof Date;return t.is.null(r)?n:n?e:r}boolean(e){return"boolean"==typeof e}string(e){return"string"==typeof e}empty(e){return"string"!=typeof e||0===e.length}error(e){return!!t.is.object(e)&&(e instanceof Error||t.is.not.empty(e.stack)&&t.is.not.empty(e.message))}number(e){return"number"==typeof e&&!isNaN(e)}enum(e,t){const r=Reflect.ownKeys(t);return null!=e&&r.includes(e.toString())}primitive(e){return!t.is.object(e)}}t.Is=Is;class IsNot{null(e,t){return"number"==typeof t&&(t=void 0),parseArguments(e,null!=e,void 0,t,(()=>!!t&&t()),(()=>e))}empty(...e){return 3===e.length&&"number"==typeof e[1]&&e[2]instanceof Array&&(e=[e[0]]),e.every((e=>"string"==typeof e&&e.length>0))}object(e){return!t.is.object(e)}}t.IsNot=IsNot;const r=new IsNot;t.is=new Is},1173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(6830);const n=r(2684);Object.extendPrototype(Map.prototype,class MapExtensions{toArray(){return Array.from(this.entries())}toKeysArray(){return Array.from(this.keys())}toValuesArray(){return Array.from(this.values())}getOrSet(e,t){if(this.has(e))return this.get(e);const r=t();return this.set(e,r),r}}.prototype),Object.extendPrototype(Map,class MapConstructorExtensions{fromPlainObject(e){if(!n.is.plainObject(e))throw new Error("Unable to convert provided object to a map, the object was either invalid or missing.");return new Map(Object.entries(e))}}.prototype)},428:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(488);Object.extendPrototype(Math,n.MathExtensions.prototype)},488:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MathExtensions=void 0,r(6830);const n=r(1231);t.MathExtensions=class MathExtensions{emptyId(){return"00000000-0000-0000-0000-000000000000"}uniqueId(){return n.v4()}between(e,t,r){return this.max(t,Math.min(r,e))}roundTo(e,t){return+(this.round(e+`e+${t}`)+`e-${t}`)}toPercentage(e,t=1){return this.roundTo(100*e,t)}}},6830:function(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0});const o=r(3694),i=r(2684),s=r(1231);function isOverridableItemArray(e){return e.cast().every((e=>null!=e&&"object"==typeof e&&null!=e.id))}function parseValue(e,t,r){return void 0===t||e===t?e:i.is.date(t)?t:i.is.plainObject(t)?(null==e&&(e={}),function parseObject(e,t,r){return void 0===t||Reflect.ownKeys(t).forEach((o=>{var i,s;let{get:a,value:c}=null!==(i=Object.getOwnPropertyDescriptor(e,o))&&void 0!==i?i:{};c=a?a.call(e):"function"!=typeof c?c:void 0;const l=null!==(s=Object.getOwnPropertyDescriptor(t,o))&&void 0!==s?s:{},{get:u,set:f,value:d}=l,p=n(l,["get","set","value"]),h=u?()=>u.call(e):void 0,y=f?(...t)=>f.call(e,t):void 0,b=void 0!==d?"function"==typeof d?(...t)=>d.apply(e,t):parseValue(c,d,r):void 0;Object.defineProperty(e,o,Object.assign(Object.assign(Object.assign(Object.assign({},p),h?{get:h}:{}),y?{set:y}:{}),void 0!==b?{value:b}:{}))})),e}(e,t,r)):i.is.array(t)?(null==e&&(e=[]),function parseArray(e,t,r){if(e instanceof Array||(e=[]),0===e.length&&0===t.length)return e;if(r&&isOverridableItemArray(e)&&isOverridableItemArray(t))return e=e.syncWith(t,{updateMatched:(e,t)=>parseValue(e,t,!0)});const n=e.slice();let o=!1;return e.length>t.length&&(n.length=t.length,o=!0),t.forEach(((t,i)=>{const s=parseValue(e[i],t,r);s!==e[i]&&(o=!0,n[i]=s)})),o?n:e}(e,t,r)):t}Object.addMethods||Object.defineProperty(Object,"addMethods",{value:function addMethods(e,t){t.forEach((t=>{var r;const n=t.name,o=e[n];if(!i.is.function(o)||o.toString()!==t.toString())try{Object.defineProperty(e,n,{value:t,enumerable:!1,configurable:!0,writable:!0})}catch(i){console.error("An error has occurred trying to add the following method to the following target.",{target:e.constructor.name,method:n,currentMethod:null!==(r=null==o?void 0:o.toString())&&void 0!==r?r:"<Undefined>",newMethod:t.toString()})}}))},enumerable:!1,configurable:!0,writable:!1}),Object.addMethods(Object,[function extendPrototype(e,t){const r={};Object.entries(Object.getOwnPropertyDescriptors(t)).forEach((([e,t])=>{"constructor"!==e&&"function"==typeof t.value&&(r[e]=t)})),Object.defineProperties(e,r)},function merge(e,...t){return t.removeNull().forEach((t=>e=parseValue(e,t,!0))),e},function clone(e){return null==e?e:e instanceof Array?Object.merge([],e):Object.merge({},e)},function hash(e){if(i.is.null(e))return"";const t=[];if(e&&"object"==typeof e&&"function"==typeof e.constructor){i.is.prototype(e)?e=e.constructor:"Object"===e.constructor.name?t.push(JSON.stringify(e)):t.push(`InstanceOf_${e.constructor.name}`)}return Reflect.getAllPrototypesOf(e).forEach((e=>t.push("function"==typeof e.constructor?e.constructor.toString():e.toString()))),o.hash(t.join("|"))},function remove(e,t){return t(e)},function getValueOf(e,t,r){let n,o=e,s=t;i.is.function(e)&&(o=void 0,s=e,r=t);try{n=s(o)}catch(e){if(e instanceof TypeError)return r;throw e}return null!=n?n:r},function mixin(e,t){Object.getOwnPropertyNames(t.prototype).forEach((r=>e.prototype[r]=t.prototype[r]))},function using(e,t){let r;try{r=t(e)}finally{e.dispose()}return r},function stringify(e,t,r){const n=new Map,o=null!=t?t:(e,t)=>t;return JSON.stringify(e,((e,t)=>{if(t=o(e,t),i.is.function(t))return t.toString();if(!i.is.object(t)&&!i.is.plainObject(t))return t;if(i.is.function(t.toJSON))return t.toJSON();if(n.has(t))return{__replaceWithStringifyUniqueObjectId:n.get(t)};const r=s.v4();return t.__stringifyUniqueObjectId=r,n.set(t,r),t}),r)}]),Object.values||Object.addMethods(Object,[function values(e){return Object.keys(e).map((t=>e[t]))}])},6695:function(e,t,r){var n,o,i,s=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function fulfilled(e){try{step(n.next(e))}catch(e){i(e)}}function rejected(e){try{step(n.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))},c=this&&this.__classPrivateFieldSet||function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},l=this&&this.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=t.PromiseState=void 0,r(6830);const u=r(8041);var f;!function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"}(f=t.PromiseState||(t.PromiseState={}));class DeferredPromise extends Promise{constructor(e,t={}){super(((r,n)=>{t.resolve=r,t.reject=n,null==e||e(r,n)})),n.set(this,void 0),o.set(this,void 0),i.set(this,void 0),c(this,o,t.resolve,"f"),c(this,i,t.reject,"f"),c(this,n,f.Pending,"f")}get state(){return l(this,n,"f")}resolve(e){l(this,n,"f")===f.Pending&&(c(this,n,f.Fulfilled,"f"),l(this,o,"f").call(this,e))}reject(e){l(this,n,"f")===f.Pending&&(c(this,n,f.Rejected,"f"),l(this,i,"f").call(this,e))}}n=new WeakMap,o=new WeakMap,i=new WeakMap,s([u.bind],DeferredPromise.prototype,"resolve",null),s([u.bind],DeferredPromise.prototype,"reject",null),t.DeferredPromise=DeferredPromise;Object.extendPrototype(Promise,class PromiseConstructorExtensions{delay(e){return a(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}createDeferred(){return new DeferredPromise}}.prototype)},6185:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PropertyAccess=void 0;const n=r(2662),o=r(2844),i=r(2684);var s;r(2985),r(6830),function(e){e[e.CanRead=0]="CanRead",e[e.CanWrite=1]="CanWrite"}(s=t.PropertyAccess||(t.PropertyAccess={}));function performComparison(e,t,r,o=!1){return((e,t)=>(e="function"==typeof e?e:void 0,n.createCustomEqual((r=>(n,o)=>{if(e){const t=e(n,o);if(!0===t||!1===t)return t}if("function"==typeof n&&"function"==typeof o&&n.toString()===o.toString())return!0;if(!(t||"object"!=typeof n||"object"!=typeof o||n instanceof Date))return n===o;const i=r(n,o);return t?i:!0===i}))))(r,o)(e,t)}function navigateToProperty(e,t,r=(()=>({value:null,shouldContinue:!1}))){const n=t.split(".");let o=n.shift(),i=e;for(;n.length>0&&o;){if(void 0===i[o]){const e=r(i,o);if(null!=e.value&&(Reflect.defineProperty(i,o,{value:e.value,enumerable:!1,writable:!0,configurable:!0}),!e.shouldContinue))break}i=i[o],o=n.shift()}return n.length>0?[void 0,""]:[i,null!=o?o:""]}Object.addMethods(Reflect,[function isOrDerivesFrom(e,t){let r="function"==typeof e?e.prototype:e;if(null==r)return!1;const n="function"==typeof t?t.prototype:t;do{if(r===n)return!0;r=Object.getPrototypeOf(r)}while(r!==Object.prototype);return!1},function className(e){const t=Reflect.typeOf(e);if(t.isInstance)return e.constructor.name;if(t.isPrototype)return e.name;throw new Error("The type of the target provided was neither an instance or a class definition.")},function getDefinition(e,t){if(!e)return;let r,n=e;do{if(null==n||n==Object.prototype)break;r=Reflect.getOwnPropertyDescriptor(n,t),null==r&&(n=Reflect.getPrototypeOf(n))}while(null==r);return r},function getAllDefinitionsForMember(e,t){const r=new Array;let n=e;for(;;){if(null==n||n===Object.prototype)break;const e=Reflect.getOwnPropertyDescriptor(n,t)||null;null!=e&&r.push(e),n=Reflect.getPrototypeOf(n)}return r},function getAllDefinitions(e){const t={};return Reflect.getAllPrototypesOf(e).mapMany((e=>Object.getOwnPropertyNames(e).map((t=>({key:t,descriptor:Reflect.getOwnPropertyDescriptor(e,t)}))).filter((e=>null!=e.descriptor)))).forEach((e=>{t[e.key]||(t[e.key]=e.descriptor)})),t},function bindAllMethodsOn(e){const t=Reflect.typeOf(e),r=t.isInstance?e.constructor.prototype:t.isPrototype?e.prototype:void 0;if(!r)throw new Error("Unable to retrieve prototype from target provided.");const n=Reflect.getAllDefinitions(e);Object.entries(n).filter((([,e])=>"function"==typeof e.value)).forEach((([e,t])=>{const n=t.value;Reflect.defineProperty(r,e,{get(){return n.bind(this)},configurable:!0,enumerable:!0})}))},function getProperty(e,t,r,n=!1){const[o,i]=navigateToProperty(e,t,(()=>n?{value:{},shouldContinue:!0}:{value:null,shouldContinue:!1}));if(null==o)return r;let s=o[i];return void 0===s&&n&&(Reflect.setProperty(o,i,r),s=r),s},function setProperty(e,t,r){const[n,i]=navigateToProperty(e,t,(()=>({value:{},shouldContinue:!0})));if(null==n)throw new Error("This error should not occur, it means something went wrong within navigateToProperty");if(void 0===n[i])Reflect.defineProperty(n,i,{value:r,writable:!0,configurable:!0,enumerable:!1});else{if(!Reflect.checkPropertyAccess(n,i,s.CanWrite))throw new o.InternalError("Unable to set property value because the property does not permit write access.",{target:n,property:i});n[i]=r}},function checkPropertyAccess(e,t,r){const[n,a]=navigateToProperty(e,t);if(null===n)throw new o.InternalError("Access was requested on a property that does not exist.",{target:e,propertyName:t,access:r});const c=Reflect.getDefinition(n,a);if(null===c)return!1;switch(r){case s.CanWrite:return i.is.function(c.set)||!0===c.writable;case s.CanRead:return i.is.function(c.get)||!0===c.writable;default:return!1}},function getAllPrototypesOf(e){let t;const r=new Array,n=Reflect.typeOf(e);if(n.isPrototype&&(t=e.prototype),n.isInstance&&(t=Reflect.getPrototypeOf(e)),n.isObject&&(t=e),null==t)return[];for(r.push(t);(t=Reflect.getPrototypeOf(t))!==Object.prototype;)r.push(t);return r.cast()},function invoke(e,t,...r){if("object"!=typeof e||null==e)throw new Error("Invalid target for invocation.");let n,o=e;if(t.split(".").forEach(((e,t,r)=>{n=o[e],"object"==typeof n&&null!=n&&t<r.length-1&&(o=n)})),"function"!=typeof n)throw new Error(`Unable to find "${t}" on the object provided.`);return n.apply(o,r)},function invokeAll(e,t,...r){return Reflect.getAllPrototypesOf(e).map((e=>{const r=Reflect.getOwnPropertyDescriptor(e,t);if(null!=r&&i.is.function(r.value))return r.value})).removeNull().map((t=>t.apply(e,r)))},function getAndCombineAll(e,t){const r=Reflect.getAllPrototypesOf(e).map((e=>{const r=Reflect.getOwnPropertyDescriptor(e,t);if(null!=r&&i.is.function(r.get))return r.get})).removeNull().map((t=>t.call(e))).removeNull().reverse();return Object.merge({},...r)},function parameterNames(e){return e.toString().replace(/[/][/].*$/gm,"").replace(/\s+/g,"").replace(/[/][*][^/*]*[*][/]/g,"").split("){",1)[0].replace(/^[^(]*[(]/,"").replace(/=[^,]+/g,"").split(",").filter(Boolean)},function wrapMethod(e,t,r){Object.defineProperty(e,t.name,{value:(...n)=>(n.unshift(t.bind(e)),r.apply(e,n)),configurable:!0,enumerable:!1,writable:!1})},function hashesOf(e){return Reflect.getAllPrototypesOf(e).map((e=>Object.hash(e))).removeByFilter((e=>""===e||null==e)).distinct()},function areDeepEqual(e,t,r){return performComparison(e,t,r,!0)},function areShallowEqual(e,t,r){return performComparison(e,t,r,!1)},function typeOf(e){let t=typeof e;const r=e instanceof Array,n=null===e,o=void 0===e,i=n||o,s=e instanceof Date;let a="object"===t&&!r&&!n&&!s,c="function"===t,l=!1,u=!1;a&&"function"==typeof e.constructor?(l=Object.getOwnPropertyNames(e).includes("constructor"),u=!l&&"Object"!==e.constructor.name,a=!(l||u)):c&&e.toString().indexOf("class")>=0&&(l=!0,c=!1);const f="boolean"===t,d="number"===t,p="string"===t;return t=r?"array":n?"null":t,{type:t,isArray:r,isNull:n,isUndefined:o,isNullOrUndefined:i,isDate:s,isObject:a,isPrototype:l,isInstance:u,isBoolean:f,isNumber:d,isString:p,isFunction:c,isPrimitive:f||d||p,value:e}},function walk(e,t){const walkFunc=(e,r,n)=>{Object.entries(Reflect.getAllDefinitions(e)).forEach((([o,s],a)=>{const c={name:o,descriptor:s,propertyIndex:a,parent:r,get path(){return null==r?[o]:r.path.concat([n,o].removeNull())},get:()=>{var e;return Reflect.has(s,"get")?null===(e=s.get)||void 0===e?void 0:e.call(s):Reflect.has(s,"value")?s.value:void 0},set:t=>{(Reflect.has(s,"set")||s.writable)&&Reflect.set(e,o,t)}};if(!1===t(c))return;const l=c.get();i.is.array(l)&&l.forEach(((e,t)=>walkFunc(e,c,t))),i.is.plainObject(l)&&walkFunc(l,c)}))};walkFunc(e,void 0)},function getByPath(e,t){if("string"==typeof t){const r=t.split(/\.|\[|\]/).filter((e=>e.length>0));if(r.length>1){const t=r.shift();if(null!=t){const{wasFound:n,value:o}=getByPath(e,t);if(n&&(i.is.plainObject(o)||i.is.array(o)))return getByPath(o,r.join("."))}return{wasFound:!1,value:void 0}}}return Reflect.has(e,t)?{wasFound:!0,value:Reflect.get(e,t)}:{wasFound:!1,value:void 0}},function setByPath(e,t,r,n=!0){if("string"==typeof t){const o=t.split(/(\.|\[|\])/).filter((e=>e.length>0));if(o.length>1){const t=o.shift(),s="["===o.shift();let a=0;if(s){let e="";do{e+=o.shift()}while(!e.includes("]")&&o.length>0);a=parseInt(e.substr(0,e.length-1)),o.shift()}let{wasFound:c,value:l}=Reflect.getByPath(e,t);if(null==l&&(c=!1),c){if(s&&i.is.array(l)){if(l.length<=a){if(!n)return!1;l.length=a+1}return 0===o.length?(l[a]=r,!0):(null==l[a]&&(l[a]={}),setByPath(l[a],o.join(""),r,n))}return setByPath(l,o.join(""),r,n)}{if(!n)return!1;if(s){const i=new Array(a+1);return Reflect.set(e,t,i),0===o.length?(i[a]=r,!0):(i[a]={},setByPath(i[a],o.join(""),r,n))}const i={};return Reflect.set(e,t,i),setByPath(i,o.join(""),n)}}}return Reflect.set(e,t,r)}])},9169:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(6830);Object.extendPrototype(Set,class SetExtensions{map(e){const t=new Set;let r=0;return this.forEach(((n,o,i)=>{t.add(e(n,r,i)),r++})),t}filter(e){const t=new Set;let r=0;return this.forEach(((n,o,i)=>{e(n,r,i)&&t.add(n),r++})),t}toArray(){return Array.from(this)}}.prototype)},197:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),r(6830);const n=r(254);Object.extendPrototype(String.prototype,n.StringExtensions.prototype),Object.extendPrototype(String,n.StringConstructorExtensions.prototype)},254:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StringConstructorExtensions=t.StringExtensions=void 0;const n=r(3694);r(428);t.StringExtensions=class StringExtensions{asTemplate(e){const t=Reflect.ownKeys(e).map((t=>[t,e[t]]));return new Function(...t.map((e=>e[0])),`return \`${this}\`;`)(...t.map((e=>e[1])))}hash(e=16){return n.hash(this,e)}condenseWhitespace(){return this.replace(/(^\s+)|(\s*\n\s*)/gm," ")}toPascalCase(){return"string"!=typeof this||0===this.length?"":1===this.length?this.toUpperCase():this.split(/\s+/g).filter((e=>"string"==typeof e&&e.length>0)).map((e=>`${e.substr(0,1).toUpperCase()}${e.substr(1).toLowerCase()}`)).join(" ")}toCamelCase(){if("string"!=typeof this||0===this.length)return"";if(1===this.length)return this.toLowerCase();const e=this.toPascalCase();return`${e.substr(0,1).toLowerCase()}${e.substr(1)}`}toVariableName(){return this.toCamelCase().replace(/\s+/g,"")}countOf(e){return"string"!=typeof e||0===e.length||0===this.length?0:this.split(e).length-1}obfuscate(e){if(0===this.length)return this;let{minimum:t,percentage:r,character:n}=Object.assign({minimum:6,percentage:80,character:"*"},e);if(t=Math.max(t,0),r=Math.between(r,0,100)/100,0===t&&0===r)return this;if(n=0===n.length?"*":n[0],this.length<=t)return n.repeat(t);let o=Math.max(Math.floor(this.length*r),t);const i=this.length-o,s=Math.ceil(i/2),a=Math.floor(i/2);o=this.length-s-a;const c=s+o,l=this.length-c;return`${this.substr(0,s)}${n.repeat(o)}${this.substr(c,l)}`}between(e,t,r=!1){let n="number"==typeof e?e:this.indexOf(e),o="number"==typeof t?t:this.indexOf(t,n+1);if(n<0)throw new Error("The starting index was invalid or starting search string was not found.");if(o<0)throw new Error("The ending index was invalid or ending search string was not found.");return"string"!=typeof e||r||(n+=e.length),"string"==typeof t&&r&&(o+=t.length),this.substr(n,o-n)}};t.StringConstructorExtensions=class StringConstructorExtensions{pluralize(e,...t){return r=>{const n=[];r=Math.max(r,0);return e.forEach(((e,o)=>{n.push(e);const i=t[o];var s;if(null!=i)if("string"==typeof i)n.push(i);else if("function"==typeof i)n.push(i(r));else if(i instanceof Array){const e=(s=i.length)<2?null:2===s?1===r?0:1:Math.min(r,2);if(null==e)return;n.push(i[e])}})),n.join("").replace(/\$\$/g,r.toString())}}}},2703:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.to=void 0;const o=r(2844),i=r(2684),s=n(r(3756));t.to=new class To{string(e,t,r=!0){r="boolean"==typeof t?t:r;const n="string"==typeof t?t:void 0;return i.is.number(e)?i.is.string(n)?s.default(e).format(n):e.toString():i.is.date(e)?i.is.string(n)?e.format(n):e.format("dd/MM/yyyy hh:mm:ss"):"string"==typeof e&&(r||e.length>0)?e:"string"==typeof n?n:""}boolean(e,t){return i.is.boolean(e)?e:i.is.function(e)?null!=t?this.boolean(e(),t):this.boolean(e()):null!=t&&t}date(e,t){return t instanceof Date||(t=void 0),i.is.date(e)?e:i.is.number(e)?new Date(e):i.is.not.empty(e)?new Date(Date.parse(e)):null!=t?t:new Date}number(e,t){if("number"==typeof e)return e;if("string"==typeof e){const r=parseInt(e,0);if(isNaN(r))return null!=t?t:0;const n=parseFloat(e);return r===n?r:n}return null!=t?t:0}function(e,t){return"function"==typeof e?e:t||(()=>{})}object(e,t){return"object"==typeof e&&null!=e?e:t||{}}array(e){return i.is.array(e)?e:new Array}type(e,t,r){if(1===arguments.length)return(t=e)instanceof Date?"date":t instanceof Array?"array":typeof t;{const n=e instanceof Date?"date":e instanceof Array?"array":e;return(0,a[n])(t,r)}}};const a={string:t.to.string,function:t.to.function,object:t.to.object,boolean:t.to.boolean,date:t.to.date,array:t.to.array,number:t.to.number,bigint:t.to.number,symbol:()=>{throw new o.NotImplementedError("Unable to convert any value to a symbol type.")}}},3694:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hash=void 0,t.hash=function hash(e,t=16){if(0===e.length||t<=0)return"";const createChunk=e=>{let t=2166136261;for(let r=0,n=e.length;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return(t>>>0).toString(36)};let r=createChunk(e);for(;r.length<t;)r+=createChunk(r+e);return r.substr(0,t)}},341:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),r(637),o(r(8041),t),o(r(637),t),o(r(5357),t),o(r(2844),t),o(r(861),t),o(r(1274),t),o(r(9137),t),o(r(5886),t),o(r(9502),t)},645:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4443:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5573),t),o(r(3511),t),o(r(645),t),o(r(1),t),o(r(1656),t)},5573:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MergeWithUpdateOperations=void 0,t.MergeWithUpdateOperations={UseTargetIfDifferent:(e,t)=>e===t?e:t,KeepSource:e=>e,KeepTarget:(e,t)=>t,Merge:(e,t)=>Object.merge(e,t)}},3511:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1291:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(7088),t)},7088:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeUnits=void 0;const n=r(2844);!function(e){e[e.Day=0]="Day",e[e.Week=1]="Week",e[e.Month=2]="Month",e[e.Quarter=3]="Quarter",e[e.Year=4]="Year"}(t.TimeUnits||(t.TimeUnits={})),function(e){e.toMomentUnits=function toMomentUnits(t){switch(t){case e.Day:return"days";case e.Week:return"weeks";case e.Month:return"months";case e.Quarter:return"quarters";case e.Year:return"years";default:throw new n.InternalError("The time unit provided was not recognised.",{timeUnit:t})}}}(t.TimeUnits||(t.TimeUnits={}))},8116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6723:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4202:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7091:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(8116),t),o(r(6723),t),o(r(4202),t),o(r(6295),t),o(r(7711),t)},6295:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7711:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5357:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(2335),t),o(r(1291),t),o(r(4443),t),o(r(7091),t)},9954:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortDirections=void 0,function(e){e[e.None=0]="None",e[e.Ascending=1]="Ascending",e[e.Descending=2]="Descending"}(t.SortDirections||(t.SortDirections={})),function(e){e.toCSSClass=function toCSSClass(t){switch(t){case e.Ascending:return"sorted-asc";case e.Descending:return"sorted-desc";default:return""}},e.toShortName=function toShortName(t){switch(t){case e.Ascending:return"Asc";case e.Descending:return"Desc";default:return""}},e.nextDirectionAfter=function nextDirectionAfter(e){return 2===e?0:e+1}}(t.SortDirections||(t.SortDirections={}))},2335:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(9954),t)},9401:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSettings=void 0;const n=r(637);t.createSettings=e=>e(function createSettingsFrom(){const e={env(e,t){var r;const o=t&&"defaultValue"in t,i=Object.assign({defaultValue:void 0,isRequired:!o,transform:e=>{if(!o)return e;const t=n.to.type(e),r=n.to.type(i.defaultValue);return t===r?e:"array"===r?e.split("|"):"object"===r?JSON.parse(e):n.to.type(r,e)}},t),{defaultValue:s,isRequired:a,transform:c}=i;if("undefined"==typeof process)throw new Error("The settings should not be used outside of a node environment.");if(e in process.env&&c)return c(null!==(r=process.env[e])&&void 0!==r?r:"");if(a)throw new Error(`The setting "${e}" was not found in the environment variables, but this is a required setting.`);return s},preset:{get mode(){return e.env("NODE_ENV",{defaultValue:"production",isRequired:!0,transform:e=>["dev","development"].includes((e||"").toLowerCase())?"development":"production"})}}};return e}())},9137:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(9401),t)},9416:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.chain=void 0;const n=r(637);t.chain=function chain(...e){return(...t)=>{if(0==e.length)return;let r;return e.filter(n.is.function).forEach(((e,n)=>{const o=e(...t);0===n&&(r=o)})),r}}},9502:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(9416),t),o(r(7765),t)},7765:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.memoize=void 0,r(6185);const n=new WeakMap;t.memoize=function memoize(e,t){var r;const{dependencies:o,maxCacheLength:i}=Object.assign({dependencies:[],maxCacheLength:0},t),s=null!==(r=n.has(e)?n.get(e):void 0)&&void 0!==r?r:[];return n.set(e,s),(...t)=>{const r=[...t,...o];let n=s.find((e=>Reflect.areShallowEqual(e.dependencies,r)));if(n)return n.result;const a=e(...t);if(n={dependencies:r,result:a},s.push(n),i>0)for(;s.length>i;)s.shift();return a}}},5886:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(4015),t)},4015:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.repeatOnError=void 0;const n=r(2684);t.repeatOnError=function repeatOnError(e,t){const{onSuccess:r,onAttempt:o,onFailure:i,maxAttempts: