@decaf-ts/for-couchdb 0.0.2 → 0.1.1
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.
- package/dist/esm/for-couchdb.bundle.min.esm.js +1 -1
- package/dist/esm/for-couchdb.bundle.min.esm.js.LICENSE.txt +0 -11
- package/dist/for-couchdb.bundle.min.js +1 -1
- package/dist/for-couchdb.bundle.min.js.LICENSE.txt +0 -11
- package/docker/.dockerignore +5 -0
- package/docker/.env +7 -0
- package/docker/Dockerfile-booter +19 -0
- package/docker/Dockerfile-couchdb +4 -0
- package/docker/couchdb.ini +886 -0
- package/docker/docker-compose.yml +109 -0
- package/docker/init-cluster.sh +66 -0
- package/lib/adapter.cjs +80 -88
- package/lib/adapter.d.ts +11 -12
- package/lib/constants.cjs +2 -1
- package/lib/constants.d.ts +1 -0
- package/lib/esm/adapter.d.ts +11 -12
- package/lib/esm/adapter.js +80 -88
- package/lib/esm/constants.d.ts +1 -0
- package/lib/esm/constants.js +2 -1
- package/lib/esm/index.d.ts +4 -1
- package/lib/esm/index.js +5 -2
- package/lib/esm/indexes/generator.d.ts +1 -1
- package/lib/esm/indexes/generator.js +1 -1
- package/lib/esm/indexes/index.d.ts +0 -1
- package/lib/esm/indexes/index.js +1 -2
- package/lib/esm/interfaces/CouchDBRepository.d.ts +1 -1
- package/lib/esm/interfaces/CouchDBRepository.js +1 -1
- package/lib/esm/query/FromClause.d.ts +1 -1
- package/lib/esm/query/FromClause.js +1 -1
- package/lib/esm/query/InsertClause.d.ts +1 -1
- package/lib/esm/query/InsertClause.js +1 -1
- package/lib/esm/query/Paginator.d.ts +1 -1
- package/lib/esm/query/Paginator.js +1 -1
- package/lib/esm/query/SelectClause.d.ts +1 -1
- package/lib/esm/query/SelectClause.js +1 -1
- package/lib/esm/query/Statement.d.ts +3 -3
- package/lib/esm/query/Statement.js +1 -1
- package/lib/esm/query/ValuesClause.d.ts +1 -1
- package/lib/esm/query/ValuesClause.js +1 -1
- package/lib/esm/query/WhereClause.d.ts +1 -1
- package/lib/esm/query/WhereClause.js +1 -1
- package/lib/esm/query/constants.d.ts +1 -1
- package/lib/esm/query/constants.js +1 -1
- package/lib/esm/query/factory.d.ts +1 -1
- package/lib/esm/query/factory.js +1 -1
- package/lib/esm/query/translate.d.ts +1 -1
- package/lib/esm/query/translate.js +1 -1
- package/lib/esm/types.d.ts +406 -0
- package/lib/esm/types.js +3 -0
- package/lib/esm/utils.d.ts +3 -3
- package/lib/esm/utils.js +1 -1
- package/lib/index.cjs +5 -2
- package/lib/index.d.ts +4 -1
- package/lib/indexes/generator.cjs +1 -1
- package/lib/indexes/generator.d.ts +1 -1
- package/lib/indexes/index.cjs +1 -2
- package/lib/indexes/index.d.ts +0 -1
- package/lib/interfaces/CouchDBRepository.cjs +1 -1
- package/lib/interfaces/CouchDBRepository.d.ts +1 -1
- package/lib/query/FromClause.cjs +1 -1
- package/lib/query/FromClause.d.ts +1 -1
- package/lib/query/InsertClause.cjs +1 -1
- package/lib/query/InsertClause.d.ts +1 -1
- package/lib/query/Paginator.cjs +1 -1
- package/lib/query/Paginator.d.ts +1 -1
- package/lib/query/SelectClause.cjs +1 -1
- package/lib/query/SelectClause.d.ts +1 -1
- package/lib/query/Statement.cjs +1 -1
- package/lib/query/Statement.d.ts +3 -3
- package/lib/query/ValuesClause.cjs +1 -1
- package/lib/query/ValuesClause.d.ts +1 -1
- package/lib/query/WhereClause.cjs +1 -1
- package/lib/query/WhereClause.d.ts +1 -1
- package/lib/query/constants.cjs +1 -1
- package/lib/query/constants.d.ts +1 -1
- package/lib/query/factory.cjs +1 -1
- package/lib/query/factory.d.ts +1 -1
- package/lib/query/translate.cjs +1 -1
- package/lib/query/translate.d.ts +1 -1
- package/lib/types.cjs +4 -0
- package/lib/types.d.ts +406 -0
- package/lib/utils.cjs +1 -1
- package/lib/utils.d.ts +3 -3
- package/package.json +10 -16
- package/lib/esm/indexes/types.d.ts +0 -11
- package/lib/esm/indexes/types.js +0 -3
- package/lib/indexes/types.cjs +0 -4
- package/lib/indexes/types.d.ts +0 -11
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see for-couchdb.bundle.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("for-couchdb",[],t):"object"==typeof exports?exports["for-couchdb"]=t():e["for-couchdb"]=t()}(this,(()=>(()=>{var e={7526:(e,t)=>{"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,c)),l=0,f=c>0?a-4:a;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=16383,s=0,u=n-o;s<u;s+=a)i.push(c(e,s,s+a>u?u:s+a));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var o,i,a=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8287:(e,t,r)=>{"use strict";var n=r(7526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=s(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){var t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var o=function(e){if(c.isBuffer(e)){var t=0|h(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||q(e.length)?s(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return l(e),s(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function h(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(o)return n?-1:B(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,o){var i,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=r;i<s;i++)if(u(e,i)===u(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===c)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(r+c>s&&(r=s-c),i=r;i>=0;i--){for(var f=!0,d=0;d<c;d++)if(u(e,i+d)!==u(t,d)){f=!1;break}if(f)return i}return-1}function w(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(q(s))return a;e[r+a]=s}return a}function E(e,t,r,n){return F(B(t,e.length-r),e,r,n)}function O(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return F(U(t),e,r,n)}function R(e,t,r,n){return F(function(e,t){for(var r,n,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,a,s,c,u=e[o],l=null,f=u>239?4:u>223?3:u>191?2:1;if(o+f<=r)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(c=(15&u)<<12|(63&i)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=f}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=a,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},c.allocUnsafe=function(e){return f(e)},c.allocUnsafeSlow=function(e){return f(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=c.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(K(i,Uint8Array))o+i.length>n.length?c.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!c.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)b(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,o){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(n,o),l=e.slice(t,r),f=0;f<s;++f)if(u[f]!==l[f]){i=u[f],a=l[f];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return O(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function j(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=V[e[i]];return o}function D(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function C(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,r,n,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function I(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,i){return t=+t,r>>>=0,i||I(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function N(e,t,r,n,i){return t=+t,r>>>=0,i||I(e,0,r,8),o.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||x(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||x(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=c.isBuffer(e)?e:c.from(e,n),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%s]}return this};var k=/[^+/0-9A-Za-z-_]/g;function B(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}var V=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},6866:e=>{e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},8075:(e,t,r)=>{"use strict";var n=r(453),o=r(487),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},487:(e,t,r)=>{"use strict";var n=r(6743),o=r(453),i=r(6897),a=r(9675),s=o("%Function.prototype.apply%"),c=o("%Function.prototype.call%"),u=o("%Reflect.apply%",!0)||n.call(c,s),l=r(655),f=o("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=u(n,c,arguments);return i(t,1+f(0,e.length-(arguments.length-1)),!0)};var d=function(){return u(n,s,arguments)};l?l(e.exports,"apply",{value:d}):e.exports.apply=d},41:(e,t,r)=>{"use strict";var n=r(655),o=r(8068),i=r(9675),a=r(5795);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new i("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,l=arguments.length>6&&arguments[6],f=!!a&&a(e,t);if(n)n(e,t,{configurable:null===u&&f?f.configurable:!u,enumerable:null===s&&f?f.enumerable:!s,value:r,writable:null===c&&f?f.writable:!c});else{if(!l&&(s||c||u))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},655:(e,t,r)=>{"use strict";var n=r(453)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(e){n=!1}e.exports=n},1237:e=>{"use strict";e.exports=EvalError},1764:e=>{"use strict";e.exports=Error},9290:e=>{"use strict";e.exports=RangeError},9538:e=>{"use strict";e.exports=ReferenceError},8068:e=>{"use strict";e.exports=SyntaxError},9675:e=>{"use strict";e.exports=TypeError},5345:e=>{"use strict";e.exports=URIError},7007:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var o,i,a,u;if(s(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function d(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){n.once&&e.removeEventListener(t,o),r(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=h(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return s(t),this.on(e,f(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,f(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,o,i,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return d(this,e,!0)},i.prototype.rawListeners=function(e){return d(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},9353:e=>{"use strict";var t=Object.prototype.toString,r=Math.max,n=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r};e.exports=function(e){var o=this;if("function"!=typeof o||"[object Function]"!==t.apply(o))throw new TypeError("Function.prototype.bind called on incompatible "+o);for(var i,a=function(e){for(var t=[],r=1,n=0;r<e.length;r+=1,n+=1)t[n]=e[r];return t}(arguments),s=r(0,o.length-a.length),c=[],u=0;u<s;u++)c[u]="$"+u;if(i=Function("binder","return function ("+function(e){for(var t="",r=0;r<e.length;r+=1)t+=e[r],r+1<e.length&&(t+=",");return t}(c)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof i){var t=o.apply(this,n(a,arguments));return Object(t)===t?t:this}return o.apply(e,n(a,arguments))})),o.prototype){var l=function(){};l.prototype=o.prototype,i.prototype=new l,l.prototype=null}return i}},6743:(e,t,r)=>{"use strict";var n=r(9353);e.exports=Function.prototype.bind||n},453:(e,t,r)=>{"use strict";var n,o=r(1764),i=r(1237),a=r(9290),s=r(9538),c=r(8068),u=r(9675),l=r(5345),f=Function,d=function(e){try{return f('"use strict"; return ('+e+").constructor;")()}catch(e){}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch(e){p=null}var h=function(){throw new u},y=p?function(){try{return h}catch(e){try{return p(arguments,"callee").get}catch(e){return h}}}():h,g=r(4039)(),b=r(24)(),m=Object.getPrototypeOf||(b?function(e){return e.__proto__}:null),v={},w="undefined"!=typeof Uint8Array&&m?m(Uint8Array):n,E={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":g&&m?m([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":i,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":f,"%GeneratorFunction%":v,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&m?m(m([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&m?m((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&m?m((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&m?m(""[Symbol.iterator]()):n,"%Symbol%":g?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":y,"%TypedArray%":w,"%TypeError%":u,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":l,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(m)try{null.error}catch(e){var O=m(m(e));E["%Error.prototype%"]=O}var _=function e(t){var r;if("%AsyncFunction%"===t)r=d("async function () {}");else if("%GeneratorFunction%"===t)r=d("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=d("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&m&&(r=m(o.prototype))}return E[t]=r,r},R={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=r(6743),A=r(9957),P=S.call(Function.call,Array.prototype.concat),j=S.call(Function.apply,Array.prototype.splice),T=S.call(Function.call,String.prototype.replace),M=S.call(Function.call,String.prototype.slice),D=S.call(Function.call,RegExp.prototype.exec),C=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,x=/\\(\\)?/g,I=function(e,t){var r,n=e;if(A(R,n)&&(n="%"+(r=R[n])[0]+"%"),A(E,n)){var o=E[n];if(o===v&&(o=_(n)),void 0===o&&!t)throw new u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new c("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new u('"allowMissing" argument must be a boolean');if(null===D(/^%?[^%]*%?$/,e))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=M(e,0,1),r=M(e,-1);if("%"===t&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new c("invalid intrinsic syntax, expected opening `%`");var n=[];return T(e,C,(function(e,t,r,o){n[n.length]=r?T(o,x,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",o=I("%"+n+"%",t),i=o.name,a=o.value,s=!1,l=o.alias;l&&(n=l[0],j(r,P([0,1],l)));for(var f=1,d=!0;f<r.length;f+=1){var h=r[f],y=M(h,0,1),g=M(h,-1);if(('"'===y||"'"===y||"`"===y||'"'===g||"'"===g||"`"===g)&&y!==g)throw new c("property names with quotes must have matching quotes");if("constructor"!==h&&d||(s=!0),A(E,i="%"+(n+="."+h)+"%"))a=E[i];else if(null!=a){if(!(h in a)){if(!t)throw new u("base intrinsic for "+e+" exists, but the property is not available.");return}if(p&&f+1>=r.length){var b=p(a,h);a=(d=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:a[h]}else d=A(a,h),a=a[h];d&&!s&&(E[i]=a)}}return a}},5795:(e,t,r)=>{"use strict";var n=r(453)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},8211:(e,t,r)=>{"use strict";var n=r(655),o=function(){return!!n};o.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},24:e=>{"use strict";var t={__proto__:null,foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof r)}},4039:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(1333);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},1333:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},9957:(e,t,r)=>{"use strict";var n=Function.prototype.call,o=Object.prototype.hasOwnProperty,i=r(6743);e.exports=i.call(n,o)},1083:(e,t,r)=>{var n=r(1568),o=r(8835),i=e.exports;for(var a in n)n.hasOwnProperty(a)&&(i[a]=n[a]);function s(e){if("string"==typeof e&&(e=o.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw new Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}i.request=function(e,t){return e=s(e),n.request.call(this,e,t)},i.get=function(e,t){return e=s(e),n.get.call(this,e,t)}},251:(e,t)=>{t.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,c=(1<<s)-1,u=c>>1,l=-7,f=r?o-1:0,d=r?-1:1,p=e[t+f];for(f+=d,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=d,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+e[t+f],f+=d,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=u}return(p?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,f=l>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(a++,c/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*c-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=255&s,p+=h,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[r+p]=255&a,p+=h,a/=256,u-=8);e[r+p-h]|=128*y}},6698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},4101:(e,t,r)=>{const n=r(7007).EventEmitter,o=r.g.AbortController||r(4441).z,i=r(9413),a="batch",s="error",c=()=>{const e=new i.Transform({objectMode:!0});return e._transform=function(e,t,r){let n=e.toString("utf8");this._lastLineData&&(n=this._lastLineData+n,this._lastLineData=null);const o=n.split(/\s*\n/);this._lastLineData=o.splice(o.length-1,1)[0],o.forEach(this.push.bind(this)),r()},e._flush=function(e){this.push(this._lastLineData),this._lastLineData=null,e()},e};e.exports=class{constructor(e,t){this.db=e,this.setDefaults(),this.request=t}setDefaults(){this.ee=new n,this.batchSize=100,this.fastChanges=!1,this.since="now",this.includeDocs=!1,this.timeout=6e4,this.started=!1,this.wait=!1,this.stopOnEmptyChanges=!1,this.continue=!0,this.qs={},this.selector=null,this.paused=!1,this.abortController=null}pause(){this.paused=!0}resume(){this.paused=!1}stop(){this.continue=!1,this.abortController&&this.abortController.abort()}async sleep(e){return new Promise(((t,r)=>{setTimeout(t,e)}))}start(e){const t=this;if(t.started)return t.ee;t.started=!0,e=e||{},Object.assign(t,e);let r=0;return(async()=>{do{if(!t.paused){t.abortController=new o;const n={method:"post",db:t.db,path:"_changes",signal:t.abortController.signal,qs:{feed:"longpoll",timeout:t.timeout,since:t.since,limit:t.batchSize,include_docs:t.includeDocs},body:{}};t.fastChanges&&(n.qs.seq_interval=t.batchSize),t.selector&&(n.qs.filter="_selector",n.body.selector=t.selector),Object.assign(n.qs,e.qs);try{const e=await t.request(n);if(t.abortController=null,r=0,e&&e.last_seq&&e.last_seq!==t.since&&(t.since=e.last_seq,t.ee.emit("seq",t.since)),t.stopOnEmptyChanges&&e&&void 0!==e.results&&0===e.results.length&&(t.continue=!1),e&&e.results&&e.results.length>0){for(const r in e.results)t.ee.emit("change",e.results[r]);t.wait&&t.pause(),t.ee.emit(a,e.results)}}catch(e){e&&e.statusCode&&e.statusCode>=400&&429!==e.statusCode&&e.statusCode<500?t.continue=!1:r=r?Math.min(6e4,2*r):5e3,t.ee.emit(s,e)}}t.paused&&0===r&&(r=100),t.continue&&r>0&&await t.sleep(r)}while(t.continue);t.ee.emit("end",t.since),t.setDefaults()})(),t.ee}get(e){return this.stopOnEmptyChanges=!0,this.start(e)}spool(e){const t=this;t.setDefaults(),e=e||{},Object.assign(t,e);const r={method:"post",db:t.db,path:"_changes",qs:{since:t.since,include_docs:t.includeDocs,seq_interval:t.batchSize},stream:!0,body:{}};t.selector&&(r.qs.filter="_selector",r.body.selector=t.selector);const n=c(),o=((e,t)=>{const r=new i.Transform({objectMode:!0}),n=[];return r.lastSeq="0",r._transform=function(o,i,s){","===o[o.length-1]&&(o=o.slice(0,-1));try{const r=JSON.parse(o);n.push(r),n.length>=t&&e.emit(a,n.splice(0,t)),s()}catch(e){const t=o.match(/"last_seq":(.+?)[},]/);t&&(r.lastSeq=JSON.parse(t[1])),s()}},r._flush=function(t){n.length>0&&e.emit(a,n.splice(0,n.length)),t()},r})(t.ee,t.batchSize);return t.request(r).pipe(n).pipe(o).on("finish",(e=>{setTimeout((()=>{t.ee.emit("end",o.lastSeq)}),10)})).on(s,(e=>{t.ee.emit(s,e)})),t.ee}}},6761:(e,t,r)=>{const{URL:n}=r(8835);e.exports=class{constructor(){this.jar=[]}clean(){const e=(new Date).getTime();for(let t=0;t<this.jar.length;t++)this.jar[t].ts<e&&(this.jar.splice(t,1),t--)}add(e,t){const r=this.findByName(t,e.name);r>=0?(this.jar[r].value=e.value,this.jar[r].expires=e.expires,this.jar[r].ts=new Date(e.expires).getTime()):this.jar.push(e)}findByName(e,t){this.clean();const r=(new Date).getTime(),o=new n(e);for(let e=0;e<this.jar.length;e++){const n=this.jar[e];if(n.origin===o.origin&&n.name===t&&n.ts>=r)return e}return-1}getCookieString(e){let t;this.clean();const r=(new Date).getTime(),o=new n(e),i=[];for(t=0;t<this.jar.length;t++){const e=this.jar[t];if((e.origin===o.origin||e.domain&&o.hostname.endsWith(e.domain))&&e.ts>=r){if(e.httponly&&!["http:","https:"].includes(o.protocol))continue;if(e.path&&!o.pathname.startsWith(e.path))continue;if(e.secure&&"https:"!==o.protocol)continue;i.push(e.value)}}return i.length>0?i.join("; "):""}parse(e,t){const r=new n(t),o=e.split(";").map((e=>e.trim())),i=o.shift(),a={name:i.split("=")[0],origin:r.origin,pathname:r.pathname,protocol:r.protocol};o.forEach((e=>{const t=e.split("=");a[t[0].toLowerCase()]=t[1]||!0})),a.ts=new Date(a.expires).getTime(),a.value=i,this.add(a,t)}}},9947:e=>{const t="\r\n",r="--";e.exports=class{constructor(e){this.boundary=this.uuid();const n=[];for(const o of e)n.push(Buffer.from(r+this.boundary+t)),n.push(Buffer.from(`content-type: ${o.content_type}${t}`)),n.push(Buffer.from(`content-length: ${o.data.length}${t}`)),n.push(Buffer.from(t)),n.push("string"==typeof o.data?Buffer.from(o.data):o.data),n.push(Buffer.from(t));n.push(Buffer.from(r+this.boundary+r+t)),this.data=Buffer.concat(n),this.header=`multipart/related; boundary=${this.boundary}`}uuid(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");let t="";for(let r=0;r<16;r++)t+=e[Math.floor(Math.random()*e.length)];return t}}},7881:(e,t,r)=>{const{URL:n}=r(8835),o=r(1568),i=r(1083),a=r(9723),s=r(5373),c=r(6425),u=r(9413),l=r(8128),f={keepAlive:!0,maxSockets:50,keepAliveMsecs:3e4},d=new o.Agent(f),p=new i.Agent(f),h="XXXXXX",y=r(4101),g=r(6761),b=r(9947);function m(e,t){return"function"==typeof e&&(t=e,e={}),{opts:e=e||{},callback:t}}function v(...e){return e.some((e=>!e))}function w(e,t=new Error("Invalid parameters")){return e?e(t,null):Promise.reject(t)}function E(e,t){return/[^/]$/.test(e)&&(e+="/"),new n(t,e).toString()}e.exports=function(e){let t={};"string"==typeof e&&(e={url:e}),a.strictEqual(typeof e,"object","You must specify the endpoint url when invoking this module"),a.ok(/^https?:/.test(e.url),"url is not valid"),e=Object.assign({},e),t.config=e,e.requestDefaults=e.requestDefaults||{};const r="function"==typeof e.log?e.log:()=>{},o=!("parseUrl"in e)||e.parseUrl;function i(e){return e&&(e=e.replace(/\/\/(.*)@/,`//${h}:${h}@`)),e}function f(e,t){e.url=i(e.url),e.headers.cookie&&(e.headers.cookie="XXXXXXX"),e.auth&&(t||(e.auth=JSON.parse(JSON.stringify(e.auth))),e.auth.username=h,e.auth.password=h)}e.cookieJar=new g;const O=function(t,n,o,a,s,u){const l=t.status||t.response&&t.response.status||500;t.isAxiosError&&t.response&&(t=t.response);let d=t.data;if(t.statusCode=l,t.headers){const r=t.headers["set-cookie"];r&&r.length&&r.forEach((t=>{e.cookieJar.parse(t,n.url)}))}const p=Object.assign({uri:i(n.url),statusCode:l},t.headers);if(!t.status){if(c.isCancel(t))return a&&a("canceled"),void(u&&u(null,"canceled",p));if(r({err:"socket",body:d,headers:p}),s&&s(new Error(`error happened in your connection. Reason: ${t.message}`)),u){const e=new Error(`error happened in your connection. Reason: ${t.message}`);e.scope="socket",e.errid="request",u(e)}return}if(delete p.server,delete p["content-length"],l>=200&&l<400)return r({err:null,body:d,headers:p}),a&&a(d),void(u&&u(null,d,p));"string"==typeof d&&(d={message:d}),d.message||!d.reason&&!d.error||(d.message=d.reason||d.error),delete d.stack,f(n),r({err:"couch",body:d,headers:p});const h=d.message||"couch returned "+l,y=new Error(h);y.scope="couch",y.statusCode=l,y.request=n,y.headers=p,y.errid="non_200",y.name="Error",y.description=h,delete d.message,Object.assign(y,d),s&&s(y),u&&u(y)};function _(t,n){"function"==typeof t&&(n=t,t={path:""}),"string"==typeof t&&(t={path:t}),t||(t={path:""},n=null);const o=Object.assign({},t.qs),i={"content-type":"application/json",accept:"application/json","user-agent":`${l.name}/${l.version} (Node.js ${process.version})`,"Accept-Encoding":"deflate, gzip"},a=Object.assign({method:t.method||"GET",headers:i,uri:e.url},{...e.requestDefaults,headers:Object.assign(i,e.requestDefaults&&e.requestDefaults.headers?e.requestDefaults.headers:{})}),h=t.jar||e.jar||e.requestDefaults&&e.requestDefaults.jar;if(t.signal&&(a.signal=t.signal),h&&(a.withCredentials=!0),t.db&&(a.uri=E(a.uri,encodeURIComponent(t.db))),t.multipart){const e=new b(t.multipart);t.contentType=e.header,a.body=e.data}var y;a.headers=Object.assign(a.headers,t.headers,e.defaultHeaders),t.path?a.uri+="/"+t.path:t.doc&&(/^_design|_local/.test(t.doc)?a.uri+="/"+t.doc:a.uri+="/"+encodeURIComponent(t.doc),t.att&&(a.uri+="/"+t.att)),void 0!==t.encoding&&(a.encoding=t.encoding,delete a.headers["content-type"],delete a.headers.accept),t.contentType&&(a.headers["content-type"]=t.contentType,delete a.headers.accept),t.accept&&(a.headers.accept=t.accept),e.cookie&&(a.headers["X-CouchDB-WWW-Authenticate"]="Cookie",a.headers.cookie=e.cookie),"object"==typeof t.qs&&null!=(y=t.qs)&&(Object.keys(y)||y).length&&(["startkey","endkey","key","keys","start_key","end_key"].forEach((function(e){e in t.qs&&(o[e]=JSON.stringify(t.qs[e]))})),a.qs=o);const g=e.cookieJar.getCookieString(a.uri);g&&(a.headers.cookie=g),t.body&&(Buffer.isBuffer(t.body)||t.dontStringify?a.body=t.body:a.body=JSON.stringify(t.body,(function(e,t){return"function"==typeof t?t.toString():t}))),t.form&&(a.headers["content-type"]="application/x-www-form-urlencoded; charset=utf-8",a.body=s.stringify(t.form).toString("utf8")),a.qsStringifyOptions={arrayFormat:"repeat"},a.url=a.uri,delete a.uri,a.method=a.method.toLowerCase(),a.params=a.qs,delete a.qs,a.paramsSerializer={serialize:e=>s.stringify(e,{arrayFormat:"brackets"})},a.data=a.body,delete a.body,a.maxRedirects=0,t.stream?a.responseType="stream":t.dontParse&&(a.responseType="arraybuffer");const m={method:a.method,headers:JSON.parse(JSON.stringify(a.headers)),url:a.url};f(m,!0),r(m),a.httpAgent=e.requestDefaults.agent||d,a.httpsAgent=e.requestDefaults.agent||p;const v=c.create({httpAgent:a.httpAgent,httpsAgent:a.httpsAgent});if(t.stream){const e=new u.PassThrough;return v(a).then((t=>{t.data.pipe(e)})).catch((t=>{!function(e,t,n){const o=e.status||e.response&&e.response.status||500;e.isAxiosError&&e.response&&(e=e.response);const i=e.statusText;f(t);const a=Object.assign({uri:t.url,statusCode:o},e.headers),s=new Error(i);s.scope="couch",s.statusCode=o,s.request=t,s.headers=a,s.errid="non_200",s.name="Error",s.description=i,s.reason=i,r({err:"couch",body:i,headers:a}),n.emit("error",s)}(t,a,e)})),e}if("function"!=typeof n)return new Promise(((e,t)=>{v(a).then((r=>{O(r,a,0,e,t)})).catch((r=>{O(r,a,0,e,t)}))}));v(a).then((e=>{O(e,a,0,null,null,n)})).catch((e=>{O(e,a,0,null,null,n)}))}function R(e,t,r){return _({method:"POST",db:"_session",form:{name:e,password:t}},r)}function S(e){return _({db:"_session"},e)}function A(e,t){const{opts:r,callback:n}=m(e,t);return _({db:"_db_updates",qs:r},n)}function P(e,t){return v(e)?w(t):_({db:e},t)}function j(e,t,r){return"function"==typeof t&&(r=t,t=null),v(e)?w(r):_({db:e,doc:"_compact",att:t,method:"POST"},r)}function T(e,t,r){const{opts:n,callback:o}=m(t,r);return v(e)?w(o):_({db:e,path:"_changes",qs:n},o)}function M(t){if("object"==typeof t&&t.config&&t.config.url&&t.config.db)return E(t.config.url,encodeURIComponent(t.config.db));try{return new n(t).toString()}catch(r){return E(e.url,encodeURIComponent(t))}}function D(e,t,r,n){const{opts:o,callback:i}=m(r,n);return v(e,t)?w(i):(o.source=M(e),o.target=M(t),_({db:"_replicate",body:o,method:"POST"},i))}function C(e,t,r,n){const{opts:o,callback:i}=m(r,n);return v(e,t)?w(i):(o.source=M(e),o.target=M(t),_({db:"_replicator",body:o,method:"POST"},i))}function x(e,t,r){const{opts:n,callback:o}=m(t,r);return v(e)?w(o):_({db:"_replicator",method:"GET",path:e,qs:n},o)}function I(e,t,r,n){const{opts:o,callback:i}=m(r,n);return v(e,t)?w(i):_({db:"_replicator",method:"DELETE",path:e,qs:Object.assign(o,{rev:t})},i)}function L(r){let n={};function o(e,t,n,o,i){const{opts:a,callback:s}=m(o,i);if(v(e,t)&&!n.viewPath)return w(s);"boolean"!=typeof n.stream&&(n.stream=!1);const c=Object.assign({},a),u=n.viewPath||"_design/"+e+"/_"+n.type+"/"+t;if("search"===n.type)return _({db:r,path:u,method:"POST",body:c,stream:n.stream},s);if(c&&c.keys){const e={keys:c.keys};return delete c.keys,_({db:r,path:u,method:"POST",qs:c,body:e,stream:n.stream},s)}if(c&&c.queries){const e={queries:c.queries};return delete c.queries,_({db:r,path:u,method:"POST",qs:c,body:e},s)}{const e={db:r,method:n.method||"GET",path:u,qs:c,stream:n.stream};return n.body&&(e.body=n.body),_(e,s)}}function i(e,t,r,n,i){return"function"==typeof n&&(i=n,n=void 0),v(e,t,r)?w(i):o(e,t+"/"+encodeURIComponent(r),{type:"update",method:"PUT",body:n},i)}return r=decodeURIComponent(r),n={info:function(e){return P(r,e)},replicate:function(e,t,n){return D(r,e,t,n)},compact:function(e){return j(r,e)},changes:function(e,t){return T(r,e,t)},changesAsStream:function(e){return function(e,t){return _({db:e,path:"_changes",stream:!0,qs:t})}(r,e)},changesReader:new y(r,_),auth:R,session:S,insert:function(e,t,n){const o={db:r,body:e,method:"POST"};let{opts:i,callback:a}=m(t,n);return"string"==typeof i&&(i={docName:i}),i&&(i.docName&&(o.doc=i.docName,o.method="PUT",delete i.docName),o.qs=i),_(o,a)},get:function(e,t,n){const{opts:o,callback:i}=m(t,n);return v(e)?w(i):_({db:r,doc:e,qs:o},i)},head:function(e,t){return v(e)?w(t):t?void _({db:r,doc:e,method:"HEAD",qs:{}},t):new Promise((function(t,n){_({db:r,doc:e,method:"HEAD",qs:{}},(function(e,r,o){e?n(e):t(o)}))}))},destroy:function(e,t,n){return v(e)?w(n):_({db:r,doc:e,method:"DELETE",qs:{rev:t}},n)},bulk:function(e,t,n){const{opts:o,callback:i}=m(t,n);return _({db:r,path:"_bulk_docs",body:e,method:"POST",qs:o},i)},list:function(e,t){const{opts:n,callback:o}=m(e,t);return _({db:r,path:"_all_docs",qs:n},o)},listAsStream:function(e){return _({db:r,path:"_all_docs",qs:e,stream:!0})},fetch:function(e,t,n){const{opts:o,callback:i}=m(t,n);return o.include_docs=!0,!v(e)&&"object"==typeof e&&e.keys&&Array.isArray(e.keys)&&0!==e.keys.length?_({db:r,path:"_all_docs",method:"POST",qs:o,body:e},i):w(i)},fetchRevs:function(e,t,n){const{opts:o,callback:i}=m(t,n);return!v(e)&&"object"==typeof e&&e.keys&&Array.isArray(e.keys)&&0!==e.keys.length?_({db:r,path:"_all_docs",method:"POST",qs:o,body:e},i):w(i)},config:{url:e.url,db:r},multipart:{insert:function(e,t,n,o){"string"==typeof n&&(n={docName:n});const i=(n=n||{}).docName;if(delete n.docName,v(e,t,i))return w(o);e=Object.assign({_attachments:{}},e);const a=[];return t.forEach((function(t){e._attachments[t.name]={follows:!0,length:Buffer.isBuffer(t.data)?t.data.length:Buffer.byteLength(t.data),content_type:t.content_type},a.push(t)})),a.unshift({content_type:"application/json",data:JSON.stringify(e),name:"document"}),_({db:r,method:"PUT",contentType:"multipart/related",doc:i,qs:n,multipart:a},o)},get:function(e,t,n){const{opts:o,callback:i}=m(t,n);return o.attachments=!0,v(e)?w(i):_({db:r,doc:e,encoding:null,accept:"multipart/related",qs:o},i)}},attachment:{insert:function(e,t,n,o,i,a){const{opts:s,callback:c}=m(i,a);return v(e,t,n,o)?w(c):_({db:r,att:t,method:"PUT",contentType:o,doc:e,qs:s,body:n,dontStringify:!0},c)},get:function(e,t,n,o){const{opts:i,callback:a}=m(n,o);return v(e,t)?w(a):_({db:r,att:t,doc:e,qs:i,encoding:null,dontParse:!0},a)},getAsStream:function(e,t,n){return _({db:r,att:t,doc:e,qs:n,stream:!0,encoding:null,dontParse:!0})},destroy:function(e,t,n,o){return v(e,t)?w(o):_({db:r,att:t,method:"DELETE",doc:e,qs:n},o)}},show:function(e,t,r,n,i){return v(e,t,r)?w(i):o(e,t+"/"+r,{type:"show"},n,i)},atomic:i,updateWithHandler:i,baseView:o,search:function(e,t,r,n){return o(e,t,{type:"search"},r,n)},searchAsStream:function(e,t,r){return o(e,t,{type:"search",stream:!0},r)},view:function(e,t,r,n){return o(e,t,{type:"view"},r,n)},viewAsStream:function(e,t,r){return o(e,t,{type:"view",stream:!0},r)},find:function(e,t){return v(e)||"object"!=typeof e?w(t):_({db:r,path:"_find",method:"POST",body:e},t)},findAsStream:function(e){return _({db:r,path:"_find",method:"POST",body:e,stream:!0})},createIndex:function(e,t){return v(e)||"object"!=typeof e?w(t):_({db:r,path:"_index",method:"POST",body:e},t)},viewWithList:function(e,t,r,n,i){return o(e,r+"/"+t,{type:"list"},n,i)},viewWithListAsStream:function(e,t,r,n,i){return o(e,r+"/"+t,{type:"list",stream:!0},n,i)},server:t,replication:{enable:function(e,t,n){return C(r,e,t,n)},disable:function(e,t,r,n){return I(e,t,r,n)},query:function(e,t,r){return x(e,t,r)}},partitionInfo:function(e,t){return v(e)?w(t):_({db:r,path:"_partition/"+encodeURIComponent(e)},t)},partitionedList:function(e,t,n){const{opts:o,callback:i}=m(t,n);return v(e)?w(i):_({db:r,path:"_partition/"+encodeURIComponent(e)+"/_all_docs",qs:o},i)},partitionedListAsStream:function(e,t){return _({db:r,path:"_partition/"+encodeURIComponent(e)+"/_all_docs",qs:t,stream:!0})},partitionedFind:function(e,t,n){return v(e,t)||"object"!=typeof t?w(n):_({db:r,path:"_partition/"+encodeURIComponent(e)+"/_find",method:"POST",body:t},n)},partitionedFindAsStream:function(e,t){return _({db:r,path:"_partition/"+encodeURIComponent(e)+"/_find",method:"POST",body:t,stream:!0})},partitionedSearch:function(e,t,n,o,i){return v(e,t,n,o)||"object"!=typeof o?w(i):_({db:r,path:"_partition/"+encodeURIComponent(e)+"/_design/"+t+"/_search/"+n,qs:o},i)},partitionedSearchAsStream:function(e,t,n,o){return _({db:r,path:"_partition/"+encodeURIComponent(e)+"/_design/"+t+"/_search/"+n,qs:o,stream:!0})},partitionedView:function(e,t,n,o,i){return v(e,t,n)?w(i):_({db:r,path:"_partition/"+encodeURIComponent(e)+"/_design/"+t+"/_view/"+n,qs:o},i)},partitionedViewAsStream:function(e,t,n,o){return _({db:r,path:"_partition/"+encodeURIComponent(e)+"/_design/"+t+"/_view/"+n,qs:o,stream:!0})}},n.view.compact=function(e,t){return j(r,e,t)},n}t=Object.assign(t,{db:{create:function(e,t,r){const{opts:n,callback:o}=m(t,r);return v(e)?w(o):_({db:e,method:"PUT",qs:n},o)},get:P,destroy:function(e,t){return v(e)?w(t):_({db:e,method:"DELETE"},t)},list:function(e){return _({db:"_all_dbs"},e)},listAsStream:function(){return _({db:"_all_dbs",stream:!0})},use:L,scope:L,compact:j,replicate:D,replication:{enable:C,disable:I,query:x},changes:T,updates:A},use:L,scope:L,request:_,relax:_,dinosaur:_,auth:R,session:S,updates:A,uuids:function(e,t){return"function"==typeof e&&(t=e,e=1),_({method:"GET",path:"_uuids",qs:{count:e=e||1}},t)},info:function(e){return _({path:""},e)}});const N=function(){if(!o)return;const t=new n(e.url),r=t.pathname.split("/").filter((function(e){return e})).pop(),i=t.pathname.replace(/\/?$/,"/..");return r?(e.url=E(e.url,i).replace(/\/?$/,""),r):void 0}();return N?L(N):t}},4441:e=>{"use strict";const t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;if(!t)throw new Error("Unable to find global scope. Are you sure this is running in the browser?");if(!t.AbortController)throw new Error('Could not find "AbortController" in the global scope. You need to polyfill it first');e.exports.z=t.AbortController},8859:(e,t,r)=>{var n="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=n&&o&&"function"==typeof o.get?o.get:null,a=n&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,c=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,u=s&&c&&"function"==typeof c.get?c.get:null,l=s&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,g=Function.prototype.toString,b=String.prototype.match,m=String.prototype.slice,v=String.prototype.replace,w=String.prototype.toUpperCase,E=String.prototype.toLowerCase,O=RegExp.prototype.test,_=Array.prototype.concat,R=Array.prototype.join,S=Array.prototype.slice,A=Math.floor,P="function"==typeof BigInt?BigInt.prototype.valueOf:null,j=Object.getOwnPropertySymbols,T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,M="function"==typeof Symbol&&"object"==typeof Symbol.iterator,D="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,C=Object.prototype.propertyIsEnumerable,x=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function I(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||O.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-A(-e):A(e);if(n!==e){var o=String(n),i=m.call(t,o.length+1);return v.call(o,r,"$&_")+"."+v.call(v.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(t,r,"$&_")}var L=r(2634),N=L.custom,k=q(N)?N:null;function B(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function U(e){return v.call(String(e),/"/g,""")}function F(e){return!("[object Array]"!==$(e)||D&&"object"==typeof e&&D in e)}function K(e){return!("[object RegExp]"!==$(e)||D&&"object"==typeof e&&D in e)}function q(e){if(M)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!T)return!1;try{return T.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,o,s){var c=n||{};if(H(c,"quoteStyle")&&"single"!==c.quoteStyle&&"double"!==c.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(c,"maxStringLength")&&("number"==typeof c.maxStringLength?c.maxStringLength<0&&c.maxStringLength!==1/0:null!==c.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var y=!H(c,"customInspect")||c.customInspect;if("boolean"!=typeof y&&"symbol"!==y)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(c,"indent")&&null!==c.indent&&"\t"!==c.indent&&!(parseInt(c.indent,10)===c.indent&&c.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(c,"numericSeparator")&&"boolean"!=typeof c.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var w=c.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return z(t,c);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var O=String(t);return w?I(t,O):O}if("bigint"==typeof t){var A=String(t)+"n";return w?I(t,A):A}var j=void 0===c.depth?5:c.depth;if(void 0===o&&(o=0),o>=j&&j>0&&"object"==typeof t)return F(t)?"[Array]":"[Object]";var N,V=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=R.call(Array(e.indent+1)," ")}return{base:r,prev:R.call(Array(t+1),r)}}(c,o);if(void 0===s)s=[];else if(G(s,t)>=0)return"[Circular]";function W(t,r,n){if(r&&(s=S.call(s)).push(r),n){var i={depth:c.depth};return H(c,"quoteStyle")&&(i.quoteStyle=c.quoteStyle),e(t,i,o+1,s)}return e(t,c,o+1,s)}if("function"==typeof t&&!K(t)){var ee=function(e){if(e.name)return e.name;var t=b.call(g.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),te=Z(t,W);return"[Function"+(ee?": "+ee:" (anonymous)")+"]"+(te.length>0?" { "+R.call(te,", ")+" }":"")}if(q(t)){var re=M?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):T.call(t);return"object"!=typeof t||M?re:Y(re)}if((N=t)&&"object"==typeof N&&("undefined"!=typeof HTMLElement&&N instanceof HTMLElement||"string"==typeof N.nodeName&&"function"==typeof N.getAttribute)){for(var ne="<"+E.call(String(t.nodeName)),oe=t.attributes||[],ie=0;ie<oe.length;ie++)ne+=" "+oe[ie].name+"="+B(U(oe[ie].value),"double",c);return ne+=">",t.childNodes&&t.childNodes.length&&(ne+="..."),ne+"</"+E.call(String(t.nodeName))+">"}if(F(t)){if(0===t.length)return"[]";var ae=Z(t,W);return V&&!function(e){for(var t=0;t<e.length;t++)if(G(e[t],"\n")>=0)return!1;return!0}(ae)?"["+X(ae,V)+"]":"[ "+R.call(ae,", ")+" ]"}if(function(e){return!("[object Error]"!==$(e)||D&&"object"==typeof e&&D in e)}(t)){var se=Z(t,W);return"cause"in Error.prototype||!("cause"in t)||C.call(t,"cause")?0===se.length?"["+String(t)+"]":"{ ["+String(t)+"] "+R.call(se,", ")+" }":"{ ["+String(t)+"] "+R.call(_.call("[cause]: "+W(t.cause),se),", ")+" }"}if("object"==typeof t&&y){if(k&&"function"==typeof t[k]&&L)return L(t,{depth:j-o});if("symbol"!==y&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{u.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ce=[];return a&&a.call(t,(function(e,r){ce.push(W(r,t,!0)+" => "+W(e,t))})),J("Map",i.call(t),ce,V)}if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{u.call(e);try{i.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ue=[];return l&&l.call(t,(function(e){ue.push(W(e,t))})),J("Set",u.call(t),ue,V)}if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return Q("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return Q("WeakSet");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{return p.call(e),!0}catch(e){}return!1}(t))return Q("WeakRef");if(function(e){return!("[object Number]"!==$(e)||D&&"object"==typeof e&&D in e)}(t))return Y(W(Number(t)));if(function(e){if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(e){}return!1}(t))return Y(W(P.call(t)));if(function(e){return!("[object Boolean]"!==$(e)||D&&"object"==typeof e&&D in e)}(t))return Y(h.call(t));if(function(e){return!("[object String]"!==$(e)||D&&"object"==typeof e&&D in e)}(t))return Y(W(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==r.g&&t===r.g)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==$(e)||D&&"object"==typeof e&&D in e)}(t)&&!K(t)){var le=Z(t,W),fe=x?x(t)===Object.prototype:t instanceof Object||t.constructor===Object,de=t instanceof Object?"":"null prototype",pe=!fe&&D&&Object(t)===t&&D in t?m.call($(t),8,-1):de?"Object":"",he=(fe||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(pe||de?"["+R.call(_.call([],pe||[],de||[]),": ")+"] ":"");return 0===le.length?he+"{}":V?he+"{"+X(le,V)+"}":he+"{ "+R.call(le,", ")+" }"}return String(t)};var V=Object.prototype.hasOwnProperty||function(e){return e in this};function H(e,t){return V.call(e,t)}function $(e){return y.call(e)}function G(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function z(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return z(m.call(e,0,t.maxStringLength),t)+n}return B(v.call(v.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,W),"single",t)}function W(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+w.call(t.toString(16))}function Y(e){return"Object("+e+")"}function Q(e){return e+" { ? }"}function J(e,t,r,n){return e+" ("+t+") {"+(n?X(r,n):R.call(r,", "))+"}"}function X(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+R.call(e,","+r)+"\n"+t.prev}function Z(e,t){var r=F(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=H(e,o)?t(e[o],e):""}var i,a="function"==typeof j?j(e):[];if(M){i={};for(var s=0;s<a.length;s++)i["$"+a[s]]=a[s]}for(var c in e)H(e,c)&&(r&&String(Number(c))===c&&c<e.length||M&&i["$"+c]instanceof Symbol||(O.call(/[^\w$]/,c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if("function"==typeof j)for(var u=0;u<a.length;u++)C.call(e,a[u])&&n.push("["+t(a[u])+"]: "+t(e[a[u]],e));return n}},4765:e=>{"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC3986";e.exports={default:n,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:n}},5373:(e,t,r)=>{"use strict";var n=r(8636),o=r(2642),i=r(4765);e.exports={formats:i,parse:o,stringify:n}},2642:(e,t,r)=>{"use strict";var n=r(7720),o=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},s=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},u=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,s=r.depth>0&&/(\[[^[\]]*])/.exec(i),u=s?i.slice(0,s.index):i,l=[];if(u){if(!r.plainObjects&&o.call(Object.prototype,u)&&!r.allowPrototypes)return;l.push(u)}for(var f=0;r.depth>0&&null!==(s=a.exec(i))&&f<r.depth;){if(f+=1,!r.plainObjects&&o.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(s[1])}if(s){if(!0===r.strictDepth)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");l.push("["+i.slice(s.index)+"]")}return function(e,t,r,n){for(var o=n?t:c(t,r),i=e.length-1;i>=0;--i){var a,s=e[i];if("[]"===s&&r.parseArrays)a=r.allowEmptyArrays&&(""===o||r.strictNullHandling&&null===o)?[]:[].concat(o);else{a=r.plainObjects?Object.create(null):{};var u="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,f=parseInt(l,10);r.parseArrays||""!==l?!isNaN(f)&&s!==l&&String(f)===l&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(a=[])[f]=o:"__proto__"!==l&&(a[l]=o):a={0:o}}o=a}return o}(l,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return a;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?a.charset:e.charset,r=void 0===e.duplicates?a.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||a.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:a.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:a.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:a.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:a.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:a.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:a.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var r={__proto__:null},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;u=u.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var l,f=t.parameterLimit===1/0?void 0:t.parameterLimit,d=u.split(t.delimiter,f),p=-1,h=t.charset;if(t.charsetSentinel)for(l=0;l<d.length;++l)0===d[l].indexOf("utf8=")&&("utf8=%E2%9C%93"===d[l]?h="utf-8":"utf8=%26%2310003%3B"===d[l]&&(h="iso-8859-1"),p=l,l=d.length);for(l=0;l<d.length;++l)if(l!==p){var y,g,b=d[l],m=b.indexOf("]="),v=-1===m?b.indexOf("="):m+1;-1===v?(y=t.decoder(b,a.decoder,h,"key"),g=t.strictNullHandling?null:""):(y=t.decoder(b.slice(0,v),a.decoder,h,"key"),g=n.maybeMap(c(b.slice(v+1),t),(function(e){return t.decoder(e,a.decoder,h,"value")}))),g&&t.interpretNumericEntities&&"iso-8859-1"===h&&(g=s(g)),b.indexOf("[]=")>-1&&(g=i(g)?[g]:g);var w=o.call(r,y);w&&"combine"===t.duplicates?r[y]=n.combine(r[y],g):w&&"last"!==t.duplicates||(r[y]=g)}return r}(e,r):e,f=r.plainObjects?Object.create(null):{},d=Object.keys(l),p=0;p<d.length;++p){var h=d[p],y=u(h,l[h],r,"string"==typeof e);f=n.merge(f,y,r)}return!0===r.allowSparse?f:n.compact(f)}},8636:(e,t,r)=>{"use strict";var n=r(920),o=r(7720),i=r(4765),a=Object.prototype.hasOwnProperty,s={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},c=Array.isArray,u=Array.prototype.push,l=function(e,t){u.apply(e,c(t)?t:[t])},f=Date.prototype.toISOString,d=i.default,p={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:o.encode,encodeValuesOnly:!1,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return f.call(e)},skipNulls:!1,strictNullHandling:!1},h={},y=function e(t,r,i,a,s,u,f,d,y,g,b,m,v,w,E,O,_,R){for(var S,A=t,P=R,j=0,T=!1;void 0!==(P=P.get(h))&&!T;){var M=P.get(t);if(j+=1,void 0!==M){if(M===j)throw new RangeError("Cyclic object value");T=!0}void 0===P.get(h)&&(j=0)}if("function"==typeof g?A=g(r,A):A instanceof Date?A=v(A):"comma"===i&&c(A)&&(A=o.maybeMap(A,(function(e){return e instanceof Date?v(e):e}))),null===A){if(u)return y&&!O?y(r,p.encoder,_,"key",w):r;A=""}if("string"==typeof(S=A)||"number"==typeof S||"boolean"==typeof S||"symbol"==typeof S||"bigint"==typeof S||o.isBuffer(A))return y?[E(O?r:y(r,p.encoder,_,"key",w))+"="+E(y(A,p.encoder,_,"value",w))]:[E(r)+"="+E(String(A))];var D,C=[];if(void 0===A)return C;if("comma"===i&&c(A))O&&y&&(A=o.maybeMap(A,y)),D=[{value:A.length>0?A.join(",")||null:void 0}];else if(c(g))D=g;else{var x=Object.keys(A);D=b?x.sort(b):x}var I=d?r.replace(/\./g,"%2E"):r,L=a&&c(A)&&1===A.length?I+"[]":I;if(s&&c(A)&&0===A.length)return L+"[]";for(var N=0;N<D.length;++N){var k=D[N],B="object"==typeof k&&void 0!==k.value?k.value:A[k];if(!f||null!==B){var U=m&&d?k.replace(/\./g,"%2E"):k,F=c(A)?"function"==typeof i?i(L,U):L:L+(m?"."+U:"["+U+"]");R.set(t,j);var K=n();K.set(h,R),l(C,e(B,F,i,a,s,u,f,d,"comma"===i&&O&&c(A)?null:y,g,b,m,v,w,E,O,_,K))}}return C};e.exports=function(e,t){var r,o=e,u=function(e){if(!e)return p;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||p.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=i.default;if(void 0!==e.format){if(!a.call(i.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n,o=i.formatters[r],u=p.filter;if(("function"==typeof e.filter||c(e.filter))&&(u=e.filter),n=e.arrayFormat in s?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":p.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=void 0===e.allowDots?!0===e.encodeDotInKeys||p.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:p.addQueryPrefix,allowDots:l,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:p.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:p.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:void 0===e.delimiter?p.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:p.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:p.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:p.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:p.encodeValuesOnly,filter:u,format:r,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:p.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:p.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:p.strictNullHandling}}(t);"function"==typeof u.filter?o=(0,u.filter)("",o):c(u.filter)&&(r=u.filter);var f=[];if("object"!=typeof o||null===o)return"";var d=s[u.arrayFormat],h="comma"===d&&u.commaRoundTrip;r||(r=Object.keys(o)),u.sort&&r.sort(u.sort);for(var g=n(),b=0;b<r.length;++b){var m=r[b];u.skipNulls&&null===o[m]||l(f,y(o[m],m,d,h,u.allowEmptyArrays,u.strictNullHandling,u.skipNulls,u.encodeDotInKeys,u.encode?u.encoder:null,u.filter,u.sort,u.allowDots,u.serializeDate,u.format,u.formatter,u.encodeValuesOnly,u.charset,g))}var v=f.join(u.delimiter),w=!0===u.addQueryPrefix?"?":"";return u.charsetSentinel&&("iso-8859-1"===u.charset?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),v.length>0?w+v:""}},7720:(e,t,r)=>{"use strict";var n=r(4765),o=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),s=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},c=1024;e.exports={arrayToObject:s,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var o=t[n],a=o.obj[o.prop],s=Object.keys(a),c=0;c<s.length;++c){var u=s[c],l=a[u];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:a,prop:u}),r.push(l))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,o,i){if(0===e.length)return e;var s=e;if("symbol"==typeof e?s=Symbol.prototype.toString.call(e):"string"!=typeof e&&(s=String(e)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var u="",l=0;l<s.length;l+=c){for(var f=s.length>=c?s.slice(l,l+c):s,d=[],p=0;p<f.length;++p){var h=f.charCodeAt(p);45===h||46===h||95===h||126===h||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||i===n.RFC1738&&(40===h||41===h)?d[d.length]=f.charAt(p):h<128?d[d.length]=a[h]:h<2048?d[d.length]=a[192|h>>6]+a[128|63&h]:h<55296||h>=57344?d[d.length]=a[224|h>>12]+a[128|h>>6&63]+a[128|63&h]:(p+=1,h=65536+((1023&h)<<10|1023&f.charCodeAt(p)),d[d.length]=a[240|h>>18]+a[128|h>>12&63]+a[128|h>>6&63]+a[128|63&h])}u+=d.join("")}return u},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(i(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var a=t;return i(t)&&!i(r)&&(a=s(t,n)),i(t)&&i(r)?(r.forEach((function(r,i){if(o.call(t,i)){var a=t[i];a&&"object"==typeof a&&r&&"object"==typeof r?t[i]=e(a,r,n):t.push(r)}else t[i]=r})),t):Object.keys(r).reduce((function(t,i){var a=r[i];return o.call(t,i)?t[i]=e(t[i],a,n):t[i]=a,t}),a)}}},6897:(e,t,r)=>{"use strict";var n=r(453),o=r(41),i=r(8211)(),a=r(5795),s=r(9675),c=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&a){var l=a(e,"length");l&&!l.configurable&&(n=!1),l&&!l.writable&&(u=!1)}return(n||u||!r)&&(i?o(e,"length",t,!0,!0):o(e,"length",t)),e}},920:(e,t,r)=>{"use strict";var n=r(453),o=r(8075),i=r(8859),a=r(9675),s=n("%WeakMap%",!0),c=n("%Map%",!0),u=o("WeakMap.prototype.get",!0),l=o("WeakMap.prototype.set",!0),f=o("WeakMap.prototype.has",!0),d=o("Map.prototype.get",!0),p=o("Map.prototype.set",!0),h=o("Map.prototype.has",!0),y=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,n={assert:function(e){if(!n.has(e))throw new a("Side channel does not contain "+i(e))},get:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return u(e,n)}else if(c){if(t)return d(t,n)}else if(r)return function(e,t){var r=y(e,t);return r&&r.value}(r,n)},has:function(n){if(s&&n&&("object"==typeof n||"function"==typeof n)){if(e)return f(e,n)}else if(c){if(t)return h(t,n)}else if(r)return function(e,t){return!!y(e,t)}(r,n);return!1},set:function(n,o){s&&n&&("object"==typeof n||"function"==typeof n)?(e||(e=new s),l(e,n,o)):c?(t||(t=new c),p(t,n,o)):(r||(r={key:{},next:null}),function(e,t,r){var n=y(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,n,o))}};return n}},1568:(e,t,r)=>{var n=r(7918),o=r(6917),i=r(7510),a=r(6866),s=r(8835),c=t;c.request=function(e,t){e="string"==typeof e?s.parse(e):i(e);var o=-1===r.g.location.protocol.search(/^https?:$/)?"http:":"",a=e.protocol||o,c=e.hostname||e.host,u=e.port,l=e.path||"/";c&&-1!==c.indexOf(":")&&(c="["+c+"]"),e.url=(c?a+"//"+c:"")+(u?":"+u:"")+l,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var f=new n(e);return t&&f.on("response",t),f},c.get=function(e,t){var r=c.request(e,t);return r.end(),r},c.ClientRequest=n,c.IncomingMessage=o.IncomingMessage,c.Agent=function(){},c.Agent.defaultMaxSockets=4,c.globalAgent=new c.Agent,c.STATUS_CODES=a,c.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]},6688:(e,t,r)=>{var n;function o(){if(void 0!==n)return n;if(r.g.XMLHttpRequest){n=new r.g.XMLHttpRequest;try{n.open("GET",r.g.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function i(e){var t=o();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function a(e){return"function"==typeof e}t.fetch=a(r.g.fetch)&&a(r.g.ReadableStream),t.writableStream=a(r.g.WritableStream),t.abortController=a(r.g.AbortController),t.arraybuffer=t.fetch||i("arraybuffer"),t.msstream=!t.fetch&&i("ms-stream"),t.mozchunkedarraybuffer=!t.fetch&&i("moz-chunked-arraybuffer"),t.overrideMimeType=t.fetch||!!o()&&a(o().overrideMimeType),n=null},7918:(e,t,r)=>{var n=r(6688),o=r(6698),i=r(6917),a=r(3242),s=i.IncomingMessage,c=i.readyStates,u=e.exports=function(e){var t,r=this;a.Writable.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+Buffer.from(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var o=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!n.abortController)o=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!n.overrideMimeType;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return n.fetch&&t?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&e?"arraybuffer":"text"}(t,o),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",(function(){r._onFinish()}))};o(u,a.Writable),u.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===l.indexOf(r)&&(this._headers[r]={name:e,value:t})},u.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},u.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},u.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t=e._opts;"timeout"in t&&0!==t.timeout&&e.setTimeout(t.timeout);var o=e._headers,i=null;"GET"!==t.method&&"HEAD"!==t.method&&(i=new Blob(e._body,{type:(o["content-type"]||{}).value||""}));var a=[];if(Object.keys(o).forEach((function(e){var t=o[e].name,r=o[e].value;Array.isArray(r)?r.forEach((function(e){a.push([t,e])})):a.push([t,r])})),"fetch"===e._mode){var s=null;if(n.abortController){var u=new AbortController;s=u.signal,e._fetchAbortController=u,"requestTimeout"in t&&0!==t.requestTimeout&&(e._fetchTimer=r.g.setTimeout((function(){e.emit("requestTimeout"),e._fetchAbortController&&e._fetchAbortController.abort()}),t.requestTimeout))}r.g.fetch(e._opts.url,{method:e._opts.method,headers:a,body:i||void 0,mode:"cors",credentials:t.withCredentials?"include":"same-origin",signal:s}).then((function(t){e._fetchResponse=t,e._resetTimers(!1),e._connect()}),(function(t){e._resetTimers(!0),e._destroyed||e.emit("error",t)}))}else{var l=e._xhr=new r.g.XMLHttpRequest;try{l.open(e._opts.method,e._opts.url,!0)}catch(t){return void process.nextTick((function(){e.emit("error",t)}))}"responseType"in l&&(l.responseType=e._mode),"withCredentials"in l&&(l.withCredentials=!!t.withCredentials),"text"===e._mode&&"overrideMimeType"in l&&l.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in t&&(l.timeout=t.requestTimeout,l.ontimeout=function(){e.emit("requestTimeout")}),a.forEach((function(e){l.setRequestHeader(e[0],e[1])})),e._response=null,l.onreadystatechange=function(){switch(l.readyState){case c.LOADING:case c.DONE:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(l.onprogress=function(){e._onXHRProgress()}),l.onerror=function(){e._destroyed||(e._resetTimers(!0),e.emit("error",new Error("XHR error")))};try{l.send(i)}catch(t){return void process.nextTick((function(){e.emit("error",t)}))}}}},u.prototype._onXHRProgress=function(){var e=this;e._resetTimers(!1),function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}}(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress(e._resetTimers.bind(e)))},u.prototype._connect=function(){var e=this;e._destroyed||(e._response=new s(e._xhr,e._fetchResponse,e._mode,e._resetTimers.bind(e)),e._response.on("error",(function(t){e.emit("error",t)})),e.emit("response",e._response))},u.prototype._write=function(e,t,r){this._body.push(e),r()},u.prototype._resetTimers=function(e){var t=this;r.g.clearTimeout(t._socketTimer),t._socketTimer=null,e?(r.g.clearTimeout(t._fetchTimer),t._fetchTimer=null):t._socketTimeout&&(t._socketTimer=r.g.setTimeout((function(){t.emit("timeout")}),t._socketTimeout))},u.prototype.abort=u.prototype.destroy=function(e){var t=this;t._destroyed=!0,t._resetTimers(!0),t._response&&(t._response._destroyed=!0),t._xhr?t._xhr.abort():t._fetchAbortController&&t._fetchAbortController.abort(),e&&t.emit("error",e)},u.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),a.Writable.prototype.end.call(this,e,t,r)},u.prototype.setTimeout=function(e,t){var r=this;t&&r.once("timeout",t),r._socketTimeout=e,r._resetTimers(!1)},u.prototype.flushHeaders=function(){},u.prototype.setNoDelay=function(){},u.prototype.setSocketKeepAlive=function(){};var l=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]},6917:(e,t,r)=>{var n=r(6688),o=r(6698),i=r(3242),a=t.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},s=t.IncomingMessage=function(e,t,r,o){var a=this;if(i.Readable.call(a),a._mode=r,a.headers={},a.rawHeaders=[],a.trailers={},a.rawTrailers=[],a.on("end",(function(){process.nextTick((function(){a.emit("close")}))})),"fetch"===r){if(a._fetchResponse=t,a.url=t.url,a.statusCode=t.status,a.statusMessage=t.statusText,t.headers.forEach((function(e,t){a.headers[t.toLowerCase()]=e,a.rawHeaders.push(t,e)})),n.writableStream){var s=new WritableStream({write:function(e){return o(!1),new Promise((function(t,r){a._destroyed?r():a.push(Buffer.from(e))?t():a._resumeFetch=t}))},close:function(){o(!0),a._destroyed||a.push(null)},abort:function(e){o(!0),a._destroyed||a.emit("error",e)}});try{return void t.body.pipeTo(s).catch((function(e){o(!0),a._destroyed||a.emit("error",e)}))}catch(e){}}var c=t.body.getReader();!function e(){c.read().then((function(t){a._destroyed||(o(t.done),t.done?a.push(null):(a.push(Buffer.from(t.value)),e()))})).catch((function(e){o(!0),a._destroyed||a.emit("error",e)}))}()}else if(a._xhr=e,a._pos=0,a.url=e.responseURL,a.statusCode=e.status,a.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===a.headers[r]&&(a.headers[r]=[]),a.headers[r].push(t[2])):void 0!==a.headers[r]?a.headers[r]+=", "+t[2]:a.headers[r]=t[2],a.rawHeaders.push(t[1],t[2])}})),a._charset="x-user-defined",!n.overrideMimeType){var u=a.rawHeaders["mime-type"];if(u){var l=u.match(/;\s*charset=([^;])(;|$)/);l&&(a._charset=l[1].toLowerCase())}a._charset||(a._charset="utf-8")}};o(s,i.Readable),s.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},s.prototype._onXHRProgress=function(e){var t=this,n=t._xhr,o=null;switch(t._mode){case"text":if((o=n.responseText).length>t._pos){var i=o.substr(t._pos);if("x-user-defined"===t._charset){for(var s=Buffer.alloc(i.length),c=0;c<i.length;c++)s[c]=255&i.charCodeAt(c);t.push(s)}else t.push(i,t._charset);t._pos=o.length}break;case"arraybuffer":if(n.readyState!==a.DONE||!n.response)break;o=n.response,t.push(Buffer.from(new Uint8Array(o)));break;case"moz-chunked-arraybuffer":if(o=n.response,n.readyState!==a.LOADING||!o)break;t.push(Buffer.from(new Uint8Array(o)));break;case"ms-stream":if(o=n.response,n.readyState!==a.LOADING)break;var u=new r.g.MSStreamReader;u.onprogress=function(){u.result.byteLength>t._pos&&(t.push(Buffer.from(new Uint8Array(u.result.slice(t._pos)))),t._pos=u.result.byteLength)},u.onload=function(){e(!0),t.push(null)},u.readAsArrayBuffer(o)}t._xhr.readyState===a.DONE&&"ms-stream"!==t._mode&&(e(!0),t.push(null))}},3157:e=>{"use strict";var t={};function r(e,r,n){n||(n=Error);var o=function(e){var t,n;function o(t,n,o){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,o))||this}return n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,o}(n);o.prototype.name=n.name,o.prototype.code=e,t[e]=o}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var o,i,a,s,c;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))a="The ".concat(e," ").concat(o," ").concat(n(t,"type"));else{var u=("number"!=typeof c&&(c=0),c+1>(s=e).length||-1===s.indexOf(".",c)?"argument":"property");a='The "'.concat(e,'" ').concat(u," ").concat(o," ").concat(n(t,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},3527:(e,t,r)=>{"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=u;var o=r(2341),i=r(9573);r(6698)(u,o);for(var a=n(i.prototype),s=0;s<a.length;s++){var c=a[s];u.prototype[c]||(u.prototype[c]=i.prototype[c])}function u(e){if(!(this instanceof u))return new u(e);o.call(this,e),i.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||process.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},2571:(e,t,r)=>{"use strict";e.exports=o;var n=r(5689);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}r(6698)(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},2341:(e,t,r)=>{"use strict";var n;e.exports=R,R.ReadableState=_,r(7007).EventEmitter;var o,i=function(e,t){return e.listeners(t).length},a=r(1914),s=r(8287).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},u=r(6833);o=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f,d,p=r(272),h=r(6057),y=r(1922).getHighWaterMark,g=r(3157).F,b=g.ERR_INVALID_ARG_TYPE,m=g.ERR_STREAM_PUSH_AFTER_EOF,v=g.ERR_METHOD_NOT_IMPLEMENTED,w=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(R,a);var E=h.errorOrDestroy,O=["error","close","destroy","pause","resume"];function _(e,t,o){n=n||r(3527),e=e||{},"boolean"!=typeof o&&(o=t instanceof n),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=y(this,e,"readableHighWaterMark",o),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(3141).I),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function R(e){if(n=n||r(3527),!(this instanceof R))return new R(e);var t=this instanceof n;this._readableState=new _(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function S(e,t,r,n,i){o("readableAddChunk",t);var a,u=e._readableState;if(null===t)u.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?T(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,M(e)))}}(e,u);else if(i||(a=function(e,t){var r,n;return n=t,s.isBuffer(n)||n instanceof c||"string"==typeof t||void 0===t||e.objectMode||(r=new b("chunk",["string","Buffer","Uint8Array"],t)),r}(u,t)),a)E(e,a);else if(u.objectMode||t&&t.length>0)if("string"==typeof t||u.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),n)u.endEmitted?E(e,new w):A(e,u,t,!0);else if(u.ended)E(e,new m);else{if(u.destroyed)return!1;u.reading=!1,u.decoder&&!r?(t=u.decoder.write(t),u.objectMode||0!==t.length?A(e,u,t,!1):D(e,u)):A(e,u,t,!1)}else n||(u.reading=!1,D(e,u));return!u.ended&&(u.length<u.highWaterMark||0===u.length)}function A(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&T(e)),D(e,t)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=h.destroy,R.prototype._undestroy=h.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=s.from(e,t),t=""),r=!0),S(this,e,t,!1,r)},R.prototype.unshift=function(e){return S(this,e,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){l||(l=r(3141).I);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,o="";null!==n;)o+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==o&&this._readableState.buffer.push(o),this._readableState.length=o.length,this};var P=1073741824;function j(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=P?e=P:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function T(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(M,e))}function M(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,N(e)}function D(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(C,e,t))}function C(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function x(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function I(e){o("readable nexttick read 0"),e.read(0)}function L(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),N(e),t.flowing&&!t.reading&&e.read(0)}function N(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function k(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function B(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(U,t,e))}function U(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}R.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?B(this):T(this),null;if(0===(e=j(e,t))&&t.ended)return 0===t.length&&B(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=j(r,t))),null===(n=e>0?k(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&B(this)),null!==n&&this.emit("data",n),n},R.prototype._read=function(e){E(this,new v("_read()"))},R.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,t);var a=t&&!1===t.end||e===process.stdout||e===process.stderr?h:s;function s(){o("onend"),e.end()}n.endEmitted?process.nextTick(a):r.once("end",a),e.on("unpipe",(function t(i,a){o("onunpipe"),i===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",f),e.removeListener("unpipe",t),r.removeListener("end",s),r.removeListener("end",h),r.removeListener("data",l),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}));var c=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,N(e))}}(r);e.on("drain",c);var u=!1;function l(t){o("ondata");var i=e.write(t);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==F(n.pipes,e))&&!u&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function f(t){o("onerror",t),h(),e.removeListener("error",f),0===i(e,"error")&&E(e,t)}function d(){e.removeListener("finish",p),h()}function p(){o("onfinish"),e.removeListener("close",d),h()}function h(){o("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),e},R.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<o;i++)n[i].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},R.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?T(this):n.reading||process.nextTick(I,this))),r},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(x,this),r},R.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(x,this),t},R.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(L,e,t))}(this,e)),e.paused=!1,this},R.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<O.length;a++)e.on(O[a],this.emit.bind(this,O[a]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(7356)),f(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),R._fromList=k,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(R.from=function(e,t){return void 0===d&&(d=r(6314)),d(R,e,t)})},5689:(e,t,r)=>{"use strict";e.exports=l;var n=r(3157).F,o=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,c=r(3527);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new i);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function l(e){if(!(this instanceof l))return new l(e);c.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",f)}function f(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(t,r){d(e,t,r)}))}function d(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(6698)(l,c),l.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},l.prototype._transform=function(e,t,r){r(new o("_transform()"))},l.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var o=this._readableState;(n.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},l.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},l.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},9573:(e,t,r)=>{"use strict";function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t){var r=e.entry;for(e.entry=null;r;){var n=r.callback;t.pendingcb--,n(undefined),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var o;e.exports=R,R.WritableState=_;var i,a={deprecate:r(4643)},s=r(1914),c=r(8287).Buffer,u=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(6057),f=r(1922).getHighWaterMark,d=r(3157).F,p=d.ERR_INVALID_ARG_TYPE,h=d.ERR_METHOD_NOT_IMPLEMENTED,y=d.ERR_MULTIPLE_CALLBACK,g=d.ERR_STREAM_CANNOT_PIPE,b=d.ERR_STREAM_DESTROYED,m=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function O(){}function _(e,t,i){o=o||r(3527),e=e||{},"boolean"!=typeof i&&(i=t instanceof o),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new y;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(process.nextTick(o,n),process.nextTick(M,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),M(e,t))}(e,r,n,t,o);else{var i=j(r)||e.destroyed;i||r.corked||r.bufferProcessing||!r.bufferedRequest||P(e,r),n?process.nextTick(A,e,r,i,o):A(e,r,i,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function R(e){var t=this instanceof(o=o||r(3527));if(!t&&!i.call(R,this))return new R(e);this._writableState=new _(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function S(e,t,r,n,o,i,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new b("write")):r?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function A(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),M(e,t)}function P(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var o=t.bufferedRequestCount,i=new Array(o),a=t.corkedRequestsFree;a.entry=r;for(var s=0,c=!0;r;)i[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;i.allBuffers=c,S(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,f=r.callback;if(S(e,t,!1,t.objectMode?1:u.length,u,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function j(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function T(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),M(e,t)}))}function M(e,t){var r=j(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(T,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(6698)(R,s),_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(_.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(e){return!!i.call(this,e)||this===R&&e&&e._writableState instanceof _}})):i=function(e){return e instanceof this},R.prototype.pipe=function(){E(this,new g)},R.prototype.write=function(e,t,r){var n,o=this._writableState,i=!1,a=!o.objectMode&&(n=e,c.isBuffer(n)||n instanceof u);return a&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=O),o.ending?function(e,t){var r=new v;E(e,r),process.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var o;return null===r?o=new m:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(E(e,o),process.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,i=function(e,t,r,n,o,i){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,r)),t}(t,n,o);n!==a&&(r=!0,o="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:o,isBuf:r,callback:i,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else S(e,t,!1,s,n,o,i);return u}(this,o,a,e,t,r)),i},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||P(this,e))},R.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(e,t,r){r(new h("_write()"))},R.prototype._writev=null,R.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,M(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),R.prototype.destroy=l.destroy,R.prototype._undestroy=l.undestroy,R.prototype._destroy=function(e,t){t(e)}},7356:(e,t,r)=>{"use strict";var n;function o(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=r(9959),a=Symbol("lastResolve"),s=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function h(e){var t=e[a];if(null!==t){var r=e[d].read();null!==r&&(e[l]=null,e[a]=null,e[s]=null,t(p(r,!1)))}}function y(e){process.nextTick(h,e)}var g=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[u])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){process.nextTick((function(){e[c]?r(e[c]):t(p(void 0,!0))}))}));var r,n=this[l];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[u]?r(p(void 0,!0)):t[f](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[f])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),g);e.exports=function(e){var t,r=Object.create(b,(o(t={},d,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,u,{value:e._readableState.endEmitted,writable:!0}),o(t,f,{value:function(e,t){var n=r[d].read();n?(r[l]=null,r[a]=null,r[s]=null,e(p(n,!1))):(r[a]=e,r[s]=t)},writable:!0}),t));return r[l]=null,i(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[s];return null!==t&&(r[l]=null,r[a]=null,r[s]=null,t(e)),void(r[c]=e)}var n=r[a];null!==n&&(r[l]=null,r[a]=null,r[s]=null,n(p(void 0,!0))),r[u]=!0})),e.on("readable",y.bind(null,r)),r}},272:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var c=r(8287).Buffer,u=r(9169).inspect,l=u&&u.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t,r,n,o=c.allocUnsafe(e>>>0),i=this.head,a=0;i;)t=i.data,r=o,n=a,c.prototype.copy.call(t,r,n),a+=i.data.length,i=i.next;return o}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var o=t.data,i=e>o.length?o.length:e;if(i===o.length?n+=o:n+=o.slice(0,e),0==(e-=i)){i===o.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=o.slice(i));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,i=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,i),0==(e-=i)){i===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(i));break}++n}return this.length-=n,t}},{key:l,value:function(e,t){return u(this,o(o({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},6057:e=>{"use strict";function t(e,t){n(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,o){var i=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,e)):process.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!o&&e?i._writableState?i._writableState.errorEmitted?process.nextTick(r,i):(i._writableState.errorEmitted=!0,process.nextTick(t,i,e)):process.nextTick(t,i,e):o?(process.nextTick(r,i),o(e)):process.nextTick(r,i)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},9959:(e,t,r)=>{"use strict";var n=r(3157).F.ERR_STREAM_PREMATURE_CLOSE;function o(){}e.exports=function e(t,r,i){if("function"==typeof r)return e(t,null,r);r||(r={}),i=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];e.apply(this,n)}}}(i||o);var a=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||l()},u=t._writableState&&t._writableState.finished,l=function(){s=!1,u=!0,a||i.call(t)},f=t._readableState&&t._readableState.endEmitted,d=function(){a=!1,f=!0,s||i.call(t)},p=function(e){i.call(t,e)},h=function(){var e;return a&&!f?(t._readableState&&t._readableState.ended||(e=new n),i.call(t,e)):s&&!u?(t._writableState&&t._writableState.ended||(e=new n),i.call(t,e)):void 0},y=function(){t.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",l),t.on("abort",h),t.req?y():t.on("request",y)):s&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",d),t.on("finish",l),!1!==r.error&&t.on("error",p),t.on("close",h),function(){t.removeListener("complete",l),t.removeListener("abort",h),t.removeListener("request",y),t.req&&t.req.removeListener("finish",l),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",l),t.removeListener("end",d),t.removeListener("error",p),t.removeListener("close",h)}}},6314:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},7413:(e,t,r)=>{"use strict";var n,o=r(3157).F,i=o.ERR_MISSING_ARGS,a=o.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function c(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var l,f=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new i("streams");var d=t.map((function(e,o){var i=o<t.length-1;return function(e,t,o,i){i=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(i);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(9959)),n(e,{readable:t,writable:o},(function(e){if(e)return i(e);s=!0,i()}));var c=!1;return function(t){if(!s&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void i(t||new a("pipe"))}}(e,i,o>0,(function(e){l||(l=e),e&&d.forEach(c),i||(d.forEach(c),f(l))}))}));return t.reduce(u)}},1922:(e,t,r)=>{"use strict";var n=r(3157).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,o){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,o,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new n(o?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}}},1914:(e,t,r)=>{e.exports=r(7007).EventEmitter},3242:(e,t,r)=>{(t=e.exports=r(2341)).Stream=t,t.Readable=t,t.Writable=r(9573),t.Duplex=r(3527),t.Transform=r(5689),t.PassThrough=r(2571),t.finished=r(9959),t.pipeline=r(7413)},3141:(e,t,r)=>{"use strict";var n=r(5003).Buffer,o=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=d,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.I=i,i.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},i.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},i.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var o=a(t[n]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--n<r||-2===o?0:(o=a(t[n]))>=0?(o>0&&(e.lastNeed=o-2),o):--n<r||-2===o?0:(o=a(t[n]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},5003:(e,t,r)=>{var n=r(8287),o=n.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return o(e,t,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),i(o,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=o(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},2050:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBAdapter=void 0;const n=r(9430),o=r(7881),i=r(2640),a=r(5922);r(8630);const s=r(7335),c=r(6746),u=r(5940),l=r(4699),f=r(9514),d=r(2879);class p extends n.Adapter{constructor(e,t){super(e,t)}get Clauses(){return this.factory||(this.factory=new c.Factory(this)),this.factory}Query(){return super.Query()}get Statement(){return new s.CouchDBStatement(this)}parseCondition(e){const{attr1:t,operator:r,comparison:o}=e;let i={};if(-1===[n.GroupOperator.AND,n.GroupOperator.OR,n.Operator.NOT].indexOf(r))i[t]={},i[t][(0,u.translateOperators)(r)]=o;else if(r===n.Operator.NOT)i=this.parseCondition(t).selector,i[(0,u.translateOperators)(n.Operator.NOT)]={},i[(0,u.translateOperators)(n.Operator.NOT)][t.attr1]=o;else{const e=this.parseCondition(t).selector,n=this.parseCondition(o).selector;i=function(e,t,r){const n={selector:{}};return n.selector[e]=[t,r],n}((0,u.translateOperators)(r),e,n).selector}return{selector:i}}async Sequence(e){return new l.CouchDBSequence(e)}async initialize(){const e=n.Adapter.models(this.flavour);return this.index(...e)}async index(...e){const t=(0,d.generateIndexes)(e);for(const e of t){const t=await this.native.createIndex(e),{result:r,id:n,name:o}=t;if("existing"===r)throw new a.ConflictError(`Index for table ${o} with id ${n}`)}}async user(){try{return(await this.native[i.CouchDBKeys.NATIVE].session()).userCtx.name}catch(e){throw this.parseError(e)}}async raw(e,t=!0){try{const r=await this.native.find(e);return t?r.docs:r}catch(e){throw this.parseError(e)}}async create(e,t,r){const o={};let s;o[i.CouchDBKeys.TABLE]=e,o[i.CouchDBKeys.ID]=this.generateId(e,t),Object.assign(o,r);try{s=await this.native.insert(o)}catch(e){throw this.parseError(e)}if(!s.ok)throw new a.InternalError(`Failed to insert doc id: ${t} in table ${e}`);return Object.defineProperty(r,n.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:s.rev}),r}async createAll(e,t,r){if(t.length!==r.length)throw new a.InternalError("Ids and models must have the same length");const o=t.map(((t,n)=>{const o={};return o[i.CouchDBKeys.TABLE]=e,o[i.CouchDBKeys.ID]=this.generateId(e,t),Object.assign(o,r[n]),o}));let s;try{s=await this.native.bulk({docs:o})}catch(e){throw this.parseError(e)}if(!s.every((e=>!e.error))){const e=s.reduce(((e,t,r)=>(t.error&&e.push(`el ${r}: ${t.error}${t.reason?` - ${t.reason}`:""}`),e)),[]);throw new a.InternalError(e.join("\n"))}return r.forEach(((e,t)=>(n.Repository.setMetadata(e,s[t].rev),e))),r}async read(e,t){const r=this.generateId(e,t);let o;try{o=await this.native.get(r)}catch(e){throw this.parseError(e)}return Object.defineProperty(o,n.PersistenceKeys.METADATA,{enumerable:!1,writable:!1,value:o._rev}),o}async update(e,t,r){const o={};o[i.CouchDBKeys.TABLE]=e,o[i.CouchDBKeys.ID]=this.generateId(e,t);const s=r[n.PersistenceKeys.METADATA];if(!s)throw new a.InternalError(`No revision number found for record with id ${t}`);let c;Object.assign(o,r),o[i.CouchDBKeys.REV]=s;try{c=await this.native.insert(o)}catch(e){throw this.parseError(e)}if(!c.ok)throw new a.InternalError(`Failed to update doc id: ${t} in table ${e}`);return Object.defineProperty(r,n.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:c.rev}),r}async delete(e,t){const r=this.generateId(e,t);let o;try{o=await this.native.get(r),await this.native.destroy(r,o._rev)}catch(e){throw this.parseError(e)}return Object.defineProperty(o,n.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:o._rev}),o}generateId(e,t){return[e,t].join(i.CouchDBKeys.SEPARATOR)}parseError(e,t){return p.parseError(e,t)}isReserved(e){return!!e.match(i.reservedAttributes)}static parseError(e,t){if(e instanceof a.BaseError)return e;let r="";if("string"==typeof e){if(r=e,r.match(/already exist|update conflict/g))return new a.ConflictError(r);if(r.match(/missing|deleted/g))return new a.NotFoundError(r)}else e.code?(r=e.code,t=t||e.message):e.statusCode?(r=e.statusCode,t=t||e.message):r=e.message;switch(r.toString()){case"401":case"412":case"409":return new a.ConflictError(t);case"404":return new a.NotFoundError(t);case"400":return r.toString().match(/No\sindex\sexists/g)?new f.IndexError(e):new a.InternalError(e);default:return r.toString().match(/ECONNREFUSED/g)?new n.ConnectionError(e):new a.InternalError(e)}}static connect(e,t,r="localhost:5984",n="http"){return o(`${n}://${e}:${t}@${r}`)}static async createDatabase(e,t){let r;try{r=await e.db.create(t)}catch(e){throw this.parseError(e)}const{ok:n,error:o,reason:i}=r;if(!n)throw this.parseError(o,i)}static async deleteDatabase(e,t){let r;try{r=await e.db.destroy(t)}catch(e){throw this.parseError(e)}const{ok:n}=r;if(!n)throw new a.InternalError(`Failed to delete database with name ${t}`)}static async createUser(e,t,r,n,o=["reader","writer"]){const i=await e.db.use("_users"),s={_id:"org.couchdb.user:"+r,name:r,password:n,roles:o,type:"user"};try{const n=await i.insert(s),{ok:c}=n;if(!c)throw new a.InternalError(`Failed to create user ${r}`);if(!(await e.request({db:t,method:"put",path:"_security",body:{admins:{names:[r],roles:[]},members:{names:[r],roles:o}}})).ok)throw new a.InternalError(`Failed to authorize user ${r} to db ${t}`)}catch(e){throw this.parseError(e)}}static async deleteUser(e,t,r){const n=await e.db.use("_users"),o="org.couchdb.user:"+r;try{const e=await n.get(o);await n.destroy(o,e._rev)}catch(e){throw this.parseError(e)}}}t.CouchDBAdapter=p},2640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBKeys=t.reservedAttributes=void 0,t.reservedAttributes=/^_.*$/g,t.CouchDBKeys={SEPARATOR:"_",ID:"_id",REV:"_rev",TABLE:"??table",DDOC:"ddoc",NATIVE:"__native",INDEX:"index"}},9514:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IndexError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.IndexError=o},7729:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(3847),t),o(r(3344),t),o(r(2050),t),o(r(2640),t),o(r(9514),t),o(r(2552),t),t.VERSION="0.0.1"},2879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateIndexes=function(e){const t=function(e,t,r,n=i.DefaultSeparator){return[...e.map((e=>e===o.CouchDBKeys.TABLE?"table":e)),...r||[],...t?[t]:[],o.CouchDBKeys.INDEX].join(n)}([o.CouchDBKeys.TABLE]),r={};return r[t]={index:{fields:[o.CouchDBKeys.TABLE]},name:t,ddoc:t,type:"json"},e.forEach((e=>{const t=n.Repository.indexes(e);Object.entries(t).forEach((([t,s])=>{const c=Object.keys(s)[0];let{directions:u,compositions:l}=s[c];const f=n.Repository.table(e);function d(e){const s=[f,t,...l,n.PersistenceKeys.INDEX].join(i.DefaultSeparator);if(r[s]={index:{fields:[t,...l,o.CouchDBKeys.TABLE].reduce(((t,r)=>{if(e){const n={};n[r]=e,t.push(n)}else t.push(r);return t}),[])},name:s,ddoc:s,type:"json"},!e){const e={};e[o.CouchDBKeys.TABLE]={},e[o.CouchDBKeys.TABLE][a.CouchDBOperator.EQUAL]=f,r[s].index.partial_filter_selector=e}}l=l||[],d(),u&&u.forEach((e=>d(e)))}))})),Object.values(r)};const n=r(9430),o=r(2640),i=r(5922),a=r(2755)},8986:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Sequence=void 0;const i=r(2302),a=r(9430);let s=class extends a.BaseModel{constructor(e){super(e),this.id=void 0,this.current=void 0}};t.Sequence=s,n([(0,a.pk)(),o("design:type",String)],s.prototype,"id",void 0),n([(0,i.required)(),(0,a.index)(),o("design:type",Object)],s.prototype,"current",void 0),t.Sequence=s=n([(0,a.table)("??sequence"),(0,a.uses)("nano"),(0,i.model)(),o("design:paramtypes",[Object])],s)},3847:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(8986),t)},9505:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBFromClause=void 0;const n=r(9430),o=r(2640),i=r(9430);class a extends n.FromClause{constructor(e){super(e)}build(e){const t={};return t[o.CouchDBKeys.TABLE]={},t[o.CouchDBKeys.TABLE]="string"==typeof this.selector?this.selector:i.Repository.table(this.selector),e.selector=t,e}}t.CouchDBFromClause=a},7668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBInsertClause=void 0;const n=r(9430),o=r(5922);class i extends n.InsertClause{constructor(e){super(e)}build(e){throw new o.InternalError("Not supported")}}t.CouchDBInsertClause=i},8233:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBPaginator=void 0;const n=r(9430),o=r(5922),i=r(3501);class a extends n.Paginator{get total(){throw new o.InternalError("The total pages api is not available for couchdb")}get count(){throw new o.InternalError("The record count api is not available for couchdb")}constructor(e,t,r){super(e,t,r)}prepare(e){const t=Object.assign({},e);return t.limit&&(this.limit=t.limit),t.limit=this.size,t}async page(e=1,...t){const r=Object.assign({},this.statement),a=this.stat.getTarget();if(1!==e){if(!this.bookMark)throw new n.PagingError("No bookmark. Did you start in the first page?");r.bookmark=this.bookMark}const s=await this.adapter.raw(r,!1,...t),{docs:c,bookmark:u,warning:l}=s;l&&console.warn(l);const f=r.fields&&r.fields.length?c:c.map((e=>{if(!a)throw new n.PagingError("No statement target defined");const t=(0,o.findPrimaryKey)(new a),r=t.id,s=e._id.split(o.DefaultSeparator);return s.splice(0,1),this.adapter.revert(e,a,r,(0,i.parseSequenceValue)(t.props.type,s.join(o.DefaultSeparator)))}));return this.bookMark=u,this._currentPage=e,f}}t.CouchDBPaginator=a},3433:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBSelectClause=void 0;const n=r(9430);class o extends n.SelectClause{constructor(e){super(e)}build(e){return this.selector&&this.selector!==n.Const.FULL_RECORD?(e.fields="string"==typeof this.selector?[this.selector]:this.selector,e):e}}t.CouchDBSelectClause=o},7335:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBStatement=void 0;const n=r(9430),o=r(5922),i=r(2640),a=r(3501),s=r(8233);class c extends n.Statement{constructor(e){super(e)}async execute(){try{const e=this.build();return e.limit||(e.limit=Number.MAX_SAFE_INTEGER),this.raw(e)}catch(e){throw new o.InternalError(e)}}async paginate(e){try{const t=this.build();return new s.CouchDBPaginator(this,e,t)}catch(e){throw new o.InternalError(e)}}processRecord(e,t,r){if(!e[i.CouchDBKeys.ID])throw new o.InternalError("No CouchDB Id definition found. Should not be possible");const[,...n]=e[i.CouchDBKeys.ID].split("_"),s=n.join("_");return this.adapter.revert(e,this.target,t,(0,a.parseSequenceValue)(r,s))}async raw(e,...t){const r=await this.adapter.raw(e,!0,...t);if(!this.fullRecord)return r;if(!this.target)throw new o.InternalError("No target defined in statement. should never happen");const n=(0,o.findPrimaryKey)(new this.target),i=n.id,a=n.props.type;return Array.isArray(r)?r.map((e=>this.processRecord(e,i,a))):this.processRecord(r,i,a)}}t.CouchDBStatement=c},9791:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBValuesClause=void 0;const n=r(9430),o=r(5922);class i extends n.ValuesClause{constructor(e){super(e)}build(e){throw new o.InternalError("Not implemented")}}t.CouchDBValuesClause=i},356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBWhereClause=void 0;const n=r(9430),o=r(2755),i=r(2302),a=r(2640);class s extends n.WhereClause{constructor(e){super(e)}build(e){const t=this.adapter.parseCondition(n.Condition.and(this.condition,n.Condition.attribute(a.CouchDBKeys.TABLE).eq(e.selector[a.CouchDBKeys.TABLE]))).selector,r=Object.keys(t);if(1===r.length&&-1!==Object.values(o.CouchDBGroupOperator).indexOf(r[0]))switch(r[0]){case o.CouchDBGroupOperator.AND:t[o.CouchDBGroupOperator.AND]=[...Object.values(t[o.CouchDBGroupOperator.AND]).reduce(((e,t)=>{const r=Object.keys(t);if(1!==r.length)throw new Error("Too many keys in query selector. should be one");const n=r[0];return n===o.CouchDBGroupOperator.AND?e.push(...t[n]):e.push(t),e}),[])],e.selector=t;break;case o.CouchDBGroupOperator.OR:{const r={};r[o.CouchDBGroupOperator.AND]=[t,...Object.entries(e.selector).map((([e,t])=>{const r={};return r[e]=t,r}))],e.selector=r;break}default:throw new Error("This should be impossible")}else Object.entries(t).forEach((([t,r])=>{e.selector[t]&&console.warn((0,i.sf)("A {0} query param is about to be overridden: {1} by {2}",t,e.selector[t],r)),e.selector[t]=r}));return e}}t.CouchDBWhereClause=s},2755:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBConst=t.CouchDBGroupOperator=t.CouchDBOperator=void 0,t.CouchDBOperator={EQUAL:"$eq",DIFFERENT:"$ne",BIGGER:"$gt",BIGGER_EQ:"$gte",SMALLER:"$lt",SMALLER_EQ:"$lte",NOT:"$not",IN:"$in",REGEXP:"$regex"},t.CouchDBGroupOperator={AND:"$and",OR:"$or"},t.CouchDBConst={NULL:"null"}},1084:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const n=r(9430),o=r(9430),i=r(9430),a=r(9430),s=r(9430),c=r(9505),u=r(5922),l=r(7668),f=r(7335),d=r(356),p=r(3433),h=r(9791),y=r(2755);class g extends n.ClauseFactory{constructor(e){super(e)}from(e,t){return new c.CouchDBFromClause({statement:e,selector:t})}groupBy(e,t){return new class extends s.GroupByClause{constructor(e){super(e)}build(e){throw new u.InternalError("Not implemented")}}({statement:e,selector:t})}insert(){return new l.CouchDBInsertClause({statement:new f.CouchDBStatement(this.adapter)})}limit(e,t){return new class extends o.LimitClause{constructor(e){super(e)}build(e){return e.limit=this.selector,e}}({statement:e,selector:t})}offset(e,t){return new class extends i.OffsetClause{constructor(e){super(e)}build(e){const t=parseInt(this.selector);if(isNaN(t))throw new n.QueryError("Failed to parse offset");return e.skip=t,e}}({statement:e,selector:t})}orderBy(e,t){return new class extends a.OrderByClause{constructor(e){super(e)}build(e){return e.sort=e.sort||[],e.selector=e.selector||{},this.selector.forEach((t=>{const[r,n]=t,o={};o[r]=n,e.sort.push(o),e.selector[r]||(e.selector[r]={},e.selector[r][y.CouchDBOperator.BIGGER]=null)})),e}}({statement:e,selector:t})}select(e){return new p.CouchDBSelectClause({statement:new f.CouchDBStatement(this.adapter),selector:e})}values(e,t){return new h.CouchDBValuesClause({statement:e,values:t})}where(e,t){return new d.CouchDBWhereClause({statement:e,condition:t})}}t.Factory=g},6746:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1084),t)},5940:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.translateOperators=function(e){for(const t of[n.CouchDBOperator,n.CouchDBGroupOperator]){const r=Object.keys(t).find((t=>t===e));if(r)return t[r]}throw new o.QueryError(`Could not find adapter translation for operator ${e}`)};const n=r(2755),o=r(9430)},4699:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBSequence=void 0;const i=r(2302),a=r(8986),s=r(5922),c=r(9430),u=r(9430),l=r(3501);class f extends u.Sequence{constructor(e){super(e)}async current(){const{name:e,startWith:t}=this.options;try{const t=await this.repo.read(e);return this.parse(t.current)}catch(r){if(r instanceof s.NotFoundError){if(void 0===t)throw new s.InternalError("Starting value is not defined for a non existing sequence");try{return this.parse(t)}catch(e){throw new s.InternalError((0,i.sf)("Failed to parse initial value for sequence {0}: {1}",t.toString(),e))}}throw new s.InternalError((0,i.sf)("Failed to retrieve current value for sequence {0}: {1}",e,r))}}parse(e){return(0,l.parseSequenceValue)(this.options.type,e)}async increment(e,t){const{type:r,incrementBy:n,name:o}=this.options;let i;const c=t||n;if(c%n!=0)throw new s.InternalError(`Value to increment does not consider the incrementBy setting: ${n}`);switch(r){case"Number":i=this.parse(e)+c;break;case"BigInt":i=this.parse(e)+BigInt(c);break;default:throw new s.InternalError("Should never happen")}let u;try{u=await this.repo.update(new a.Sequence({id:o,current:i}))}catch(e){if(!(e instanceof s.NotFoundError))throw e;u=await this.repo.create(new a.Sequence({id:o,current:i}))}return u.current}async next(){const e=await this.current();return this.increment(e)}async range(e){const t=await this.current(),r=this.parse(this.options.incrementBy),n=await this.increment(t,this.parse(e)*r),o=[];for(let n=1;n<=e;n++)o.push(t+r*this.parse(n));if(o[o.length-1]!==n)throw new s.InternalError("Miscalculation of range");return o}}t.CouchDBSequence=f,n([(0,c.repository)(a.Sequence),o("design:type",Object)],f.prototype,"repo",void 0)},3344:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(4699),t)},3501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseSequenceValue=function(e,t){switch(e){case"Number":return"string"==typeof t?parseInt(t):"number"==typeof t?t:BigInt(t);case"BigInt":return BigInt(t);default:throw new n.InternalError("Should never happen")}};const n=r(5922)},2552:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reAuth=s,t.wrapDocumentScope=function(e,t,r,n){const i=e.use(t);return["insert","get","put","destroy","find"].forEach((t=>{const o=i[t];Object.defineProperty(i,t,{enumerable:!1,configurable:!0,value:async(...t)=>(await s(e,r,n),o.call(i,...t))})})),Object.defineProperty(i,o.CouchDBKeys.NATIVE,{enumerable:!1,configurable:!1,writable:!1,value:e}),i},t.testReservedAttributes=function(e){return e.match(/^_.*$/g)},t.generateIndexName=c,t.generateIndexDoc=function(e,t,r,n,s=i.DefaultSeparator){const u={};let l;if(u[o.CouchDBKeys.TABLE]={},u[o.CouchDBKeys.TABLE][a.CouchDBOperator.EQUAL]=t,n){const t={};t[e]=n;const i=(r||[]).map((e=>{const t={};return t[e]=n,t})),a={};a[o.CouchDBKeys.TABLE]=n,l=[t,...i,a]}else l=[e,...r||[],o.CouchDBKeys.TABLE];const f=c(e,t,r,n,s);return{index:{fields:l},ddoc:[f,o.CouchDBKeys.DDOC].join(s),name:f}};const n=r(9430),o=r(2640),i=r(5922),a=r(2755);async function s(e,t,r){return e.auth(t,r)}function c(e,t,r,o,a=i.DefaultSeparator){const s=[n.PersistenceKeys.INDEX,t,e];return r&&s.push(...r),o&&s.push(o),s.join(a)}},1270:function(e,t,r){var n;e=r.nmd(e),function(){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof r.g&&r.g;o.global!==o&&o.window!==o&&o.self;var i,a=2147483647,s=36,c=/^xn--/,u=/[^\x20-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function h(e){throw new RangeError(f[e])}function y(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function g(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+y((e=e.replace(l,".")).split("."),t).join(".")}function b(e){for(var t,r,n=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(r=e.charCodeAt(o++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--):n.push(t);return n}function m(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+p(e)})).join("")}function v(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,r){var n=0;for(e=r?d(e/700):e>>1,e+=d(e/t);e>455;n+=s)e=d(e/35);return d(n+36*e/(e+38))}function E(e){var t,r,n,o,i,c,u,l,f,p,y,g=[],b=e.length,v=0,E=128,O=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&h("not-basic"),g.push(e.charCodeAt(n));for(o=r>0?r+1:0;o<b;){for(i=v,c=1,u=s;o>=b&&h("invalid-input"),((l=(y=e.charCodeAt(o++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:s)>=s||l>d((a-v)/c))&&h("overflow"),v+=l*c,!(l<(f=u<=O?1:u>=O+26?26:u-O));u+=s)c>d(a/(p=s-f))&&h("overflow"),c*=p;O=w(v-i,t=g.length+1,0==i),d(v/t)>a-E&&h("overflow"),E+=d(v/t),v%=t,g.splice(v++,0,E)}return m(g)}function O(e){var t,r,n,o,i,c,u,l,f,y,g,m,E,O,_,R=[];for(m=(e=b(e)).length,t=128,r=0,i=72,c=0;c<m;++c)(g=e[c])<128&&R.push(p(g));for(n=o=R.length,o&&R.push("-");n<m;){for(u=a,c=0;c<m;++c)(g=e[c])>=t&&g<u&&(u=g);for(u-t>d((a-r)/(E=n+1))&&h("overflow"),r+=(u-t)*E,t=u,c=0;c<m;++c)if((g=e[c])<t&&++r>a&&h("overflow"),g==t){for(l=r,f=s;!(l<(y=f<=i?1:f>=i+26?26:f-i));f+=s)_=l-y,O=s-y,R.push(p(v(y+_%O,0))),l=d(_/O);R.push(p(v(l,0))),i=w(r,E,n==o),r=0,++n}++r,++t}return R.join("")}i={version:"1.4.1",ucs2:{decode:b,encode:m},decode:E,encode:O,toASCII:function(e){return g(e,(function(e){return u.test(e)?"xn--"+O(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?E(e.slice(4).toLowerCase()):e}))}},void 0===(n=function(){return i}.call(t,r,t,e))||(e.exports=n)}()},8835:(e,t,r)=>{"use strict";var n=r(1270);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var i=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),l=["%","/","?",";","#"].concat(u),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,h={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=r(5373);function m(e,t,r){if(e&&"object"==typeof e&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if("string"!=typeof e)throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var m=e=c.join(a);if(m=m.trim(),!r&&1===e.split("#").length){var v=s.exec(m);if(v)return this.path=m,this.href=m,this.pathname=v[1],v[2]?(this.search=v[2],this.query=t?b.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=i.exec(m);if(w){var E=(w=w[0]).toLowerCase();this.protocol=E,m=m.substr(w.length)}if(r||w||m.match(/^\/\/[^@/]+@[^@/]+/)){var O="//"===m.substr(0,2);!O||w&&y[w]||(m=m.substr(2),this.slashes=!0)}if(!y[w]&&(O||w&&!g[w])){for(var _,R,S=-1,A=0;A<f.length;A++)-1!==(P=m.indexOf(f[A]))&&(-1===S||P<S)&&(S=P);for(-1!==(R=-1===S?m.lastIndexOf("@"):m.lastIndexOf("@",S))&&(_=m.slice(0,R),m=m.slice(R+1),this.auth=decodeURIComponent(_)),S=-1,A=0;A<l.length;A++){var P;-1!==(P=m.indexOf(l[A]))&&(-1===S||P<S)&&(S=P)}-1===S&&(S=m.length),this.host=m.slice(0,S),m=m.slice(S),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var T=this.hostname.split(/\./),M=(A=0,T.length);A<M;A++){var D=T[A];if(D&&!D.match(d)){for(var C="",x=0,I=D.length;x<I;x++)D.charCodeAt(x)>127?C+="x":C+=D[x];if(!C.match(d)){var L=T.slice(0,A),N=T.slice(A+1),k=D.match(p);k&&(L.push(k[1]),N.unshift(k[2])),N.length&&(m="/"+N.join(".")+m),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=n.toASCII(this.hostname));var B=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+B,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==m[0]&&(m="/"+m))}if(!h[E])for(A=0,M=u.length;A<M;A++){var F=u[A];if(-1!==m.indexOf(F)){var K=encodeURIComponent(F);K===F&&(K=escape(F)),m=m.split(F).join(K)}}var q=m.indexOf("#");-1!==q&&(this.hash=m.substr(q),m=m.slice(0,q));var V=m.indexOf("?");if(-1!==V?(this.search=m.substr(V),this.query=m.substr(V+1),t&&(this.query=b.parse(this.query)),m=m.slice(0,V)):t&&(this.search="",this.query={}),m&&(this.pathname=m),g[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){B=this.pathname||"";var H=this.search||"";this.path=B+H}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,i="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(i=b.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(e){return this.resolveObject(m(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if("string"==typeof e){var t=new o;t.parse(e,!1,!0),e=t}for(var r=new o,n=Object.keys(this),i=0;i<n.length;i++){var a=n[i];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var u=s[c];"protocol"!==u&&(r[u]=e[u])}return g[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!g[e.protocol]){for(var l=Object.keys(e),f=0;f<l.length;f++){var d=l[f];r[d]=e[d]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||y[e.protocol])r.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var h=r.pathname||"",b=r.search||"";r.path=h+b}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var m=r.pathname&&"/"===r.pathname.charAt(0),v=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=v||m||r.host&&e.pathname,E=w,O=r.pathname&&r.pathname.split("/")||[],_=(p=e.pathname&&e.pathname.split("/")||[],r.protocol&&!g[r.protocol]);if(_&&(r.hostname="",r.port=null,r.host&&(""===O[0]?O[0]=r.host:O.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),w=w&&(""===p[0]||""===O[0])),v)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,O=p;else if(p.length)O||(O=[]),O.pop(),O=O.concat(p),r.search=e.search,r.query=e.query;else if(null!=e.search)return _&&(r.host=O.shift(),r.hostname=r.host,(j=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=j.shift(),r.hostname=j.shift(),r.host=r.hostname)),r.search=e.search,r.query=e.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!O.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var R=O.slice(-1)[0],S=(r.host||e.host||O.length>1)&&("."===R||".."===R)||""===R,A=0,P=O.length;P>=0;P--)"."===(R=O[P])?O.splice(P,1):".."===R?(O.splice(P,1),A++):A&&(O.splice(P,1),A--);if(!w&&!E)for(;A--;A)O.unshift("..");!w||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),S&&"/"!==O.join("/").substr(-1)&&O.push("");var j,T=""===O[0]||O[0]&&"/"===O[0].charAt(0);return _&&(r.hostname=T?"":O.length?O.shift():"",r.host=r.hostname,(j=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=j.shift(),r.hostname=j.shift(),r.host=r.hostname)),(w=w||r.host&&O.length)&&!T&&O.unshift(""),O.length>0?r.pathname=O.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},t.parse=m,t.resolve=function(e,t){return m(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?m(e,!1,!0).resolveObject(t):t},t.format=function(e){return"string"==typeof e&&(e=m(e)),e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o},4643:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},7510:e=>{e.exports=function(){for(var e={},r=0;r<arguments.length;r++){var n=arguments[r];for(var o in n)t.call(n,o)&&(e[o]=n[o])}return e};var t=Object.prototype.hasOwnProperty},9723:()=>{},9413:()=>{},2634:()=>{},9169:()=>{},6833:()=>{},4097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pkOnCreate=f,t.pk=function(e=o.DefaultSequenceOptions){return e=Object.assign({},o.DefaultSequenceOptions,e),(0,a.apply)((0,c.index)([l.OrderDirection.ASC,l.OrderDirection.DSC]),(0,n.required)(),(0,i.readonly)(),(0,n.propMetadata)(s.Repository.key(i.DBKeys.ID),e),(0,i.onCreate)(f,e))};const n=r(2302),o=r(5176),i=r(5922),a=r(32),s=r(1317),c=r(5562),u=r(8470),l=r(4315);async function f(e,t,r,n){if(!t.type||n[r])return;let o;t.name||(t.name=(0,u.sequenceNameForModel)(n,"pk"));try{o=await this.adapter.Sequence(t)}catch(e){throw new i.InternalError(`Failed to instantiate Sequence ${t.name}: ${e}`)}var a,s,c;a=n,s=r,c=await o.next(),Object.defineProperty(a,s,{enumerable:!0,writable:!1,configurable:!0,value:c})}},1053:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(4097),t),o(r(8470),t)},8470:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTableName=a,t.sequenceNameForModel=function(e,...t){return[a(e),...t].join("_")};const n=r(2302),o=r(1111),i=r(149);function a(e){return Reflect.getMetadata(o.Adapter.key(i.PersistenceKeys.TABLE),e instanceof n.Model?e.constructor:e)||(e instanceof n.Model?e.constructor.name:e.name)}},9430:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0;const i=r(4315),a=r(465);o(r(1053),t),o(r(3631),t),o(r(8768),t),o(r(7550),t),o(r(1135),t),o(r(4315),t),o(r(5638),t),a.Injectables.setRegistry(new i.InjectablesRegistry),t.VERSION="0.3.1"},7922:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7214:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5702:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2443:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9599:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1678:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5176:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BigIntSequence=t.NumericSequence=t.DefaultSequenceOptions=void 0,t.DefaultSequenceOptions={type:"Number",startWith:0,incrementBy:1,cycle:!1},t.NumericSequence={type:"Number",startWith:0,incrementBy:1,cycle:!1},t.BigIntSequence={type:"BigInt",startWith:0,incrementBy:1,cycle:!1}},3631:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(7922),t),o(r(7214),t),o(r(5702),t),o(r(2443),t),o(r(9599),t),o(r(1678),t),o(r(5176),t)},5298:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseModel=void 0;const i=r(5922),a=r(2302),s=r(5562);class c extends a.Model{constructor(e){super(e)}}t.BaseModel=c,n([(0,i.timestamp)(i.DBOperations.CREATE),o("design:type",Date)],c.prototype,"createdOn",void 0),n([(0,i.timestamp)(),o("design:type",Date)],c.prototype,"updatedOn",void 0),n([(0,s.createdBy)(),o("design:type",String)],c.prototype,"createdBy",void 0),n([(0,s.updatedBy)(),o("design:type",String)],c.prototype,"updatedBy",void 0)},1421:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.User=void 0;const i=r(2302),a=r(4097);let s=class extends i.Model{constructor(e){super(e)}};t.User=s,n([(0,a.pk)(),o("design:type",String)],s.prototype,"id",void 0),n([(0,i.list)([String]),o("design:type",Array)],s.prototype,"roles",void 0),n([(0,i.list)([String]),o("design:type",Array)],s.prototype,"affiliations",void 0),t.User=s=n([(0,i.model)(),o("design:paramtypes",[Object])],s)},7907:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOrUpdate=c,t.oneToOneOnCreate=async function(e,t,r,a){const s=a[r];if(!s)return;if("object"!=typeof s){const t=p(a,r),n=await t.read(s);return await f(e,a,r,s,n),void(a[r]=s)}const c=n.Model.get(t.class);if(!c)throw new i.InternalError(`Could not find model ${t.class}`);const u=o.Repository.forModel(c),l=await u.create(s),d=(0,i.findPrimaryKey)(l).id;await f(e,a,r,l[d],l),a[r]=l[d]},t.oneToOneOnUpdate=async function(e,t,r,n){const o=n[r];if(!o)return;if(t.cascade.update!==s.Cascade.CASCADE)return;if("object"!=typeof o){const t=p(n,r),i=await t.read(o);return await f(e,n,r,o,i),void(n[r]=o)}const a=await c(n[r],e),u=(0,i.findPrimaryKey)(a).id;await f(e,n,r,a[u],a),n[r]=a[u]},t.oneToOneOnDelete=async function(e,t,r,o){const i=o[r];if(!i)return;if(t.cascade.update!==s.Cascade.CASCADE)return;const a=p(o,r);let c;c=i instanceof n.Model?await a.delete(o[r][a.pk],e):await a.delete(o[r],e),await f(e,o,r,c[a.pk],c)},t.oneToManyOnCreate=u,t.oneToManyOnUpdate=async function(e,t,r,n){const{cascade:o}=t;if(o.update===s.Cascade.CASCADE)return u.call(this,e,t,r,n)},t.oneToManyOnDelete=async function(e,t,r,n){if(t.cascade.delete!==s.Cascade.CASCADE)return;const a=n[r];if(!a||!a.length)return;const c=typeof a[0];if(!a.every((e=>typeof e===c)))throw new i.InternalError(`Invalid operation. All elements of property ${r} must match the same type.`);const u="object"===c,l=u?o.Repository.forModel(a[0]):p(n,r),d=new Set([...u?a.map((e=>e[l.pk])):a]);for(const t of d.values()){const o=await l.delete(t,e);await f(e,n,r,t,o)}n[r]=[...d]},t.getPopulateKey=l,t.cacheModelForPopulate=f,t.populate=async function(e,t,r,n){if(!t.populate)return;const o=n[r],a=Array.isArray(o);if(void 0===o||a&&0===o.length)return;const s=await async function(e,t,r,n){let o,a;const s=[];for(const c of n){o=l(t.constructor.name,r,c);try{a=await e.get(o)}catch(e){const n=p(t,r);if(!n)throw new i.InternalError("Could not find repo");a=await n.read(c)}s.push(a)}return s}(e,n,r,a?o:[o]);n[r]=a?s:s[0]},t.repositoryFromTypeMetadata=p;const n=r(2302),o=r(1317),i=r(5922),a=r(149),s=r(5780);async function c(e,t,r){if(!r){const t=n.Model.get(e.constructor.name);if(!t)throw new i.InternalError(`Could not find model ${e.constructor.name}`);r=o.Repository.forModel(t)}if(void 0===e[r.pk])return r.create(e,t);try{return r.update(e,t)}catch(n){if(!(n instanceof i.NotFoundError))throw n;return r.create(e,t)}}async function u(e,t,r,n){const o=n[r];if(!o||!o.length)return;const a=typeof o[0];if(!o.every((e=>typeof e===a)))throw new i.InternalError(`Invalid operation. All elements of property ${r} must match the same type.`);const s=new Set([...o]);if("object"!==a){const t=p(n,r);for(const o of s){const i=await t.read(o);await f(e,n,r,o,i)}return void(n[r]=[...s])}const u=(0,i.findPrimaryKey)(o[0]).id,l=new Set;for(const t of o){const o=await c(t,e);await f(e,n,r,o[u],o),l.add(o[u])}n[r]=[...l]}function l(e,t,r){return[a.PersistenceKeys.POPULATE,e,t,r].join(".")}async function f(e,t,r,n,o){const i=l(t.constructor.name,r,n);return e.put(i,o)}const d=["array","string","number","boolean","symbol","function","object","undefined","null","bigint"];function p(e,t){const r=Reflect.getMetadata(n.Validation.key(Array.isArray(e[t])?n.ValidationKeys.LIST:n.ValidationKeys.TYPE),e,t),a=Array.isArray(e[t])?r.class:r.customTypes;if(!r||!a)throw new i.InternalError(`Failed to find types decorators for property ${t}`);const s=(Array.isArray(a)?[...a]:[a]).find((e=>!d.includes(`${e}`.toLowerCase())));if(!s)throw new i.InternalError(`Property key ${t} does not have a valid constructor type`);const c=n.Model.get(s);if(!c)throw new i.InternalError(`No registered model found for ${s}`);return o.Repository.forModel(c)}},5562:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.table=function(e){return(0,o.metadata)(c.Adapter.key(i.PersistenceKeys.TABLE),e)},t.column=function(e){return(0,s.propMetadata)(c.Adapter.key(i.PersistenceKeys.COLUMN),e)},t.index=function(e,t){return(0,s.propMetadata)(u.Repository.key(`${i.PersistenceKeys.INDEX}${t&&t.length?`.${t.join(".")}`:""}`),{directions:e,compositions:t})},t.uniqueOnCreateUpdate=d,t.unique=function(){return(0,o.apply)((0,n.onCreateUpdate)(d),(0,s.propMetadata)(u.Repository.key(i.PersistenceKeys.UNIQUE),{}))},t.createdByOnCreateUpdate=p,t.createdBy=function(){return(0,o.apply)((0,n.onCreate)(p),(0,s.propMetadata)(u.Repository.key(i.PersistenceKeys.CREATED_BY),{}))},t.updatedBy=function(){return(0,o.apply)((0,n.onCreateUpdate)(p),(0,s.propMetadata)(u.Repository.key(i.PersistenceKeys.CREATED_BY),{}))},t.oneToOne=function(e,t=a.DefaultCascade,r=!0){s.Model.register(e);const c={class:e.name,cascade:t,populate:r};return(0,o.apply)((0,s.prop)(i.PersistenceKeys.RELATIONS),(0,s.type)([e.name,String.name,Number.name,BigInt.name]),(0,n.onCreate)(f.oneToOneOnCreate,c),(0,n.onUpdate)(f.oneToOneOnUpdate,c),(0,n.onDelete)(f.oneToOneOnDelete,c),(0,n.afterAny)(f.populate,c),(0,s.propMetadata)(u.Repository.key(i.PersistenceKeys.ONE_TO_ONE),c))},t.oneToMany=function(e,t=a.DefaultCascade,r=!0){s.Model.register(e);const c={class:e.name,cascade:t,populate:r};return(0,o.apply)((0,s.prop)(i.PersistenceKeys.RELATIONS),(0,s.list)([e,String,Number,BigInt]),(0,n.onCreate)(f.oneToManyOnCreate,c),(0,n.onUpdate)(f.oneToManyOnUpdate,c),(0,n.onDelete)(f.oneToManyOnDelete,c),(0,n.afterAny)(f.populate,c),(0,s.propMetadata)(u.Repository.key(i.PersistenceKeys.ONE_TO_MANY),c))},t.manyToOne=function(e,t=a.DefaultCascade,r=!0){s.Model.register(e);const n={class:e.name,cascade:t,populate:r};return(0,o.apply)((0,s.prop)(i.PersistenceKeys.RELATIONS),(0,s.type)([e.name,String.name,Number.name,BigInt.name]),(0,s.propMetadata)(u.Repository.key(i.PersistenceKeys.MANY_TO_ONE),n))};const n=r(5922),o=r(32),i=r(149),a=r(5780),s=r(2302),c=r(1111),u=r(1317),l=r(1880),f=r(7907);async function d(e,t,r,o){if(o[r]&&(await this.select().where(l.Condition.attribute(r).eq(o[r])).execute()).length)throw new n.ConflictError(`model already exists with property ${r} equal to ${JSON.stringify(o[r],void 0,2)}`)}async function p(e,t,r,n){const o=await this.adapter.user();n[r]=o.id}},8768:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(5298),t),o(r(5562),t),o(r(8151),t),o(r(1421),t)},8151:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1111:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Adapter=void 0;const n=r(5922),o=r(2302),i=r(149),a=r(5039),s=r(1317);class c{static{this._cache={}}get native(){return this._native}constructor(e,t){this.flavour=t,this._observers=[],this._native=e,c._cache[t]=this}Query(){return new a.Query(this)}isReserved(e){return!e}async timestamp(){return new Date}async context(e,t){return n.Context.from(e,t)}prepare(e,t){const r=Object.entries(e).reduce(((t,[r,o])=>{const i=s.Repository.column(e,r);if(this.isReserved(i))throw new n.InternalError(`Property name ${i} is reserved`);return t[i]=o,t}),{});return e[i.PersistenceKeys.METADATA]&&Object.defineProperty(r,i.PersistenceKeys.METADATA,{enumerable:!1,writable:!1,configurable:!0,value:e[i.PersistenceKeys.METADATA]}),{record:r,id:e[t]}}revert(e,t,r,n){const a={};a[r]=n;const c="string"==typeof t?o.Model.build(a,t):new t(a),u=e[i.PersistenceKeys.METADATA],l=Object.keys(c).reduce(((t,n)=>(n===r||(t[n]=e[s.Repository.column(t,n)]),t)),c);return u&&Object.defineProperty(l,i.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:u}),l}async createAll(e,t,r,...o){if(t.length!==r.length)throw new n.InternalError("Ids and models must have the same length");return Promise.all(t.map(((t,n)=>this.create(e,t,r[n],...o))))}async readAll(e,t,...r){return Promise.all(t.map((t=>this.read(e,t,...r))))}async updateAll(e,t,r,...o){if(t.length!==r.length)throw new n.InternalError("Ids and models must have the same length");return Promise.all(t.map(((t,n)=>this.update(e,t,r[n],...o))))}async deleteAll(e,t,...r){return Promise.all(t.map((t=>this.delete(e,t,...r))))}observe(e){if(-1!==this._observers.indexOf(e))throw new n.InternalError("Observer already registered");this._observers.push(e)}unObserve(e){const t=this._observers.indexOf(e);if(-1===t)throw new n.InternalError("Failed to find Observer");this._observers.splice(t,1)}async updateObservers(...e){(await Promise.allSettled(this._observers.map((t=>t.refresh(...e))))).forEach(((e,t)=>{"rejected"===e.status&&console.warn(`Failed to update observable ${this._observers[t]}: ${e.reason}`)}))}static get current(){return this._current}static get(e){if(e in this._cache)return this._cache[e];throw new n.InternalError(`No Adapter registered under ${e}.`)}static setCurrent(e){const t=this.get(e);if(!t)throw new n.NotFoundError(`No persistence flavour ${e} registered`);this._current=t}static key(e){return s.Repository.key(e)}static models(e){try{const t=o.Model.getRegistry().cache;return Object.values(t).map((t=>{let r=Reflect.getMetadata(c.key(i.PersistenceKeys.ADAPTER),t);if(r&&r===e)return t;if(!r){if(!Reflect.getMetadata(s.Repository.key(n.DBKeys.REPOSITORY),t))return;const e=s.Repository.forModel(t);return r=Reflect.getMetadata(c.key(i.PersistenceKeys.ADAPTER),e),r}})).filter((e=>!!e))}catch(e){throw new n.InternalError(e)}}}t.Adapter=c},5205:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sequence=void 0;const n=r(8470);t.Sequence=class{constructor(e){this.options=e}static pk(e){return(0,n.sequenceNameForModel)(e,"pk")}}},149:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.Roles=t.PersistenceKeys=void 0,function(e){e.INDEX="index",e.UNIQUE="unique",e.ADAPTER="adapter",e.INJECTABLE="decaf_{0}_adapter_for_{1}",e.TABLE="table",e.COLUMN="column",e.METADATA="__metadata",e.RELATIONS="__relations",e.CLAUSE_SEQUENCE="clause-sequence",e.CREATED_BY="ownership.created-by",e.UPDATED_BY="ownership.updated-by",e.ONE_TO_ONE="relations.one-to-one",e.ONE_TO_MANY="relations.one-to-many",e.MANY_TO_ONE="relations.many-to-one",e.POPULATE="populate"}(r||(t.PersistenceKeys=r={})),function(e){e.ADMIN="admin",e.WRITER="writer",e.READER="reader"}(n||(t.Roles=n={}))},8864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uses=function(e){return t=>(0,n.metadata)(i.Adapter.key(o.PersistenceKeys.ADAPTER),e)(t)};const n=r(32),o=r(149),i=r(1111)},1931:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.ConnectionError=o},7550:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1111),t),o(r(149),t),o(r(8864),t),o(r(1931),t),o(r(5205),t)},550:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Clause=void 0;const i=r(2302),a=r(500),s=(r(5048),r(6996));class c extends i.Model{constructor(e){if(super(),this.priority=e?.priority,this.statement=e?.statement,!this.statement||!this.priority)throw new a.QueryError("Missing statement or priority. Should be impossible");this.statement.addClause(this)}get adapter(){return this.statement.getAdapter()}get Clauses(){return this.statement.getAdapter().Clauses}getPriority(){return this.priority}async execute(){return this.statement.execute()}async paginate(e){return this.statement.paginate(e)}toString(){return this.constructor.name}}t.Clause=c,n([(0,i.required)(),o("design:type",Number)],c.prototype,"priority",void 0),n([(0,i.required)(),(0,i.type)("object"),o("design:type",s.Statement)],c.prototype,"statement",void 0)},940:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClauseFactory=void 0,t.ClauseFactory=class{constructor(e){this.adapter=e}}},1880:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Condition=void 0;const i=r(2302),a=r(5048),s=r(500);class c extends i.Model{constructor(e,t,r){super(),this.attr1=void 0,this.operator=void 0,this.comparison=void 0,this.attr1=e,this.operator=t,this.comparison=r}and(e){return c.and(this,e)}or(e){return c.or(this,e)}not(e){return new c(this,a.Operator.NOT,e)}hasErrors(...e){const t=super.hasErrors(...e);if(t)return t;if("string"==typeof this.attr1){if(this.comparison instanceof c)return{comparison:{condition:"Both sides of the comparison must be of the same type"}};if(-1===Object.values(a.Operator).indexOf(this.operator))return{operator:{condition:(0,i.sf)("Invalid operator {0}",this.operator)}}}if(this.attr1 instanceof c){if(!(this.comparison instanceof c)&&this.operator!==a.Operator.NOT)return{comparison:{condition:(0,i.sf)("Invalid operator {0}",this.operator)}};if(-1===Object.values(a.GroupOperator).indexOf(this.operator)&&this.operator!==a.Operator.NOT)return{operator:{condition:(0,i.sf)("Invalid operator {0}",this.operator)}}}}static and(e,t){return c.group(e,a.GroupOperator.AND,t)}static or(e,t){return c.group(e,a.GroupOperator.OR,t)}static group(e,t,r){return new c(e,t,r)}static attribute(e){return(new c.Builder).attribute(e)}static{this.Builder=class{constructor(){this.attr1=void 0,this.operator=void 0,this.comparison=void 0}attribute(e){return this.attr1=e,this}eq(e){return this.setOp(a.Operator.EQUAL,e)}dif(e){return this.setOp(a.Operator.DIFFERENT,e)}gt(e){return this.setOp(a.Operator.BIGGER,e)}lt(e){return this.setOp(a.Operator.SMALLER,e)}gte(e){return this.setOp(a.Operator.BIGGER_EQ,e)}lte(e){return this.setOp(a.Operator.SMALLER_EQ,e)}in(e){return this.setOp(a.Operator.IN,e)}regexp(e){return this.setOp(a.Operator.REGEXP,"string"==typeof e?new RegExp(e):e)}setOp(e,t){return this.operator=e,this.comparison=t,this.build()}build(){try{return new c(this.attr1,this.operator,this.comparison)}catch(e){throw new s.QueryError(e)}}}}static get builder(){return new c.Builder}}t.Condition=c,n([(0,i.required)(),o("design:type",Object)],c.prototype,"attr1",void 0),n([(0,i.required)(),o("design:type",String)],c.prototype,"operator",void 0),n([(0,i.required)(),o("design:type",Object)],c.prototype,"comparison",void 0)},2354:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Paginator=void 0;const n=r(500);t.Paginator=class{get current(){return this._currentPage}get total(){return this._totalPages}get count(){return this._recordCount}get statement(){return this._statement||(this._statement=this.prepare(this._rawStatement)),this._statement}get adapter(){return this.stat.getAdapter()}constructor(e,t,r){this.stat=e,this.size=t,this._rawStatement=r}async next(){return this.page(this.current+1)}async previous(){return this.page(this.current-1)}validatePage(e){if(e<1||!Number.isInteger(e))throw new n.PagingError("page number cannot be under 1 and must be an integer");if(e>this._totalPages)throw new n.PagingError("page number cannot be under 1 and must be an integer")}}},5039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Query=void 0;const n=r(5048);t.Query=class{constructor(e){this.adapter=e}select(e=n.Const.FULL_RECORD){return this.adapter.Clauses.select(e)}min(e){return this.select().min(e)}max(e){return this.select().max(e)}distinct(e){return this.select().distinct(e)}count(e){return this.select().count(e)}insert(){return this.adapter.Clauses.insert()}}},6996:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Statement=void 0;const i=r(2302),a=r(5048),s=r(500),c=r(5638),u=r(7550),l=r(5922);class f extends i.Model{constructor(e){super(),this.clauses=void 0,this.target=void 0,this.fullRecord=!1,this.type=void 0,this.adapter=e}build(){if(!this.clauses)throw new s.QueryError((0,i.sf)("Failed to build Statement:\n{0}","No Clauses"));this.clauses.sort(((e,t)=>e.getPriority()-t.getPriority()));const e=this.hasErrors();if(e)throw new s.QueryError((0,i.sf)("Poorly built statement: {0}",e.toString()));let t;try{const e=function(t,r={}){const n=t.shift();if(!n)return r;const o=n.build(r);return e(t,o)};t=e(new Array(...this.clauses))}catch(e){throw new s.QueryError(e)}return t}async execute(){try{const e=this.build();return this.raw(e)}catch(e){throw new l.InternalError(e)}}async raw(e,...t){const r=await this.adapter.raw(e,!0,...t);if(!this.fullRecord)return r;if(!this.target)throw new l.InternalError("No target defined in statement. should never happen");const n=(0,l.findPrimaryKey)(new this.target).id,o=function(e){const t=e[n];return this.adapter.revert(e,this.target,n,t)}.bind(this);return Array.isArray(r)?r.map(o):o(r)}hasErrors(...e){const t=super.hasErrors(...e);if(t)return t;for(const e in this.clauses){const t=this.clauses[e].hasErrors();if(t)return t}}addClause(e){this.clauses||(this.clauses=[]);const t=e.getPriority(),r=this.clauses.map(((e,t)=>({index:t,clause:e}))).find((e=>e.clause.getPriority()===t));r&&(this.clauses[r.index]=e),this.clauses.push(e)}getAdapter(){return this.adapter}setTarget(e){if(this.target)throw new s.QueryError((0,i.sf)("Output class already defined to {0}",this.target.name));this.target=e}getTarget(){if(!this.target)throw new l.InternalError("No target defined for statement");return this.target}setFullRecord(){this.fullRecord=!0}setMode(e){this.type=e}}t.Statement=f,n([(0,i.required)(),(0,i.minlength)(a.MandatoryPriorities.length),(0,c.clauseSequence)(),o("design:type",Array)],f.prototype,"clauses",void 0),n([(0,i.required)(),(0,i.type)(["object"]),o("design:type",u.Adapter)],f.prototype,"adapter",void 0),n([(0,i.required)(),o("design:type",Object)],f.prototype,"target",void 0),n([(0,i.required)(),o("design:type",String)],f.prototype,"type",void 0)},1843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FromClause=void 0;const n=r(5048),o=r(311),i=r(500),a=r(2302);class s extends o.SelectorBasedClause{constructor(e){if(super(Object.assign({},e,{priority:n.Priority.FROM})),this.selector="string"==typeof this.selector?a.Model.get(this.selector):this.selector,!this.selector)throw new i.QueryError((0,a.stringFormat)("Could not find selector model: {0}"));this.statement.setTarget(this.selector)}where(e){return this.Clauses.where(this.statement,e)}orderBy(...e){return this.Clauses.orderBy(this.statement,e)}groupBy(e){return this.Clauses.groupBy(this.statement,e)}limit(e){return this.Clauses.limit(this.statement,e)}offset(e){return this.Clauses.offset(this.statement,e)}}t.FromClause=s},1997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupByClause=void 0;const n=r(5048),o=r(311);class i extends o.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:n.Priority.GROUP_BY}))}}t.GroupByClause=i},8484:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.InsertClause=void 0;const i=r(5048),a=r(550),s=r(2302);class c extends a.Clause{constructor(e){super(Object.assign({},e,{priority:i.Priority.SELECT})),this.table=void 0}into(e){return this.table=e.name,this.statement.setTarget(e),this}values(...e){return this.Clauses.values(this.statement,e)}where(e){return this.Clauses.where(this.statement,e)}}t.InsertClause=c,n([(0,s.required)(),o("design:type",String)],c.prototype,"table",void 0)},4006:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LimitClause=void 0;const n=r(311),o=r(5048);class i extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.GROUP_BY}))}offset(e){return this.Clauses.offset(this.statement,e)}}t.LimitClause=i},7582:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OffsetClause=void 0;const n=r(311),o=r(5048);class i extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.GROUP_BY}))}}t.OffsetClause=i},7068:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrderByClause=void 0;const n=r(311),o=r(5048);class i extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.ORDER_BY}))}groupBy(e){return this.Clauses.groupBy(this.statement,e)}limit(e){return this.Clauses.limit(this.statement,e)}offset(e){return this.Clauses.offset(this.statement,e)}}t.OrderByClause=i},3667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectClause=void 0;const n=r(311),o=r(5048);class i extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.SELECT})),this.isDistinct=!1,this.isCount=!1,this.isMax=!1,this.isMin=!1,this.selector===o.Const.FULL_RECORD&&this.statement.setFullRecord(),this.statement.setMode(o.StatementType.QUERY)}distinct(e){return this.isDistinct=!0,this.selector=e,this}count(e){return this.selector=e,this}min(e){return this.selector=e,this}max(e){return this.selector=e,this}from(e){return this.Clauses.from(this.statement,e)}}t.SelectClause=i},311:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectorBasedClause=void 0;const i=r(550),a=r(2302);class s extends i.Clause{constructor(e){super(e),this.selector=void 0,this.selector=e.selector}toString(){return this.constructor.name+`[${this.selector}]`}}t.SelectorBasedClause=s,n([(0,a.required)(),o("design:type",Object)],s.prototype,"selector",void 0)},9333:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ValuesClause=void 0;const i=r(550),a=r(5048),s=r(2302);class c extends i.Clause{constructor(e){super(Object.assign({},e,{priority:a.Priority.FROM})),this.models=void 0,this.models=e?.models}}t.ValuesClause=c,n([(0,s.required)(),(0,s.type)(Array.name),o("design:type",Array)],c.prototype,"models",void 0)},4190:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.WhereClause=void 0;const i=r(550),a=r(1880),s=r(2302),c=r(5048);class u extends i.Clause{constructor(e){super(Object.assign({},e,{priority:c.Priority.WHERE})),this.condition=void 0,this.condition=e?.condition}orderBy(...e){return this.Clauses.orderBy(this.statement,e)}groupBy(e){return this.Clauses.groupBy(this.statement,e)}limit(e){return this.Clauses.limit(this.statement,e)}offset(e){return this.Clauses.offset(this.statement,e)}hasErrors(...e){return super.hasErrors(...e)||this.condition.hasErrors()}}t.WhereClause=u,n([(0,s.required)(),(0,s.type)("Condition"),o("design:type",a.Condition)],u.prototype,"condition",void 0)},7656:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1843),t),o(r(1997),t),o(r(8484),t),o(r(4006),t),o(r(7582),t),o(r(7068),t),o(r(3667),t),o(r(311),t),o(r(9333),t),o(r(4190),t)},5048:(e,t)=>{"use strict";var r,n,o,i,a;Object.defineProperty(t,"__esModule",{value:!0}),t.StatementType=t.MandatoryPriorities=t.Priority=t.Const=t.GroupOperator=t.Operator=void 0,function(e){e.EQUAL="EQUAL",e.DIFFERENT="DIFFERENT",e.BIGGER="BIGGER",e.BIGGER_EQ="BIGGER_EQ",e.SMALLER="SMALLER",e.SMALLER_EQ="SMALLER_EQ",e.NOT="NOT",e.IN="IN",e.REGEXP="REGEXP"}(r||(t.Operator=r={})),function(e){e.AND="AND",e.OR="OR"}(n||(t.GroupOperator=n={})),function(e){e.NULL="NULL",e.FULL_RECORD="*"}(o||(t.Const=o={})),function(e){e[e.FROM=1]="FROM",e[e.JOIN=1.1]="JOIN",e[e.WHERE=2]="WHERE",e[e.GROUP_BY=3]="GROUP_BY",e[e.HAVING=4]="HAVING",e[e.SELECT=5]="SELECT",e[e.ORDER_BY=6]="ORDER_BY",e[e.LIMIT=7]="LIMIT",e[e.OFFSET=7.1]="OFFSET"}(i||(t.Priority=i={})),t.MandatoryPriorities=[i.FROM,i.SELECT],function(e){e.QUERY="query",e.TRANSACTION="transaction"}(a||(t.StatementType=a={}))},500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PagingError=t.QueryError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.QueryError=o;class i extends n.BaseError{constructor(e){super(i.name,e)}}t.PagingError=i},1135:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(7656),t),o(r(550),t),o(r(940),t),o(r(1880),t),o(r(5048),t),o(r(500),t),o(r(1953),t),o(r(2354),t),o(r(5039),t),o(r(1989),t),o(r(6996),t),o(r(8780),t)},1953:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1989:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8780:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1317:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(5922),o=r(1111),i=r(2302),a=r(149),s=r(5039),c=r(5780),u=r(32),l=r(5205),f=r(5922),d=r(8470),p=r(7550);class h extends n.Repository{static{this._cache={}}get adapter(){if(!this._adapter)throw new n.InternalError("No adapter found for this repository. did you use the @uses decorator or pass it in the constructor?");return this._adapter}get tableName(){return this._tableName||(this._tableName=h.table(this.class)),this._tableName}constructor(e,t){if(super(t),this.observers=[],e&&(this._adapter=e),t&&(h.register(t,this),e)){const r=Reflect.getMetadata(o.Adapter.key(a.PersistenceKeys.ADAPTER),t);if(r&&r!==e.flavour)throw new n.InternalError("Incompatible flavours");(0,p.uses)(e.flavour)(t)}[this.createAll,this.readAll,this.updateAll,this.deleteAll].forEach((e=>{const t=e.name;(0,n.wrapMethodWithContext)(this,this[t+"Prefix"],e,this[t+"Suffix"])}))}async context(e){return this.adapter.context(e,this.class)}async create(e,...t){let{record:r,id:n}=this.adapter.prepare(e,this.pk);return r=await this.adapter.create(this.tableName,n,r,...t),this.adapter.revert(r,this.class,this.pk,n)}async createAll(e,...t){if(!e.length)return e;const r=e.map((e=>this.adapter.prepare(e,this.pk))),n=r.map((e=>e.id));let o=r.map((e=>e.record));return o=await this.adapter.createAll(this.tableName,n,o,...t),o.map(((e,t)=>this.adapter.revert(e,this.class,this.pk,n[t])))}async createAllPrefix(e,...t){const r=await f.Context.args(this,n.OperationKeys.CREATE,this.class,t);if(!e.length)return[e,...r.args];const o=h.getSequenceOptions(e[0]);let i=[];o.type&&(o.name||(o.name=l.Sequence.pk(e[0])),i=await(await this.adapter.Sequence(o)).range(e.length));const a=(e=await Promise.all(e.map((async(e,t)=>((e=new this.class(e))[this.pk]=i[t],await(0,n.enforceDBDecorators)(this,r.context,e,n.OperationKeys.CREATE,n.OperationKeys.ON),e))))).map((e=>e.hasErrors())).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(a)throw new n.ValidationError(a);return[e,...r.args]}async read(e,...t){const r=await this.adapter.read(this.tableName,e,...t);return this.adapter.revert(r,this.class,this.pk,e)}async update(e,...t){let{record:r,id:n}=this.adapter.prepare(e,this.pk);return r=await this.adapter.update(this.tableName,n,r,...t),this.adapter.revert(r,this.class,this.pk,n)}async updatePrefix(e,...t){const r=await f.Context.args(this,n.OperationKeys.UPDATE,this.class,t),o=e[this.pk];if(!o)throw new n.InternalError(`No value for the Id is defined under the property ${this.pk}`);const i=await this.read(o,...r.args);e=this.merge(i,e),await(0,n.enforceDBDecorators)(this,r.context,e,n.OperationKeys.UPDATE,n.OperationKeys.ON,i);const a=e.hasErrors(i,...h.relations(this.class));if(a)throw new n.ValidationError(a.toString());return h.getMetadata(i)&&(h.getMetadata(e)||h.setMetadata(e,h.getMetadata(i))),[e,...r.args]}async updateAllPrefix(e,...t){const r=await f.Context.args(this,n.OperationKeys.UPDATE,this.class,t),o=e.map((e=>{const t=e[this.pk];if(!t)throw new n.InternalError("missing id on update operation");return t})),i=await this.readAll(o,...r.args);e=e.map(((e,t)=>(e=this.merge(i[t],e),h.getMetadata(i[t])&&(h.getMetadata(e)||h.setMetadata(e,h.getMetadata(i[t]))),e))),await Promise.all(e.map(((e,t)=>(0,n.enforceDBDecorators)(this,r.context,e,n.OperationKeys.UPDATE,n.OperationKeys.ON,i[t]))));const a=e.map(((e,t)=>e.hasErrors(i[t],e))).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(a)throw new n.ValidationError(a);return[e,...r.args]}async delete(e,...t){const r=await this.adapter.delete(this.tableName,e,...t);return this.adapter.revert(r,this.class,this.pk,e)}select(e){return new s.Query(this.adapter).select(e).from(this.class)}async query(e,t,r=c.OrderDirection.ASC,n,o){const i=[t,r],a=this.select().where(e).orderBy(i);return n&&a.limit(n),o&&a.offset(o),a.execute()}async timestamp(){return this.adapter.timestamp()}observe(e){if(-1!==this.observers.indexOf(e))throw new n.InternalError("Observer already registered");this.observers.push(e)}unObserve(e){const t=this.observers.indexOf(e);if(-1===t)throw new n.InternalError("Failed to find Observer");this.observers.splice(t,1)}async updateObservers(...e){(await Promise.allSettled(this.observers.map((t=>t.refresh(...e))))).forEach(((e,t)=>{"rejected"===e.status&&console.warn(`Failed to update observable ${this.observers[t]}: ${e.reason}`)}))}static forModel(e){let t;try{t=this.get(e)}catch(e){t=h}if(t instanceof h)return t;const r=Reflect.getMetadata(o.Adapter.key(a.PersistenceKeys.ADAPTER),e)||Reflect.getMetadata(o.Adapter.key(a.PersistenceKeys.ADAPTER),t),i=r?o.Adapter.get(r):void 0;if(!i)throw new n.InternalError(`No registered persistence adapter found flavour ${r}`);return new t(i,e)}static get(e){const t=this.table(e);if(t in this._cache)return this._cache[t];throw new n.InternalError(`Could not find repository registered under ${t}`)}static register(e,t){const r=this.table(e);if(r in this._cache)throw new n.InternalError(`${r} already registered as a repository`);this._cache[r]=t}static setMetadata(e,t){Object.defineProperty(e,a.PersistenceKeys.METADATA,{enumerable:!1,configurable:!0,writable:!1,value:t})}static getMetadata(e){const t=Object.getOwnPropertyDescriptor(e,a.PersistenceKeys.METADATA);return t?t.value:void 0}static removeMetadata(e){Object.getOwnPropertyDescriptor(e,a.PersistenceKeys.METADATA)&&delete e[a.PersistenceKeys.METADATA]}static getSequenceOptions(e){const t=(0,n.findPrimaryKey)(e).id,r=Reflect.getMetadata(h.key(n.DBKeys.ID),e,t);if(!r)throw new n.InternalError("No sequence options defined for model. did you use the @pk decorator?");return r}static indexes(e){const t=(0,u.getAllPropertyDecorators)(e instanceof i.Model?e:new e,n.DBKeys.REFLECT);return Object.entries(t||{}).reduce(((e,[t,r])=>{const n=r.filter((e=>e.key.startsWith(a.PersistenceKeys.INDEX)));if(n&&n.length)for(const r of n){const{key:n,props:o}=r;e[t]=e[t]||{},e[t][n]=o}return e}),{})}static relations(e){const t=[];let r=e instanceof i.Model?Object.getPrototypeOf(e):e.prototype;for(;null!=r;){const e=r[a.PersistenceKeys.RELATIONS];e&&t.push(...e),r=Object.getPrototypeOf(r)}return t}static table(e){return(0,d.getTableName)(e)}static column(e,t){return Reflect.getMetadata(o.Adapter.key(a.PersistenceKeys.COLUMN),e,t)||t}}t.Repository=h},5780:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCascade=t.Cascade=t.OrderDirection=void 0,function(e){e.ASC="asc",e.DSC="desc"}(r||(t.OrderDirection=r={})),function(e){e.CASCADE="cascade",e.NONE="none"}(n||(t.Cascade=n={})),t.DefaultCascade={update:n.CASCADE,delete:n.NONE}},9383:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repository=function(e,t){return(r,s)=>s?(0,n.inject)(t||e.name)(r,s):((0,i.metadata)(a.Repository.key(o.DBKeys.REPOSITORY),t||r.name)(e),a.Repository.register(e,r),(0,n.injectable)(t||r.name,!0,(t=>{Object.defineProperty(t,o.DBKeys.CLASS,{enumerable:!1,configurable:!1,writable:!1,value:e})}))(r))};const n=r(465),o=r(5922),i=r(32),a=r(1317)},1136:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObserverError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.ObserverError=o},4315:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(5780),t),o(r(9383),t),o(r(1136),t),o(r(7849),t),o(r(1317),t),o(r(576),t),o(r(6500),t)},7849:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectablesRegistry=void 0;const n=r(465),o=r(1317),i=r(2302),a=r(6500),s=r(149),c=r(1111);class u extends n.InjectableRegistryImp{constructor(){super()}get(e){let t=super.get(e);if(!t)try{const r=i.Model.get(e);if(r&&(t=o.Repository.forModel(r)),t){if(t instanceof o.Repository)return t;const e=Reflect.getMetadata(c.Adapter.key(s.PersistenceKeys.ADAPTER),t.constructor)||Reflect.getMetadata(c.Adapter.key(s.PersistenceKeys.ADAPTER),r);n.Injectables.register(t,(0,a.generateInjectableNameForRepository)(r,e))}}catch(e){return}return t}}t.InjectablesRegistry=u},576:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateInjectableNameForRepository=function(e,t){if(!t){const r=i.Adapter.key(a.PersistenceKeys.ADAPTER);if(!(t=Reflect.getMetadata(r,e instanceof s.Model?e.constructor:e)))throw new n.InternalError(`Could not retrieve flavour from model ${e instanceof s.Model?e.constructor.name:e.name}`)}return(0,o.sf)(a.PersistenceKeys.INJECTABLE,t,c.Repository.table(e))};const n=r(5922),o=r(2302),i=r(1111),a=r(149),s=r(2302),c=r(1317)},2864:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ClauseSequenceValidator=void 0;const i=r(2302),a=r(32),s=r(550),c=r(5048),u=r(500),l=r(149);let f=class extends i.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES[l.PersistenceKeys.CLAUSE_SEQUENCE]){super(e)}validateSequence(e,t){return c.MandatoryPriorities.every((t=>!!e.find((e=>e.getPriority()===t))))?void 0:this.getMessage((0,i.sf)(t||this.message,"Missing required Clause Priorities"))}hasErrors(e,t){try{if(!(e&&Array.isArray(e)&&e.length&&e.every((e=>e instanceof s.Clause))))return this.getMessage((0,i.sf)(t||this.message,"No or invalid Clauses found"));const r=e,n=r.reduce(((e,t)=>{const r=t.hasErrors();return r&&(e?e+=(0,i.sf)("\nClause {0}: {1}",t.constructor.name,r.toString()):e=(0,i.sf)("Clause {0}: {1}",t.constructor.name,r.toString())),e}),void 0);if(n)return this.getMessage((0,i.sf)(t||this.message,n.toString()));if(!0!==(()=>{const e=r.map((e=>e.getPriority()));if(new Set(e).size!==e.length)return"Not all clauses have unique priorities";const t=e.sort(((e,t)=>t-e));return!!(0,a.isEqual)(e,t)||"Clauses are not properly sorted"})())return this.getMessage((0,i.sf)(t||this.message,"Invalid prioritization"));if(this.validateSequence(r,t))return this.getMessage((0,i.sf)(t||this.message,"Invalid sequence"))}catch(t){throw new u.QueryError((0,i.sf)("Failed to verify clause sequence {0}: {1}",e,t))}}};t.ClauseSequenceValidator=f,t.ClauseSequenceValidator=f=n([(0,i.validator)(l.PersistenceKeys.CLAUSE_SEQUENCE),o("design:paramtypes",[String])],f)},4776:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clauseSequence=function(e){return(0,n.propMetadata)(n.Validation.key(n.ValidationKeys.REQUIRED),{message:e||n.DEFAULT_ERROR_MESSAGES[o.PersistenceKeys.CLAUSE_SEQUENCE]})};const n=r(2302),o=r(7550);Object.defineProperty(n.DEFAULT_ERROR_MESSAGES,o.PersistenceKeys.CLAUSE_SEQUENCE,{value:"Invalid clause sequence: {0}"}),Object.defineProperty(n.ValidationKeys,"CLAUSE_SEQUENCE",{value:o.PersistenceKeys.CLAUSE_SEQUENCE})},5638:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(4776),t),o(r(2864),t)},9501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.id=function(){return(0,o.apply)((0,n.required)(),(0,i.readonly)(),(0,n.propMetadata)(s.Repository.key(a.DBKeys.ID),{}))};const n=r(2302),o=r(32),i=r(3162),a=r(4367),s=r(9191)},5537:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(9501),t),o(r(3802),t)},3802:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findPrimaryKey=s,t.findModelId=function(e,t=!1){const r=s(e).id,n=e[r];if(!n&&!t)throw new a.InternalError((0,i.sf)("No value for the Id is defined under the property {0}",r));return n};const n=r(4367),o=r(592),i=r(2302),a=r(3036);function s(e){const t=(0,o.getAllPropertyDecoratorsRecursive)(e,void 0,n.DBKeys.REFLECT+n.DBKeys.ID),r=Object.entries(t).reduce(((e,[t,r])=>{const n=r.filter((e=>e.key!==i.ModelKeys.TYPE));return n&&n.length&&(e[t]=e[t]||[],e[t].push(...n)),e}),{});if(!r||!Object.keys(r).length)throw new a.InternalError("Could not find ID decorated Property");if(Object.keys(r).length>1)throw new a.InternalError((0,i.sf)(Object.keys(r).join(", ")));const s=Object.keys(r)[0];if(!s)throw new a.InternalError("Could not find ID decorated Property");return{id:s,props:r[s][0].props}}},5922:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(5537),t),o(r(8403),t),o(r(2828),t),o(r(7781),t),o(r(9191),t),o(r(3162),t)},3949:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1101:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7674:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8403:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(3949),t),o(r(1101),t),o(r(7674),t)},4367:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_TIMESTAMP_FORMAT=t.DefaultSeparator=t.DBKeys=void 0;const n=r(2302);t.DBKeys={REFLECT:`${n.ModelKeys.REFLECT}persistence.`,REPOSITORY:"repository",CLASS:"_class",ID:"id",INDEX:"index",UNIQUE:"unique",SERIALIZE:"serialize",READONLY:"readonly",TIMESTAMP:"timestamp",HASH:"hash",COMPOSED:"composed",ORIGINAL:"__originalObj"},t.DefaultSeparator="_",t.DEFAULT_TIMESTAMP_FORMAT="dd/MM/yyyy HH:mm:ss:S"},3793:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hashOnCreateUpdate=u,t.hash=l,t.composedFromCreateUpdate=f,t.composedFromKeys=function(e,t=n.DefaultSeparator,r=!1,o="",i=""){return d(e,r,t,"keys",o,i)},t.composed=function(e,t=n.DefaultSeparator,r=!1,o="",i=""){return d(e,r,t,"values",o,i)};const n=r(4367),o=r(32),i=r(2302),a=r(6441),s=r(3036),c=r(9553);function u(e,t,r,n){if(!r[t])return;const o=i.Hashing.hash(r[t]);n&&r[t]===o||(r[t]=o)}function l(){return(0,o.apply)((0,a.onCreateUpdate)(u),(0,i.propMetadata)(c.Repository.key(n.DBKeys.HASH),{}))}function f(e,t,r,n){try{const{args:e,type:o,prefix:a,suffix:c,separator:u}=t,l=e.map((e=>{if(!(e in n))throw new s.InternalError((0,i.sf)("Property {0} not found to compose from",e));if("keys"===o)return e;if(void 0===n[e])throw new s.InternalError((0,i.sf)("Property {0} does not contain a value to compose from",e));return n[e].toString()}));a&&l.unshift(a),c&&l.push(c),n[r]=l.join(u)}catch(e){throw new s.InternalError(`Failed to compose value: ${e}`)}}function d(e,t=!1,r=n.DefaultSeparator,s="values",u="",d=""){const p={args:e,hashResult:t,separator:r,type:s,prefix:u,suffix:d},h=[(0,a.onCreateUpdate)(f,p),(0,i.propMetadata)(c.Repository.key(n.DBKeys.COMPOSED),p)];return t&&h.push(l()),(0,o.apply)(...h)}},2828:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(6569),t),o(r(4367),t),o(r(3793),t),o(r(9607),t)},9607:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2302),o=r(6569);n.Model.prototype.hasErrors=function(e,...t){!e||e instanceof n.Model||(t.unshift(e),e=void 0);const r=(0,n.validate)(this,...t);return r||!e?r:(0,o.validateCompare)(e,this,...t)}},6569:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateCompare=function(e,t,...r){const s=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&-1===r.indexOf(e)&&s.push((0,o.getPropertyDecorators)(i.UpdateValidationKeys.REFLECT,t,e));let c;for(const r of s){const{prop:o,decorators:i}=r;if(i.shift(),!i||!i.length)continue;let a;for(const s of i){const i=n.Validation.get(s.key);if(!i){console.error(`Could not find Matching validator for ${s.key} for property ${String(r.prop)}`);continue}const c=i.updateHasErrors(t[o.toString()],e[o.toString()],...Object.values(s.props));c&&(a=a||{},a[s.key]=c)}a&&(c=c||{},c[r.prop.toString()]=a)}for(const i of Object.keys(t).filter((e=>!(r.includes(e)||c&&c[e])))){let r;const s=(0,o.getPropertyDecorators)(n.ValidationKeys.REFLECT,t,i).decorators,u=(0,o.getPropertyDecorators)(n.ValidationKeys.REFLECT,t,i).decorators.filter((e=>-1!==[n.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!u||!u.length)continue;const l=u.pop(),f=l.props.name?[l.props.name]:Array.isArray(l.props.customTypes)?l.props.customTypes:[l.props.customTypes],d=Object.values(n.ReservedModels).map((e=>e.toLowerCase()));for(const o of f){if(-1===d.indexOf(o.toLowerCase()))switch(o){case Array.name:case Set.name:if(s.length&&s.find((e=>e.key===n.ValidationKeys.LIST))){let n,s;switch(o){case Array.name:n=t[i],s=e[i];break;case Set.name:n=t[i].values(),s=e[i].values();break;default:throw new Error(`Invalid attribute type ${o}`)}r=n.map((e=>{const t=(0,a.findModelId)(e,!0);if(!t)return"Failed to find model id";const r=s.find((e=>t===(0,a.findModelId)(e,!0)));return r?e.hasErrors(r):void 0})).filter((e=>!!e)),r?.length||(r=void 0)}break;default:try{t[i]&&e[i]&&(r=t[i].hasErrors(e[i]))}catch(e){console.warn((0,n.sf)("Model should be validatable but its not"))}}r&&(c=c||{},c[i]=r)}}return c?new n.ModelErrorDefinition(c):void 0};const n=r(2302),o=r(32),i=r(3162),a=r(5537)},9121:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Operations=void 0;const n=r(2302),o=r(4300),i=r(6050);class a{constructor(){}static getHandlerName(e){return e.name?e.name:(console.warn("Handler name not defined. A name will be generated, but this is not desirable. please avoid using anonymous functions"),n.Hashing.hash(e.toString()))}static key(e){return i.OperationKeys.REFLECT+e}static get(e,t,r){return a.registry.get(e,t,r)}static getOpRegistry(){return a.registry||(a.registry=new o.OperationsRegistry),a.registry}static register(e,t,r,n){a.getOpRegistry().register(e,t,r,n)}}t.Operations=a},4300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OperationsRegistry=void 0;const n=r(9121);t.OperationsRegistry=class{constructor(){this.cache={}}get(e,t,r,n){let o;n=n||[];try{o="string"==typeof e?e:e.constructor.name,n.unshift(...Object.values(this.cache[o][t][r]||[]))}catch(t){if("string"==typeof e||e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return n}let i=Object.getPrototypeOf(e);return i.constructor.name===o&&(i=Object.getPrototypeOf(i)),this.get(i,t,r,n)}register(e,t,r,o){const i=r.constructor.name,a=n.Operations.getHandlerName(e);this.cache[i]||(this.cache[i]={}),this.cache[i][o]||(this.cache[i][o]={}),this.cache[i][o][t]||(this.cache[i][o][t]={}),this.cache[i][o][t][a]||(this.cache[i][o][t][a]=e)}}},6050:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DBOperations=t.OperationKeys=void 0,function(e){e.REFLECT="decaf.model.db.operations.",e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.ON="on.",e.AFTER="after."}(r||(t.OperationKeys=r={})),t.DBOperations={CREATE:[r.CREATE],READ:[r.READ],UPDATE:[r.UPDATE],DELETE:[r.DELETE],CREATE_UPDATE:[r.CREATE,r.UPDATE],READ_CREATE:[r.READ,r.CREATE],ALL:[r.CREATE,r.READ,r.UPDATE,r.DELETE]}},6441:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onCreateUpdate=function(e,t){return s(n.DBOperations.CREATE_UPDATE,e,t)},t.onUpdate=function(e,t){return s(n.DBOperations.UPDATE,e,t)},t.onCreate=function(e,t){return s(n.DBOperations.CREATE,e,t)},t.onRead=function(e,t){return s(n.DBOperations.READ,e,t)},t.onDelete=function(e,t){return s(n.DBOperations.DELETE,e,t)},t.onAny=function(e,t){return s(n.DBOperations.ALL,e,t)},t.on=s,t.afterCreateUpdate=function(e,t){return c(n.DBOperations.CREATE_UPDATE,e,t)},t.afterUpdate=function(e,t){return c(n.DBOperations.UPDATE,e,t)},t.afterCreate=function(e,t){return c(n.DBOperations.CREATE,e,t)},t.afterRead=function(e,t){return c(n.DBOperations.READ,e,t)},t.afterDelete=function(e,t){return c(n.DBOperations.DELETE,e,t)},t.afterAny=function(e,t){return c(n.DBOperations.ALL,e,t)},t.after=c,t.operation=u;const n=r(6050),o=r(9121),i=r(32),a=r(2302);function s(e=n.DBOperations.ALL,t,r){return u(n.OperationKeys.ON,e,t,r)}function c(e=n.DBOperations.ALL,t,r){return u(n.OperationKeys.AFTER,e,t,r)}function u(e,t=n.DBOperations.ALL,r,s){return(n,c)=>{const u=n.constructor.name,l=t.reduce(((t,i)=>{const l=e+i;let f=Reflect.getMetadata(o.Operations.key(l),n,c);f||(f={operation:i,handlers:{}});const d=o.Operations.getHandlerName(r);return f.handlers[u]&&f.handlers[u][c]&&d in f.handlers[u][c]||(f.handlers[u]=f.handlers[u]||{},f.handlers[u][c]=f.handlers[u][c]||{},f.handlers[u][c][d]={data:s},t.push(function(e,t){return(r,n)=>{o.Operations.register(t,e,r,n)}}(l,r),(0,a.propMetadata)(o.Operations.key(l),f))),t}),[]);return(0,i.apply)(...l)(n,c)}}},7781:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(6050),t),o(r(6441),t),o(r(9121),t),o(r(4300),t),o(r(5970),t)},5970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2022:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRepository=void 0;const n=r(2302),o=r(592),i=r(6050),a=r(3036),s=r(749),c=r(3802),u=r(2586);t.BaseRepository=class{get class(){if(!this._class)throw new a.InternalError("No class definition found for this repository");return this._class}get pk(){return this._pk||(this._pk=(0,c.findPrimaryKey)(new this.class).id),this._pk}constructor(e){e&&(this._class=e);const t=this;[this.create,this.read,this.update,this.delete].forEach((e=>{const r=e.name;(0,s.wrapMethodWithContext)(t,t[r+"Prefix"],e,t[r+"Suffix"])}))}async timestamp(){return new Date}async context(e){return u.Context.from(e,this.class)}async create(e,...t){throw new Error("Child classes must implement this.")}async createAll(e,...t){return Promise.all(e.map((e=>this.create(e,...t))))}async createPrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.CREATE,this.class,t);return e=new this.class(e),await(0,o.enforceDBDecorators)(this,r.context,e,i.OperationKeys.CREATE,i.OperationKeys.ON),[e,...r.args]}async createSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.CREATE,i.OperationKeys.AFTER),e}async createAllPrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.CREATE,this.class,t);return await Promise.all(e.map((async e=>(e=new this.class(e),await(0,o.enforceDBDecorators)(this,r.context,e,i.OperationKeys.CREATE,i.OperationKeys.ON),e)))),[e,...r.args]}async createAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.CREATE,i.OperationKeys.AFTER)))),e}async read(e,...t){throw new Error("Child classes must implement this")}async readAll(e,...t){return await Promise.all(e.map((e=>this.read(e,...t))))}async readSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.READ,i.OperationKeys.AFTER),e}async readPrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.READ,this.class,t),n=new this.class;return n[this.pk]=e,await(0,o.enforceDBDecorators)(this,r.context,n,i.OperationKeys.READ,i.OperationKeys.ON),[e,...r.args]}async readAllPrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.READ,this.class,t);return await Promise.all(e.map((async e=>{const t=new this.class;return t[this.pk]=e,(0,o.enforceDBDecorators)(this,r.context,t,i.OperationKeys.READ,i.OperationKeys.ON)}))),[e,...r.args]}async readAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.READ,i.OperationKeys.AFTER)))),e}async update(e,...t){throw new Error("Child classes must implement this")}async updateAll(e,...t){return Promise.all(e.map((e=>this.update(e,...t))))}async updateSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.UPDATE,i.OperationKeys.AFTER),e}async updatePrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.UPDATE,this.class,t),n=e[this.pk];if(!n)throw new a.InternalError(`No value for the Id is defined under the property ${this.pk}`);const s=await this.read(n);return await(0,o.enforceDBDecorators)(this,r.context,e,i.OperationKeys.UPDATE,i.OperationKeys.ON,s),[e,...r.args]}async updateAllPrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.UPDATE,this.class,t);return await Promise.all(e.map((e=>(e=new this.class(e),(0,o.enforceDBDecorators)(this,r.context,e,i.OperationKeys.UPDATE,i.OperationKeys.ON),e)))),[e,...r.args]}async updateAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.UPDATE,i.OperationKeys.AFTER)))),e}async delete(e,...t){throw new Error("Child classes must implement this")}async deleteAll(e,...t){return Promise.all(e.map((e=>this.delete(e,...t))))}async deleteSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.DELETE,i.OperationKeys.AFTER),e}async deletePrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.DELETE,this.class,t),n=await this.read(e,...r.args);return await(0,o.enforceDBDecorators)(this,r.context,n,i.OperationKeys.DELETE,i.OperationKeys.ON),[e,...r.args]}async deleteAllPrefix(e,...t){const r=await u.Context.args(this,i.OperationKeys.DELETE,this.class,t),n=await this.readAll(e,...r.args);return await Promise.all(n.map((async e=>(0,o.enforceDBDecorators)(this,r.context,e,i.OperationKeys.DELETE,i.OperationKeys.ON)))),[e,...r.args]}async deleteAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,i.OperationKeys.DELETE,i.OperationKeys.AFTER)))),e}merge(e,t){const r=e=>Object.entries(e).reduce(((e,[t,r])=>(void 0!==r&&(e[t]=r),e)),{});return new this.class(Object.assign({},r(e),r(t)))}toString(){return(0,n.sf)("[{0}] - Repository for {1}",this.constructor.name,this.class.name)}}},2586:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;const n=r(8569),o=r(3036);class i extends n.DataCache{constructor(e,t,r){super(),this.operation=e,this.model=t,this.parent=r}async get(e){try{return super.get(e)}catch(t){if(this.parent)return this.parent.get(e);throw t}}async pop(e){if(e in this.cache)return super.pop(e);if(!this.parent)throw new o.NotFoundError(`Key ${e} not in dataStore`);return this.parent.pop(e)}child(e,t){return this.constructor(e,t,this)}static async from(e,t){return new i(e,t)}static async args(e,t,r,n){const o=n.pop();let a;return o?o instanceof i?(a=o,n.push(o)):(a=await e.context(t,r),n.push(o,a)):(a=await e.context(t,r),n.push(a)),{context:a,args:n}}}t.Context=i},8569:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataCache=void 0;const n=r(3036);t.DataCache=class{constructor(){this.cache={}}async get(e){if(!(e in this.cache))throw new n.NotFoundError(`Key ${e} not in dataStore`);return this.cache[e]}async push(e,t){if(e in this.cache)throw new n.ConflictError(`Key ${e} already in dataStore`);this.cache[e]=t}async put(e,t){this.cache[e]=t}async pop(e){const t=this.get(e);return delete this.cache[e],t}async filter(e){return"string"==typeof e&&(e=new RegExp(e)),Object.keys(this.cache).filter((t=>!!e.exec(t))).map((e=>this.cache[e]))}async purge(e){e?await this.pop(e):this.cache={}}}},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(592),o=r(6050),i=r(3036),a=r(2022),s=r(4367),c=r(2586);class u extends a.BaseRepository{constructor(e){super(e)}async create(e){throw new Error("Child classes must implement this.")}async createPrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.CREATE,this.class,t);e=new this.class(e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.CREATE,o.OperationKeys.ON);const a=e.hasErrors();if(a)throw new i.ValidationError(a.toString());return[e,...r.args]}async createAllPrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.CREATE,this.class,t);await Promise.all(e.map((async e=>(e=new this.class(e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.CREATE,o.OperationKeys.ON),e))));const a=e.map((e=>e.hasErrors())).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(a)throw new i.ValidationError(a);return[e,...r.args]}async delete(e){throw new Error("Child classes must implement this.")}async read(e){throw new Error("Child classes must implement this.")}async update(e){throw new Error("Child classes must implement this.")}async updatePrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.UPDATE,this.class,t),a=e[this.pk];if(!a)throw new i.InternalError(`No value for the Id is defined under the property ${this.pk}`);const s=await this.read(a);e=this.merge(s,e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.UPDATE,o.OperationKeys.ON,s);const u=e.hasErrors(s);if(u)throw new i.ValidationError(u.toString());return[e,...r.args]}async updateAllPrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.UPDATE,this.class,t),a=e.map((e=>{const t=e[this.pk];if(!t)throw new i.InternalError(`No value for the Id is defined under the property ${this.pk}`);return t})),s=await this.readAll(a,...r.args);e=e.map(((e,t)=>this.merge(s[t],e))),await Promise.all(e.map(((e,t)=>(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.UPDATE,o.OperationKeys.ON,s[t]))));const u=e.map(((e,t)=>e.hasErrors(s[t],e))).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(u)throw new i.ValidationError(u);return[e,...r.args]}static key(e){return s.DBKeys.REFLECT+e}}t.Repository=u},3036:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConflictError=t.NotFoundError=t.SerializationError=t.InternalError=t.ValidationError=t.BaseError=void 0;class r extends Error{constructor(e,t){if(t instanceof r)return t;super(`[${e}] ${t instanceof Error?t.message:t}`),t instanceof Error&&(this.stack=t.stack)}}t.BaseError=r;class n extends r{constructor(e){super(n.name,e)}}t.ValidationError=n;class o extends r{constructor(e){super(o.name,e)}}t.InternalError=o;class i extends r{constructor(e){super(i.name,e)}}t.SerializationError=i;class a extends r{constructor(e){super(a.name,e)}}t.NotFoundError=a;class s extends r{constructor(e){super(s.name,e)}}t.ConflictError=s},9191:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(2022),t),o(r(2586),t),o(r(8569),t),o(r(3036),t),o(r(9553),t),o(r(592),t),o(r(749),t)},592:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAllPropertyDecoratorsRecursive=t.getHandlerArgs=void 0,t.enforceDBDecorators=async function(e,r,i,u,l,f){const d=c(i,u,l);if(d)for(const c in d){const p=d[c];for(const d of p){const{key:p}=d,h=n.Operations.get(i,c,l+p);if(!h||!h.length)throw new a.InternalError(`Could not find registered handler for the operation ${l+p} under property ${c}`);const y=(0,t.getHandlerArgs)(d,c,i);if(!y||Object.values(y).length!==h.length)throw new a.InternalError((0,s.sf)("Args and handlers length do not match"));let g,b;for(let t=0;t<h.length;t++){g=h[t],b=Object.values(y)[t];const n=[r,b.data,c,i];if(u===o.OperationKeys.UPDATE&&l===o.OperationKeys.ON){if(!f)throw new a.InternalError("Missing old model for update operation");n.push(f)}await g.apply(e,n)}}}},t.getDbDecorators=c;const n=r(9121),o=r(6050),i=r(32),a=r(3036),s=r(2302);function c(e,t,r){const n=(0,i.getAllPropertyDecorators)(e,o.OperationKeys.REFLECT+(r||""));if(n)return Object.keys(n).reduce(((e,r)=>{const o=n[r].filter((e=>e.key===t));return o&&o.length&&(e||(e={}),e[r]=o),e}),void 0)}t.getHandlerArgs=function(e,r,n,o){const i=n.constructor.name;if(!i)throw new a.InternalError("Could not determine model class");o=o||{},e.props.handlers[i]&&e.props.handlers[i][r]&&(o={...e.props.handlers[i][r],...o});let s=Object.getPrototypeOf(n);return s===Object.prototype?o:(s.constructor.name===i&&(s=Object.getPrototypeOf(s)),(0,t.getHandlerArgs)(e,r,s,o))},t.getAllPropertyDecoratorsRecursive=function(e,r,...n){const a=r||{},c=(0,i.getAllPropertyDecorators)(e,...n);if(c&&function(e){Object.entries(e).forEach((([e,t])=>{a[e]=a[e]||[],((e,...t)=>{t.forEach((t=>{let r;if(!(r=a[e].find((e=>e.key===t.key)))||r.props.operation!==t.props.operation)return void a[e].push(t);if(t.key===s.ModelKeys.TYPE)return;const{handlers:n,operation:i}=t.props;if(!i||!i.match(new RegExp(`^(:?${o.OperationKeys.ON}|${o.OperationKeys.AFTER})(:?${o.OperationKeys.CREATE}|${o.OperationKeys.READ}|${o.OperationKeys.UPDATE}|${o.OperationKeys.DELETE})$`)))return void a[e].push(t);const c=r.props.handlers;Object.entries(n).forEach((([e,t])=>{e in c?Object.entries(t).forEach((([t,r])=>{t in c[e]?Object.entries(r).forEach((([r,n])=>{r in c[e][t]?console.warn((0,s.sf)("Skipping handler registration for {0} under prop {0} because handler is the same",e,t)):c[e][t][r]=n})):c[e][t]=r})):c[e]=t}))}))})(e,...t)}))}(c),Object.getPrototypeOf(e)===Object.prototype)return a;const u=Object.getPrototypeOf(e);return u?(0,t.getAllPropertyDecoratorsRecursive)(u,a,...n):a}},749:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prefixMethod=function(e,t,r,n){const o=async function(...e){const n=await Promise.resolve(r.call(this,...e));return Promise.resolve(t.apply(this,n))}.bind(e),i=n||t.name;Object.defineProperty(o,"name",{enumerable:!0,configurable:!0,writable:!1,value:i}),e[i]=o},t.suffixMethod=function(e,t,r,n){const o=async function(...e){const n=await Promise.resolve(t.call(this,...e));return r.call(this,...n)}.bind(e),i=n||t.name;Object.defineProperty(o,"name",{enumerable:!0,configurable:!0,writable:!1,value:i}),e[i]=o},t.wrapMethodWithContext=function(e,t,r,i,a){const s=async function(...a){let s=t.call(e,...a);s instanceof Promise&&(s=await s);const c=s[s.length-1];if(!(c instanceof n.Context))throw new o.InternalError("Missing a context");let u=await r.call(e,...s);return u instanceof Promise&&(u=await u),u=i.call(this,u,c),u instanceof Promise&&(u=await u),u}.bind(e),c=a||r.name;Object.defineProperty(s,"name",{enumerable:!0,configurable:!0,writable:!1,value:c}),e[c]=s};const n=r(2586),o=r(3036)},6753:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateValidationKeys=t.DEFAULT_ERROR_MESSAGES=void 0;const n=r(4367);t.DEFAULT_ERROR_MESSAGES={ID:{INVALID:"This Id is invalid",REQUIRED:"The Id is mandatory"},READONLY:{INVALID:"This cannot be updated"},TIMESTAMP:{REQUIRED:"Timestamp is Mandatory",DATE:"The Timestamp must the a valid date",INVALID:"This value must always increase"}},t.UpdateValidationKeys={REFLECT:"db.update.validation.",TIMESTAMP:n.DBKeys.TIMESTAMP,READONLY:n.DBKeys.READONLY}},9252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.readonly=function(e=i.DEFAULT_ERROR_MESSAGES.READONLY.INVALID){return(0,n.propMetadata)(n.Validation.updateKey(o.DBKeys.READONLY),{message:e})},t.timestampHandler=f,t.timestamp=function(e=a.DBOperations.CREATE_UPDATE,t=o.DEFAULT_TIMESTAMP_FORMAT){const r=[(0,n.date)(t,i.DEFAULT_ERROR_MESSAGES.TIMESTAMP.DATE),(0,n.required)(i.DEFAULT_ERROR_MESSAGES.TIMESTAMP.REQUIRED),(0,s.on)(e,f)];return-1!==e.indexOf(a.OperationKeys.UPDATE)&&r.push((0,n.propMetadata)(n.Validation.updateKey(o.DBKeys.TIMESTAMP),{message:i.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID})),(0,u.apply)(...r)},t.serializeOnCreateUpdate=d,t.serializeAfterAll=p,t.serialize=function(){return(0,u.apply)((0,s.onCreateUpdate)(d),(0,s.after)(a.DBOperations.ALL,p),(0,n.type)([String.name,Object.name]),(0,u.metadata)(l.Repository.key(o.DBKeys.SERIALIZE),{}))};const n=r(2302),o=r(4367),i=r(6753),a=r(6050),s=r(6441),c=r(3036),u=r(32),l=r(9191);async function f(e,t,r,n){n[r]=await this.timestamp()}async function d(e,t,r,o){if(r[t])try{r[t]=JSON.stringify(r[t])}catch(e){throw new c.SerializationError((0,n.sf)("Failed to serialize {0} property on {1} model: {2}",t,r.constructor.name,e.message))}}async function p(e,t,r){if(r[t]&&"string"==typeof r[t])try{r[t]=JSON.parse(r[t])}catch(e){throw new c.SerializationError((0,n.sf)("Failed to deserialize {0} property on {1} model: {2}",t,r.constructor.name,e.message))}}},3162:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1362),t),o(r(6753),t),o(r(9252),t),o(r(6723),t)},6723:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2302),o=r(6753);n.Validation.updateKey=function(e){return o.UpdateValidationKeys.REFLECT+e}},9174:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ReadOnlyValidator=void 0;const i=r(2302),a=r(6753),s=r(32);let c=class extends i.Validator{constructor(){super(a.DEFAULT_ERROR_MESSAGES.READONLY.INVALID)}hasErrors(e,...t){}updateHasErrors(e,t,r){if(void 0!==e)return(0,s.isEqual)(e,t)?void 0:this.getMessage(r||this.message)}};t.ReadOnlyValidator=c,t.ReadOnlyValidator=c=n([(0,i.validator)(a.UpdateValidationKeys.READONLY),o("design:paramtypes",[])],c)},8944:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TimestampValidator=void 0;const i=r(2302),a=r(6753);let s=class extends i.Validator{constructor(){super(a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID)}hasErrors(e,...t){}updateHasErrors(e,t,r){if(void 0!==e){r=r||this.getMessage(r||this.message);try{e=new Date(e),t=new Date(t)}catch(e){return r}return e<=t?r:void 0}}};t.TimestampValidator=s,t.TimestampValidator=s=n([(0,i.validator)(a.UpdateValidationKeys.TIMESTAMP),o("design:paramtypes",[])],s)},4981:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateValidator=void 0;const n=r(2302);class o extends n.Validator{constructor(e=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...t){super(e,...t)}}t.UpdateValidator=o},1362:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(9174),t),o(r(8944),t),o(r(4981),t)},2302:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(4072),t),o(r(5030),t),o(r(5643),t),t.VERSION="1.4.0"},3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Model=void 0;const n=r(4744),o=r(1825),i=r(32),a=r(2709),s=r(2252),c=r(9683),u=r(7675),l=r(5021),f=r(1318),d=r(8539);let p,h;class y{constructor(e){}hasErrors(...e){return(0,a.validate)(this,...e)}equals(e,...t){return(0,i.isEqual)(this,e,...t)}serialize(){return y.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}hash(){return y.hash(this)}static deserialize(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.SERIALIZATION),this.constructor);return t&&t.serializer?n.Serialization.deserialize(e,t.serializer,...t.args||[]):n.Serialization.deserialize(e)}static fromObject(e,t){t||(t={});for(const r of y.getAttributes(e))e[r]=t[r]||void 0;return e}static fromModel(e,t){let r,n;t||(t={});const o=y.getAttributes(e);for(const a of o){if(e[a]=t[a]||void 0,"object"!=typeof e[a])continue;const o=(0,c.isPropertyModel)(e,a);if(o){try{e[a]=y.build(e[a],"string"==typeof o?o:void 0)}catch(e){console.log(e)}continue}const s=(0,i.getPropertyDecorators)(l.ValidationKeys.REFLECT,e,a).decorators;if(r=s.filter((e=>-1!==[u.ModelKeys.TYPE,l.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,f.sf)("failed to find decorators for property {0}",a));n=r.pop();const p=n.props.name?[n.props.name]:Array.isArray(n.props.customTypes)?n.props.customTypes:[n.props.customTypes],h=Object.values(d.ReservedModels).map((e=>e.toLowerCase()));p.forEach((t=>{if(-1===h.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(s.length){const r=s.find((e=>e.key===l.ValidationKeys.LIST));if(r){const n=r.props.class.find((e=>!d.jsTypes.includes(e.toLowerCase())));if("Array"===t&&(e[a]=e[a].map((e=>["object","function"].includes(typeof e)&&n?y.build(e,n):e))),"Set"===t){const t=new Set;for(const r of e[a])["object","function"].includes(typeof r)&&n?t.add(y.build(r,n)):t.add(r);e[a]=t}}}break;default:e[a]&&(e[a]=y.build(e[a],t))}}catch(e){console.log(e)}}))}return e}static setBuilder(e){p=e}static getBuilder(){return p}static getRegistry(){return h||(h=new o.ModelRegistryManager),h}static setRegistry(e){h=e}static register(e,t){return y.getRegistry().register(e,t)}static get(e){return y.getRegistry().get(e)}static build(e={},t){return y.getRegistry().build(e,t)}static getMetadata(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.MODEL),e.constructor);if(!t)throw new Error("could not find metadata for provided "+e.constructor.name);return t}static getAttributes(e){const t=[];let r=e instanceof y?Object.getPrototypeOf(e):e.prototype;for(;null!=r;){const e=r[u.ModelKeys.ATTRIBUTE];e&&t.push(...e),r=Object.getPrototypeOf(r)}return t}static equals(e,t,...r){return(0,i.isEqual)(e,t,...r)}static hasErrors(e,...t){return(0,a.validate)(e,...t)}static serialize(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.SERIALIZATION),e.constructor);return t&&t.serializer?n.Serialization.serialize(this,t.serializer,...t.args||[]):n.Serialization.serialize(e)}static hash(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.HASHING),e.constructor);return t&&t.algorithm?s.Hashing.hash(e,t.algorithm,...t.args||[]):s.Hashing.hash(e)}static key(e){return u.ModelKeys.REFLECT+e}}t.Model=y},3368:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&Object.defineProperty(this,t,{enumerable:!0,configurable:!1,value:e[t],writable:!1})}toString(){const e=this;return Object.keys(e).filter((t=>Object.prototype.hasOwnProperty.call(e,t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},1825:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelRegistryManager=void 0,t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;n.Model.register(t,e.name)}))};const n=r(3),o=r(1318),i=r(9683);t.ModelRegistryManager=class{constructor(e=i.isModel){this.cache={},this.testFunction=e}register(e,t){if("function"!=typeof e)throw new Error("Model registering failed. Missing Class name or constructor");t=t||e.name,this.cache[t]=e}get(e){try{return this.cache[e]}catch(e){return}}build(e={},t){if(!t&&!this.testFunction(e))throw new Error("Provided obj is not a Model object");const r=t||n.Model.getMetadata(e);if(!(r in this.cache))throw new Error((0,o.sf)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}}},8539:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.jsTypes=t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={})),t.jsTypes=["string","array","number","boolean","symbol","function","object","undefined","null","bigint"]},4939:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)},t.findLastProtoBeforeObject=function(e){let t=Object.getPrototypeOf(e);if(t===Object.prototype)return e;for(;t!==Object.prototype;){if(t=Object.getPrototypeOf(t),t===Object.prototype)return t;if(Object.getPrototypeOf(t)===Object.prototype)return t}throw new Error("Could not find proper prototype")},t.bindModelPrototype=function(e){if(e instanceof n.Model)return;function t(e,t){Object.setPrototypeOf(e,t)}const r=Object.getPrototypeOf(e);if(r===Object.prototype)return t(e,n.Model.prototype);for(;r!==Object.prototype;){const e=Object.getPrototypeOf(r);if(e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return t(r,n.Model.prototype)}throw new Error("Could not find proper prototype to bind")};const n=r(3)},754:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.model=function(e){return t=>{const r=function(...r){const s=(0,n.construct)(t,...r);(0,n.bindModelPrototype)(s);const c=i.Model.getBuilder();return c&&c(s,r.length?r[0]:void 0),(0,a.metadata)(i.Model.key(o.ModelKeys.MODEL),t.name)(s.constructor),e&&e(s,...r),s};return r.prototype=t.prototype,Object.defineProperty(r,"name",{writable:!1,enumerable:!0,configurable:!1,value:t.prototype.constructor.name}),(0,a.metadata)(i.Model.key(o.ModelKeys.MODEL),t.name)(t),i.Model.register(r,t.name),r}},t.hashedBy=function(e,...t){return(0,a.metadata)(i.Model.key(o.ModelKeys.HASHING),{algorithm:e,args:t})},t.serializedBy=function(e,...t){return(0,a.metadata)(i.Model.key(o.ModelKeys.SERIALIZATION),{serializer:e,args:t})};const n=r(4939),o=r(7675),i=r(3),a=r(32)},5643:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(8539),t),o(r(4939),t),o(r(754),t),o(r(3),t),o(r(3368),t),o(r(1825),t),o(r(1967),t),o(r(9683),t),o(r(2709),t)},1967:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9683:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPropertyModel=function(e,t){if(i(e[t]))return!0;const r=Reflect.getMetadata(n.ModelKeys.TYPE,e,t);return o.Model.get(r.name)?r.name:void 0},t.isModel=i;const n=r(7675),o=r(3);function i(e){try{return e instanceof o.Model||!!o.Model.getMetadata(e)}catch(e){return!1}}},2709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validate=function(e,...t){const r=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&r.push((0,o.getPropertyDecorators)(u.ValidationKeys.REFLECT,e,n));let f;for(const t of r){const{prop:r,decorators:n}=t;if(!n||!n.length)continue;const o=n[0];let a;n.find((e=>e.key===u.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===o.props.name))))&&n.shift();for(const t of n){const n=c.Validation.get(t.key);if(!n)throw new Error(`Missing validator for ${t.key}`);const o=n.hasErrors(e[r.toString()],...t.key===i.ModelKeys.TYPE?[t.props]:Object.values(t.props));o&&(a=a||{},a[t.key]=o)}a&&(f=f||{},f[t.prop.toString()]=a)}for(const t of Object.keys(e).filter((e=>!f||!f[e]))){let r;const n=(0,o.getPropertyDecorators)(u.ValidationKeys.REFLECT,e,t).decorators,c=(0,o.getPropertyDecorators)(u.ValidationKeys.REFLECT,e,t).decorators.filter((e=>-1!==[i.ModelKeys.TYPE,u.ValidationKeys.TYPE].indexOf(e.key)));if(!c||!c.length)continue;const d=c.pop(),p=d.props.name?[d.props.name]:Array.isArray(d.props.customTypes)?d.props.customTypes:[d.props.customTypes],h=Object.values(s.ReservedModels).map((e=>e.toLowerCase()));for(const o of p){if(-1===h.indexOf(o.toLowerCase())){const i=Array.isArray(e[t])?u.ValidationKeys.LIST:u.ValidationKeys.TYPE,s=n.find((e=>e.key===i))||{};let c=[];if(s&&s.props){const r=Array.isArray(e[t])?s.props.class:s.props.customTypes;r&&(c=Array.isArray(r)?r.map((e=>`${e}`.toLowerCase())):[r.toLowerCase()])}const f=(e,t)=>{if("object"==typeof t||"function"==typeof t)return(0,l.isModel)(t)?t.hasErrors():c.includes(typeof t)?void 0:"Value has no validatable type"};switch(o){case Array.name:case Set.name:n.length&&n.find((e=>e.key===u.ValidationKeys.LIST))&&(r=(o===Array.name?e[t]:e[t].values()).map((e=>f(t,e))).filter((e=>!!e)),r?.length||(r=void 0));break;default:try{e[t]&&(r=f(t,e[t]))}catch(e){console.warn((0,a.sf)("Model should be validatable but its not: "+e))}}}r&&(f=f||{},f[t]=r)}}return f?new n.ModelErrorDefinition(f):void 0};const n=r(3368),o=r(32),i=r(7675),a=r(1318),s=r(8539),c=r(1375),u=r(5021),l=r(9683)},7675:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="decaf.model.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__model",e.CONSTRUCTION="constructed-by",e.ATTRIBUTE="__attributes",e.HASHING="hashing",e.SERIALIZATION="serialization"}(r||(t.ModelKeys=r={}))},5243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=i,t.bindDateToString=a,t.isValidDate=s,t.twoDigitPad=c,t.formatDate=u,t.parseDate=function(e,t){let r;if(t){if(t instanceof Date)try{r=i(u(t,e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=i(t,e);else if("number"==typeof t)r=i(u(new Date(t),e),e);else{if(!s(t))throw new Error(`Invalid value provided ${t}`);try{r=i(u(new Date(t),e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t,e))}}return a(r,e)}},r(8630);const n=r(5021),o=r(1318);function i(e,t){let r=t;r.match(/hh/)?r=r.replace("hh","(?<hour>\\d{2})"):r.match(/h/)?r=r.replace("h","(?<hour>\\d{1,2})"):r.match(/HH/)?r=r.replace("HH","(?<hour>\\d{2})"):r.match(/H/)&&(r=r.replace("H","(?<hour>\\d{1,2})")),r.match(/mm/)?r=r.replace("mm","(?<minutes>\\d{2})"):r.match(/m/)&&(r=r.replace("m","(?<minutes>\\d{1,2})")),r.match(/ss/)?r=r.replace("ss","(?<seconds>\\d{2})"):r.match(/s/)&&(r=r.replace("s","(?<seconds>\\d{1,2})")),r.match(/dd/)?r=r.replace("dd","(?<day>\\d{2})"):r.match(/d/)&&(r=r.replace("d","(?<day>\\d{1,2})")),r.match(/EEEE/)?r=r.replace("EEEE","(?<dayofweek>\\w+)"):r.match(/EEEE/)&&(r=r.replace("EEE","(?<dayofweek>\\w+)")),r.match(/yyyy/)?r=r.replace("yyyy","(?<year>\\d{4})"):r.match(/yy/)&&(r=r.replace("yy","(?<year>\\d{2})")),r.match(/MMMM/)?r=r.replace("MMMM","(?<monthname>\\w+)"):r.match(/MMM/)&&(r=r.replace("MMM","(?<monthnamesmall>\\w+)")),r.match(/MM/)?r=r.replace("MM","(?<month>\\d{2})"):r.match(/M/)&&(r=r.replace("M","(?<month>\\d{1,2})")),r=r.replace("S","(?<milis>\\d{1,3})").replace("aaa","(?<ampm>\\w{2})");const o=new RegExp(r,"g").exec(e);if(!o||!o.groups)return new Date(e);const i=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},a=i(o.groups.year),s=i(o.groups.day),c=o.groups.ampm;let u=i(o.groups.hour);c&&(u="PM"===c?u+12:u);const l=i(o.groups.minutes),f=i(o.groups.seconds),d=i(o.groups.milis),p=o.groups.monthname,h=o.groups.monthnamesmall;let y=o.groups.month;if(p)y=n.MONTH_NAMES.indexOf(p);else if(h){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(h.toLowerCase())));if(!t)return new Date(e);y=n.MONTH_NAMES.indexOf(t)}else y=i(`${y}`);return new Date(a,y-1,s,u,l,f,d)}function a(e,t){if(!e)return;const r=()=>u(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function s(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function c(e){return e<10?"0"+e:e.toString()}function u(e,t="yyyy/MM/dd"){const r=e.getDate(),o=e.getMonth(),i=e.getFullYear(),a=e.getHours(),s=e.getMinutes(),u=e.getSeconds(),l=e.getMilliseconds(),f=a%12,d=c(f),p=c(a),h=c(s),y=c(u),g=a<12?"AM":"PM",b=n.DAYS_OF_WEEK_NAMES[e.getDay()],m=b.substr(0,3),v=c(r),w=o+1,E=c(w),O=n.MONTH_NAMES[o],_=O.substr(0,3),R=i+"",S=R.substr(2,2);return(t=t.replace("hh",d).replace("h",f.toString()).replace("HH",p).replace("H",a.toString()).replace("mm",h).replace("m",s.toString()).replace("ss",y).replace("s",u.toString()).replace("S",l.toString()).replace("dd",v).replace("d",r.toString()).replace("EEEE",b).replace("EEE",m).replace("yyyy",R).replace("yy",S).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",O).replace("MMM",_):t.replace("MM",E).replace("M",w.toString())}},3042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prop=i,t.propMetadata=function(e,t){return(0,n.apply)(i(),(0,n.metadata)(e,t))};const n=r(32),o=r(7675);function i(e=o.ModelKeys.ATTRIBUTE){return(t,r)=>{let n;n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:t[e]=[],n.includes(r)||n.push(r)}}},2252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hashing=t.DefaultHashingMethod=void 0,t.hashCode=o,t.hashSerialization=function(e){return o(n.Serialization.serialize(e))},t.hashObj=i;const n=r(4744);function o(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t.toString()}function i(e){const t=function(e,t){const r=n(t);return"string"==typeof r?n((e||"")+n(t)):0|(e=((e=e||0)<<5)-e+r)},r=o,n=function(e){return void 0===e?"":-1!==["string","number","symbol"].indexOf(typeof e)?r(e.toString()):e instanceof Date?r(e.getTime()):Array.isArray(e)?e.reduce(t,void 0):Object.values(e).reduce(t,void 0)},i=Object.values(e).reduce(t,0);return("number"==typeof i?Math.abs(i):i).toString()}t.DefaultHashingMethod="default";class a{static{this.current=t.DefaultHashingMethod}static{this.cache={default:i}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw new Error(`No hashing method registered under ${e}`)}static register(e,t,r=!1){if(e in this.cache)throw new Error(`Hashing method ${e} already registered`);this.cache[e]=t,r&&(this.current=e)}static hash(e,t,...r){return t?this.get(t)(e,...r):this.get(this.current)(e,...r)}static setDefault(e){this.current=this.get(e)}}t.Hashing=a},4072:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(7675),t),o(r(5243),t),o(r(3042),t),o(r(2252),t),o(r(2417),t),o(r(4744),t),o(r(1318),t)},2417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Serialization=t.DefaultSerializationMethod=t.JSONSerializer=void 0;const n=r(3),o=r(7675);class i{preSerialize(e){const t=Object.assign({},e),r=n.Model.getMetadata(e);return t[o.ModelKeys.ANCHOR]=r||e.constructor.name,t}deserialize(e){const t=JSON.parse(e),r=t[o.ModelKeys.ANCHOR];if(!r)throw new Error("Could not find class reference in serialized model");return n.Model.build(t,r)}serialize(e){return JSON.stringify(this.preSerialize(e))}}t.JSONSerializer=i,t.DefaultSerializationMethod="json";class a{static{this.current=t.DefaultSerializationMethod}static{this.cache={json:new i}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw new Error(`No serialization method registered under ${e}`)}static register(e,t,r=!1){if(e in this.cache)throw new Error(`Serialization method ${e} already registered`);this.cache[e]=new t,r&&(this.current=e)}static serialize(e,t,...r){return t?this.get(t).serialize(e,...r):this.get(this.current).serialize(e,...r)}static deserialize(e,t,...r){return t?this.get(t).deserialize(e,...r):this.get(this.current).deserialize(e,...r)}static setDefault(e){this.current=this.get(e)}}t.Serialization=a},1318:(e,t)=>{"use strict";function r(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r].toString():"undefined"}))}Object.defineProperty(t,"__esModule",{value:!0}),t.sf=void 0,t.stringFormat=r,t.sf=r},1375:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(3201),o=r(5021);class i{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&i.actingValidatorRegistry&&i.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),i.actingValidatorRegistry=e}static getRegistry(){return i.actingValidatorRegistry||(i.actingValidatorRegistry=new n.ValidatorRegistry),i.actingValidatorRegistry}static get(e){return i.getRegistry().get(e)}static register(...e){return i.getRegistry().register(...e)}static key(e){return o.ValidationKeys.REFLECT+e}}t.Validation=i},3576:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.DATE){super(e,Number.name,Date.name,String.name)}hasErrors(e,t,r){if(void 0!==e)return"string"==typeof e&&(e=new Date(e)),isNaN(e.getDate())?this.getMessage(r||this.message):void 0}};t.DateValidator=c,t.DateValidator=c=n([(0,s.validator)(a.ValidationKeys.DATE),o("design:paramtypes",[String])],c)},5224:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const i=r(5021),a=r(6174),s=r(8024);let c=class extends a.PatternValidator{constructor(e=i.DEFAULT_ERROR_MESSAGES.EMAIL){super(e)}hasErrors(e,t,r){return super.hasErrors(e,t||i.DEFAULT_PATTERNS.EMAIL,r)}};t.EmailValidator=c,t.EmailValidator=c=n([(0,s.validator)(i.ValidationKeys.EMAIL),o("design:paramtypes",[String])],c)},2888:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.LIST){super(e,Array.name,Set.name)}hasErrors(e,t,r){if(!e||(Array.isArray(e)?!e.length:!e.size))return;t=Array.isArray(t)?t:[t];let n,o=!0;for(let r=0;r<(Array.isArray(e)?e.length:e.size);r++)switch(n=e[r],typeof n){case"object":case"function":o=t.includes(n.constructor?.name);break;default:o=t.some((e=>typeof n===e.toLowerCase()))}return o?void 0:this.getMessage(r||this.message,t)}};t.ListValidator=c,t.ListValidator=c=n([(0,s.validator)(a.ValidationKeys.LIST),o("design:paramtypes",[String])],c)},2382:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length>t?this.getMessage(r||this.message,t):void 0}};t.MaxLengthValidator=c,t.MaxLengthValidator=c=n([(0,s.validator)(a.ValidationKeys.MAX_LENGTH),o("design:paramtypes",[String])],c)},9378:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MAX){super(e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return e>t?this.getMessage(r||this.message,t):void 0}}};t.MaxValidator=c,t.MaxValidator=c=n([(0,s.validator)(a.ValidationKeys.MAX),o("design:paramtypes",[String])],c)},2396:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length<t?this.getMessage(r||this.message,t):void 0}};t.MinLengthValidator=c,t.MinLengthValidator=c=n([(0,s.validator)(a.ValidationKeys.MIN_LENGTH),o("design:paramtypes",[String])],c)},9320:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MIN){super(e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return e<t?this.getMessage(r||this.message,t):void 0}}};t.MinValidator=c,t.MinValidator=c=n([(0,s.validator)(a.ValidationKeys.MIN),o("design:paramtypes",[String])],c)},3317:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const i=r(6174),a=r(5021),s=r(8024);let c=class extends i.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.PASSWORD){super(e)}hasErrors(e,t,r){return super.hasErrors(e,t||a.DEFAULT_ERROR_MESSAGES.PASSWORD,r||this.message)}};t.PasswordValidator=c,t.PasswordValidator=c=n([(0,s.validator)(a.ValidationKeys.PASSWORD),o("design:paramtypes",[Object])],c)},6174:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=t.regexpParser=void 0;const i=r(7036),a=r(5021),s=r(8024);t.regexpParser=new RegExp("^/(.+)/([gimus]*)$");let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,"string")}getPattern(e){if(!t.regexpParser.test(e))return new RegExp(e);const r=e.match(t.regexpParser);return new RegExp(r[1],r[2])}hasErrors(e,t,r){if(e){if(!t)throw new Error("Missing Pattern");return(t="string"==typeof t?this.getPattern(t):t).lastIndex=0,t.test(e)?void 0:this.getMessage(r||this.message)}}};t.PatternValidator=c,t.PatternValidator=c=n([(0,s.validator)(a.ValidationKeys.PATTERN),o("design:paramtypes",[String])],c)},8089:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.REQUIRED){super(e)}hasErrors(e,t){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t||this.message):void 0;default:return e?void 0:this.getMessage(t||this.message)}}};t.RequiredValidator=c,t.RequiredValidator=c=n([(0,s.validator)(a.ValidationKeys.REQUIRED),o("design:paramtypes",[String])],c)},6942:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const i=r(7036),a=r(5021),s=r(8024);let c=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.STEP){super(e,"number","string")}hasErrors(e,t,r){if(void 0!==e)return Number(e)%Number(t)!=0?this.getMessage(r||this.message,t):void 0}};t.StepValidator=c,t.StepValidator=c=n([(0,s.validator)(a.ValidationKeys.STEP),o("design:paramtypes",[String])],c)},4972:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const i=r(7036),a=r(5021),s=r(8024),c=r(1375),u=r(32),l=r(7675);let f=class extends i.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.TYPE){super(e)}hasErrors(e,t,r){if(void 0!==e)return(0,u.evaluateDesignTypes)(e,t)?void 0:this.getMessage(r||this.message,"string"==typeof t?t:Array.isArray(t)?t.join(", "):t.name,typeof e)}};t.TypeValidator=f,t.TypeValidator=f=n([(0,s.validator)(a.ValidationKeys.TYPE),o("design:paramtypes",[String])],f),c.Validation.register({validator:f,validationKey:l.ModelKeys.TYPE,save:!1})},8689:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const i=r(5021),a=r(6174),s=r(8024);let c=class extends a.PatternValidator{constructor(e=i.DEFAULT_ERROR_MESSAGES.URL){super(e)}hasErrors(e,t,r){return super.hasErrors(e,t||i.DEFAULT_PATTERNS.URL,r)}};t.URLValidator=c,t.URLValidator=c=n([(0,s.validator)(i.ValidationKeys.URL),o("design:paramtypes",[String])],c)},7036:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(5021),o=r(1318),i=r(32);t.Validator=class{constructor(e=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...t){this.message=e,t.length&&(this.acceptedTypes=t),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,o.sf)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?(0,i.checkTypes)(t,this.acceptedTypes)?e(t,...r):this.getMessage(n.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},3201:(e,t)=>{"use strict";function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyCache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyCache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const o={};o[t.toUpperCase()]=t,this.customKeyCache=Object.assign({},this.customKeyCache,o)}}))}}},5021:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PATTERNS=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0;const n=r(7675);t.ValidationKeys={REFLECT:`${n.ModelKeys.REFLECT}validation.`,VALIDATOR:"validator",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={REQUIRED:"This field is required",MIN:"The minimum value is {0}",MAX:"The maximum value is {0}",MIN_LENGTH:"The minimum length is {0}",MAX_LENGTH:"The maximum length is {0}",PATTERN:"The value does not match the pattern",EMAIL:"The value is not a valid email",URL:"The value is not a valid URL",TYPE:"Invalid type. Expected {0}, received {1}",STEP:"Invalid value. Not a step of {0}",DATE:"Invalid value. not a valid Date",DEFAULT:"There is an Error",PASSWORD:"Must be at least 8 characters and contain one of number, lower and upper case letters, and special character (@$!%*?&_-.,)",LIST:"Invalid list of {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.DEFAULT_PATTERNS={EMAIL:/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,URL:/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,PASSWORD:{CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g}}},8024:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validator=function(...e){return(0,i.apply)((t=>(e.forEach((e=>{n.Validation.register({validator:t,validationKey:e,save:!0})})),t)),(0,i.metadata)(n.Validation.key(o.ValidationKeys.VALIDATOR),e))};const n=r(1375),o=r(5021),i=r(32)},70:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.Validators=void 0;const i=r(3576),a=r(4972),s=r(3317),c=r(6942),u=r(8689),l=r(6174),f=r(9320),d=r(2396),p=r(9378),h=r(2382),y=r(8089),g=r(5224),b=r(2888);o(r(5021),t),o(r(3576),t),o(r(8024),t),o(r(5224),t),o(r(2888),t),o(r(2382),t),o(r(9378),t),o(r(2396),t),o(r(9320),t),o(r(3317),t),o(r(6174),t),o(r(8089),t),o(r(6942),t),o(r(7045),t),o(r(4972),t),o(r(8689),t),o(r(7036),t),o(r(3201),t),t.Validators={DateValidator:i.DateValidator,EmailValidator:g.EmailValidator,ListValidator:b.ListValidator,MaxLengthValidator:h.MaxLengthValidator,MaxValidator:p.MaxValidator,MinLengthValidator:d.MinLengthValidator,MinValidator:f.MinValidator,PasswordValidator:s.PasswordValidator,PatternValidator:l.PatternValidator,RequiredValidator:y.RequiredValidator,StepValidator:c.StepValidator,TypeValidator:a.TypeValidator,URLValidator:u.URLValidator}},7045:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9944:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.required=function(e=n.DEFAULT_ERROR_MESSAGES.REQUIRED){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.REQUIRED),{message:e})},t.min=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.MIN),{value:e,message:t,types:[Number.name,Date.name]})},t.max=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.MAX),{value:e,message:t,types:[Number.name,Date.name]})},t.step=function(e,t=n.DEFAULT_ERROR_MESSAGES.STEP){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.STEP),{value:e,message:t,types:[Number.name]})},t.minlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.MIN_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.maxlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.MAX_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.pattern=function(e,t=n.DEFAULT_ERROR_MESSAGES.PATTERN){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.PATTERN),{value:"string"==typeof e?e:e.toString(),message:t,types:[String.name]})},t.email=function(e=n.DEFAULT_ERROR_MESSAGES.EMAIL){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.EMAIL),{pattern:n.DEFAULT_PATTERNS.EMAIL,message:e,types:[String.name]})},t.url=function(e=n.DEFAULT_ERROR_MESSAGES.URL){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.URL),{pattern:n.DEFAULT_PATTERNS.URL,message:e,types:[String.name]})},t.type=function(e,t=n.DEFAULT_ERROR_MESSAGES.TYPE){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.TYPE),{customTypes:e,message:t})},t.date=function(e="dd/MM/yyyy",t=n.DEFAULT_ERROR_MESSAGES.DATE){return(r,c)=>{(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]})(r,c);const u=new WeakMap;Object.defineProperty(r,c,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,c);r&&!r.configurable||Object.defineProperty(this,c,{enumerable:!0,configurable:!1,get:()=>u.get(this),set:t=>{let r;try{r=(0,i.parseDate)(e,t),u.set(this,r)}catch(e){console.error((0,o.sf)("Failed to parse date: {0}",e.message||e))}}}),this[c]=t},get(){console.log("here")}})}},t.password=function(e=n.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH,t=n.DEFAULT_ERROR_MESSAGES.PASSWORD){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]})},t.list=c,t.set=function(e,t=n.DEFAULT_ERROR_MESSAGES.LIST){return c(e,"Set",t)},r(8630);const n=r(5021),o=r(1318),i=r(5243),a=r(3042),s=r(1375);function c(e,t="Array",r=n.DEFAULT_ERROR_MESSAGES.LIST){return(0,a.propMetadata)(s.Validation.key(n.ValidationKeys.LIST),{class:Array.isArray(e)?e.map((e=>e.name)):[e.name],type:t,message:r})}},5030:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(70),t),o(r(9944),t),o(r(4213),t),o(r(1375),t)},4213:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},871:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Injectables=void 0;const n=r(3018);class o{static{this.actingInjectablesRegistry=void 0}constructor(){}static get(e,...t){return o.getRegistry().get(e,...t)}static register(e,...t){return o.getRegistry().register(e,...t)}static build(e,...t){return o.getRegistry().build(e,...t)}static setRegistry(e){o.actingInjectablesRegistry=e}static getRegistry(){return o.actingInjectablesRegistry||(o.actingInjectablesRegistry=new n.InjectableRegistryImp),o.actingInjectablesRegistry}static reset(){this.setRegistry(new n.InjectableRegistryImp)}static selectiveReset(e){const t="string"==typeof e?new RegExp(e):e;o.actingInjectablesRegistry.cache=Object.entries(o.actingInjectablesRegistry.cache).reduce(((e,[r,n])=>(r.match(t)||(e[r]=n),e)),{})}}t.Injectables=o},6030:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectablesKeys=void 0,t.InjectablesKeys={REFLECT:"inject.db.",INJECTABLE:"injectable",INJECT:"inject"}},8957:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inject=t.injectable=void 0;const n=r(6030),o=r(871),i=r(8730),a=e=>n.InjectablesKeys.REFLECT+e;t.injectable=(e=void 0,t=!1,r)=>i=>{const s=e||i.name,c=function(...e){let c=o.Injectables.get(s,...e);if(!c){if(o.Injectables.register(i,s,!0,t),c=o.Injectables.get(s,...e),!c)return;if(r)try{r(c)}catch(e){console.error(`Failed to call injectable callback for ${s}: ${e}`)}}const u=Object.assign({},{class:s});return Reflect.defineMetadata(a(n.InjectablesKeys.INJECTABLE),u,c.constructor),c};return c.prototype=i.prototype,Object.defineProperty(c,"name",{writable:!1,enumerable:!0,configurable:!1,value:i.prototype.constructor.name}),c},t.inject=(e,t)=>(r,s)=>{const c=new WeakMap,u=e||(0,i.getTypeFromDecorator)(r,s);if(!u)throw new Error("Could not get Type from decorator");Reflect.defineMetadata(a(n.InjectablesKeys.INJECT),{injectable:u},r,s),Object.defineProperty(r,s,{configurable:!0,get(){if(Object.getOwnPropertyDescriptor(r,s).configurable)return Object.defineProperty(this,s,{enumerable:!0,configurable:!1,get(){let e=c.get(this);if(!e){if(e=o.Injectables.get(u),!e)throw new Error(`Could not get Injectable ${u} to inject in ${r.constructor?r.constructor.name:r.name}'s ${s}`);if(t)try{e=t(e,r)}catch(e){console.error(e)}c.set(this,e)}return e}}),this[s]}})}},465:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(6030),t),o(r(8957),t),o(r(871),t),o(r(3018),t),o(r(8730),t),t.VERSION="1.4.4"},3018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectableRegistryImp=void 0,t.InjectableRegistryImp=class{constructor(){this.cache={}}get(e,...t){try{const r=this.cache[e],n={name:e};return(r.singleton||r.instance)&&r.instance||this.build(n,...t)}catch(e){return}}register(e,t=void 0,r=!0,n=!1){const o=e,i=!o.name&&o.constructor;if("function"!=typeof o&&!i)throw new Error("Injectable registering failed. Missing Class name or constructor");const a=t||(i&&i.name&&"Function"!==i.name?i.name:o.name);this.cache[a]&&!n||(this.cache[a]={instance:i?e:void 0,constructor:i?void 0:e,singleton:r})}build(e,...t){const{constructor:r,singleton:n}=this.cache[e.name],o=new r(...t);return this.cache[e.name]={instance:o,constructor:r,singleton:n},o}}},8730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeKey=void 0,t.getTypeFromDecorator=function(e,r){const n=Reflect.getMetadata(t.TypeKey,e,r);return"Function"!==n.name?n.name:void 0},r(8630),t.TypeKey="design:type"},1267:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ReflectionKeys=void 0,function(e){e.TYPE="design:type"}(r||(t.ReflectionKeys=r={}))},5530:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.metadata=function(e,t){return(r,n,o)=>{o?Reflect.defineMetadata(e,t,o.value):n?Reflect.defineMetadata(e,t,r,n):Reflect.defineMetadata(e,t,r)}},t.apply=function(...e){return(t,r,n)=>{for(const o of e)t instanceof Function&&!n?o(t):o(t,r,n)}},r(8630)},3032:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=function e(t,r,...n){if(t===r)return!0;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(!t||!r||"object"!=typeof t&&"object"!=typeof r)return t===r;if(null==t||null==r)return!1;if(typeof t!=typeof r)return!1;if(t.prototype!==r.prototype)return!1;const o=Object.keys(t).filter((e=>-1===n.indexOf(e)));return o.length===Object.keys(r).filter((e=>-1===n.indexOf(e))).length&&o.every((o=>-1!==n.indexOf(o)||e(t[o],r[o],...n)))}},32:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(1267),t),o(r(5530),t),o(r(3032),t),o(r(2199),t),o(r(3115),t),t.VERSION="0.3.1"},2199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3115:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPropertyDecorators=i,t.getTypeFromDecorator=function(e,t){const r=i(n.ReflectionKeys.TYPE,e,t,!1);if(!r||!r.decorators)return;const o=r.decorators.shift(),a=o.props?o.props.name:void 0;return"Function"!==a?a:void 0},t.getAllPropertyDecorators=function(e,...t){if(t&&t.length)return Object.getOwnPropertyNames(e).reduce(((r,n)=>(t.forEach(((t,o)=>{const a=i(t,e,n,0!==o);r||(r={}),function(e,t,r){r&&r.length&&(e[t]||(e[t]=[]),e[t].push(...r))}(r,n,a.decorators)})),r)),void 0)},t.getAllProperties=function(e,t=!0,r="Object"){const n=[];let o=e;const i=function(){if(!t)return;const e=Object.getPrototypeOf(o);return e&&e.constructor.name!==r?(o=e,o):void 0};do{Object.getOwnPropertyNames(o).forEach((function(e){-1===n.indexOf(e)&&n.push(e)}))}while(i());return n},t.getClassDecorators=function(e,t){return Reflect.getOwnMetadataKeys(t.constructor).filter((t=>t.toString().startsWith(e))).reduce(((r,n)=>{const o={key:n.substring(e.length),props:Reflect.getMetadata(n,t.constructor)};return r.concat(o)}),[])},t.checkType=a,t.checkTypes=s,t.evaluateDesignTypes=function(e,t){switch(typeof t){case"string":return a(e,t);case"object":return!Array.isArray(t)||s(e,t);case"function":return!t.name||"Object"===t.name||a(e,t.name);default:return!0}},r(8630);const n=r(1267),o=r(3032);function i(e,t,r,a=!1,s=!0,c){const u=function(e,t,r,o=!1,i){const a=Reflect.getMetadataKeys(t,r).filter((t=>o?t.toString().startsWith(e):t===n.ReflectionKeys.TYPE||t.toString().startsWith(e))).reduce(((o,i)=>{const a={key:i!==n.ReflectionKeys.TYPE?i.substring(e.length):i,props:Reflect.getMetadata(i,t,r)};return o.concat(a)}),i||[]);return{prop:r.toString(),decorators:a}}(e,t,r,a,c);return s&&Object.getPrototypeOf(t)!==Object.prototype?i(e,Object.getPrototypeOf(t.constructor),r,!0,s,u.decorators):{prop:u.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?((0,o.isEqual)(e.props,r[e.key])||console.log(`Found a similar decorator for the ${e.key} propertyof a ${t.constructor.name} model but with different attributes.The original one will be kept`),!1):(r[e.key.toString()]=e.props,!0)))}(u.decorators)}}function a(e,t){return typeof e===t||e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}function s(e,t){return!t.every((t=>!a(e,t)))}},6425:(e,t,r)=>{"use strict";function n(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,a=(s=Object.create(null),e=>{const t=o.call(e);return s[t]||(s[t]=t.slice(8,-1).toLowerCase())});var s;const c=e=>(e=e.toLowerCase(),t=>a(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,f=u("undefined"),d=c("ArrayBuffer"),p=u("string"),h=u("function"),y=u("number"),g=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==a(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},m=c("Date"),v=c("File"),w=c("Blob"),E=c("FileList"),O=c("URLSearchParams"),[_,R,S,A]=["ReadableStream","Request","Response","Headers"].map(c);function P(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),l(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(n=0;n<i;n++)a=o[n],t.call(null,e[a],a,e)}}function j(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,M=e=>!f(e)&&e!==T,D=(C="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>C&&e instanceof C);var C;const x=c("HTMLFormElement"),I=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),L=c("RegExp"),N=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};P(r,((r,o)=>{let i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)},k="abcdefghijklmnopqrstuvwxyz",B="0123456789",U={DIGIT:B,ALPHA:k,ALPHA_DIGIT:k+k.toUpperCase()+B},F=c("AsyncFunction"),K=(q="function"==typeof setImmediate,V=h(T.postMessage),q?setImmediate:V?(H=`axios@${Math.random()}`,$=[],T.addEventListener("message",(({source:e,data:t})=>{e===T&&t===H&&$.length&&$.shift()()}),!1),e=>{$.push(e),T.postMessage(H,"*")}):e=>setTimeout(e));var q,V,H,$;const G="undefined"!=typeof queueMicrotask?queueMicrotask.bind(T):"undefined"!=typeof process&&process.nextTick||K;var z={isArray:l,isArrayBuffer:d,isBuffer:function(e){return null!==e&&!f(e)&&null!==e.constructor&&!f(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=a(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:p,isNumber:y,isBoolean:e=>!0===e||!1===e,isObject:g,isPlainObject:b,isReadableStream:_,isRequest:R,isResponse:S,isHeaders:A,isUndefined:f,isDate:m,isFile:v,isBlob:w,isRegExp:L,isFunction:h,isStream:e=>g(e)&&h(e.pipe),isURLSearchParams:O,isTypedArray:D,isFileList:E,forEach:P,merge:function e(){const{caseless:t}=M(this)&&this||{},r={},n=(n,o)=>{const i=t&&j(r,o)||o;b(r[i])&&b(n)?r[i]=e(r[i],n):b(n)?r[i]=e({},n):l(n)?r[i]=n.slice():r[i]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&P(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:o}={})=>(P(t,((t,o)=>{r&&h(t)?e[o]=n(t,r):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,a,s;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)s=o[a],n&&!n(s,e,t)||c[s]||(t[s]=e[s],c[s]=!0);e=!1!==r&&i(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:c,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!y(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:x,hasOwnProperty:I,hasOwnProp:I,reduceDescriptors:N,freezeMethods:e=>{N(e,((t,r)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];h(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return l(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:j,global:T,isContextDefined:M,ALPHABET:U,generateString:(e=16,t=U.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(g(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=l(e)?[]:{};return P(e,((e,t)=>{const i=r(e,n+1);!f(i)&&(o[t]=i)})),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:F,isThenable:e=>e&&(g(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:K,asap:G};function W(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}z.inherits(W,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const Y=W.prototype,Q={};function J(e){return z.isPlainObject(e)||z.isArray(e)}function X(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function Z(e,t,r){return e?e.concat(t).map((function(e,t){return e=X(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Q[e]={value:e}})),Object.defineProperties(W,Q),Object.defineProperty(Y,"isAxiosError",{value:!0}),W.from=(e,t,r,n,o,i)=>{const a=Object.create(Y);return z.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),W.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};const ee=z.toFlatObject(z,{},null,(function(e){return/^is[A-Z]/.test(e)}));function te(e,t,r){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=z.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!z.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(z.isDate(e))return e.toISOString();if(!s&&z.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(e)||z.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,o){let s=e;if(e&&!o&&"object"==typeof e)if(z.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(z.isArray(e)&&function(e){return z.isArray(e)&&!e.some(J)}(e)||(z.isFileList(e)||z.endsWith(r,"[]"))&&(s=z.toArray(e)))return r=X(r),s.forEach((function(e,n){!z.isUndefined(e)&&null!==e&&t.append(!0===a?Z([r],n,i):null===a?r:r+"[]",c(e))})),!1;return!!J(e)||(t.append(Z(o,r,i),c(e)),!1)}const l=[],f=Object.assign(ee,{defaultVisitor:u,convertValue:c,isVisitable:J});if(!z.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!z.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),z.forEach(r,(function(r,i){!0===(!(z.isUndefined(r)||null===r)&&o.call(t,r,z.isString(i)?i.trim():i,n,f))&&e(r,n?n.concat(i):[i])})),l.pop()}}(e),t}function re(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ne(e,t){this._pairs=[],e&&te(e,this,t)}const oe=ne.prototype;function ie(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ae(e,t,r){if(!t)return e;const n=r&&r.encode||ie,o=r&&r.serialize;let i;if(i=o?o(t,r):z.isURLSearchParams(t)?t.toString():new ne(t,r).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}oe.append=function(e,t){this._pairs.push([e,t])},oe.toString=function(e){const t=e?function(t){return e.call(this,t,re)}:re;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var se=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},ce={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ue={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ne,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const le="undefined"!=typeof window&&"undefined"!=typeof document,fe="object"==typeof navigator&&navigator||void 0,de=le&&(!fe||["ReactNative","NativeScript","NS"].indexOf(fe.product)<0),pe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=le&&window.location.href||"http://localhost";var ye={...Object.freeze({__proto__:null,hasBrowserEnv:le,hasStandardBrowserWebWorkerEnv:pe,hasStandardBrowserEnv:de,navigator:fe,origin:he}),...ue};function ge(e){function t(e,r,n,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;return i=!i&&z.isArray(n)?n.length:i,s?(z.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&z.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&z.isArray(n[i])&&(n[i]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let i;for(n=0;n<o;n++)i=r[n],t[i]=e[i];return t}(n[i])),!a)}if(z.isFormData(e)&&z.isFunction(e.entries)){const r={};return z.forEachEntry(e,((e,n)=>{t(function(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const be={transitional:ce,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=z.isObject(e);if(o&&z.isHTMLForm(e)&&(e=new FormData(e)),z.isFormData(e))return n?JSON.stringify(ge(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return te(e,new ye.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return ye.isNode&&z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=z.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return te(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e){if(z.isString(e))try{return(0,JSON.parse)(e),z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||be.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ye.classes.FormData,Blob:ye.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],(e=>{be.headers[e]={}}));var me=be;const ve=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),we=Symbol("internals");function Ee(e){return e&&String(e).trim().toLowerCase()}function Oe(e){return!1===e||null==e?e:z.isArray(e)?e.map(Oe):String(e)}function _e(e,t,r,n,o){return z.isFunction(n)?n.call(this,t,r):(o&&(t=r),z.isString(t)?z.isString(n)?-1!==t.indexOf(n):z.isRegExp(n)?n.test(t):void 0:void 0)}class Re{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=Ee(t);if(!o)throw new Error("header name must be a non-empty string");const i=z.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Oe(e))}const i=(e,t)=>z.forEach(e,((e,r)=>o(e,r,t)));if(z.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&ve[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(z.isHeaders(e))for(const[t,n]of e.entries())o(n,t,r);else null!=e&&o(t,e,r);return this}get(e,t){if(e=Ee(e)){const r=z.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(z.isFunction(t))return t.call(this,e,r);if(z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ee(e)){const r=z.findKey(this,e);return!(!r||void 0===this[r]||t&&!_e(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=Ee(e)){const o=z.findKey(r,e);!o||t&&!_e(0,r[o],o,t)||(delete r[o],n=!0)}}return z.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!_e(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return z.forEach(this,((n,o)=>{const i=z.findKey(r,o);if(i)return t[i]=Oe(n),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(o):String(o).trim();a!==o&&delete t[o],t[a]=Oe(n),r[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return z.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&z.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[we]=this[we]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Ee(e);t[n]||(function(e,t){const r=z.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})}))}(r,e),t[n]=!0)}return z.isArray(e)?e.forEach(n):n(e),this}}Re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(Re.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),z.freezeMethods(Re);var Se=Re;function Ae(e,t){const r=this||me,n=t||r,o=Se.from(n.headers);let i=n.data;return z.forEach(e,(function(e){i=e.call(r,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function Pe(e){return!(!e||!e.__CANCEL__)}function je(e,t,r){W.call(this,null==e?"canceled":e,W.ERR_CANCELED,t,r),this.name="CanceledError"}function Te(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new W("Request failed with status code "+r.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}z.inherits(je,W,{__CANCEL__:!0});const Me=(e,t,r=3)=>{let n=0;const o=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[a];o||(o=c),r[i]=s,n[i]=c;let l=a,f=0;for(;l!==i;)f+=r[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;const d=u&&c-u;return d?Math.round(1e3*f/d):void 0}}(50,250);return function(e,t){let r,n,o=0,i=1e3/t;const a=(t,i=Date.now())=>{o=i,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(r=e,n||(n=setTimeout((()=>{n=null,a(r)}),i-s)))},()=>r&&a(r)]}((r=>{const i=r.loaded,a=r.lengthComputable?r.total:void 0,s=i-n,c=o(s);n=i,e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:r,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),r)},De=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ce=e=>(...t)=>z.asap((()=>e(...t)));var xe=ye.hasStandardBrowserEnv?function(){const e=ye.navigator&&/(msie|trident)/i.test(ye.navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=z.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0},Ie=ye.hasStandardBrowserEnv?{write(e,t,r,n,o,i){const a=[e+"="+encodeURIComponent(t)];z.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),z.isString(n)&&a.push("path="+n),z.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Le(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ne=e=>e instanceof Se?{...e}:e;function ke(e,t){t=t||{};const r={};function n(e,t,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function o(e,t,r){return z.isUndefined(t)?z.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!z.isUndefined(t))return n(void 0,t)}function a(e,t){return z.isUndefined(t)?z.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,o,i){return i in t?n(r,o):i in e?n(void 0,r):void 0}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>o(Ne(e),Ne(t),!0)};return z.forEach(Object.keys(Object.assign({},e,t)),(function(n){const i=c[n]||o,a=i(e[n],t[n],n);z.isUndefined(a)&&i!==s||(r[n]=a)})),r}var Be=e=>{const t=ke({},e);let r,{data:n,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:a,headers:s,auth:c}=t;if(t.headers=s=Se.from(s),t.url=ae(Le(t.baseURL,t.url),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),z.isFormData(n))if(ye.hasStandardBrowserEnv||ye.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(r=s.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(ye.hasStandardBrowserEnv&&(o&&z.isFunction(o)&&(o=o(t)),o||!1!==o&&xe(t.url))){const e=i&&a&&Ie.read(a);e&&s.set(i,e)}return t},Ue="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=Be(e);let o=n.data;const i=Se.from(n.headers).normalize();let a,s,c,u,l,{responseType:f,onUploadProgress:d,onDownloadProgress:p}=n;function h(){u&&u(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(a),n.signal&&n.signal.removeEventListener("abort",a)}let y=new XMLHttpRequest;function g(){if(!y)return;const n=Se.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());Te((function(e){t(e),h()}),(function(e){r(e),h()}),{data:f&&"text"!==f&&"json"!==f?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:n,config:e,request:y}),y=null}y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout,"onloadend"in y?y.onloadend=g:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(g)},y.onabort=function(){y&&(r(new W("Request aborted",W.ECONNABORTED,e,y)),y=null)},y.onerror=function(){r(new W("Network Error",W.ERR_NETWORK,e,y)),y=null},y.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||ce;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new W(t,o.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,y)),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&z.forEach(i.toJSON(),(function(e,t){y.setRequestHeader(t,e)})),z.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),f&&"json"!==f&&(y.responseType=n.responseType),p&&([c,l]=Me(p,!0),y.addEventListener("progress",c)),d&&y.upload&&([s,u]=Me(d),y.upload.addEventListener("progress",s),y.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(a=t=>{y&&(r(!t||t.type?new je(null,e,y):t),y.abort(),y=null)},n.cancelToken&&n.cancelToken.subscribe(a),n.signal&&(n.signal.aborted?a():n.signal.addEventListener("abort",a)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===ye.protocols.indexOf(b)?r(new W("Unsupported protocol "+b+":",W.ERR_BAD_REQUEST,e)):y.send(o||null)}))},Fe=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const o=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof W?t:new je(t instanceof Error?t.message:t))}};let i=t&&setTimeout((()=>{i=null,o(new W(`timeout ${t} of ms exceeded`,W.ETIMEDOUT))}),t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:s}=n;return s.unsubscribe=()=>z.asap(a),s}};const Ke=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,o=0;for(;o<r;)n=o+t,yield e.slice(o,n),o=n},qe=(e,t,r,n)=>{const o=async function*(e,t){for await(const r of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}}(e))yield*Ke(r,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return s(),void e.close();let i=n.byteLength;if(r){let e=a+=i;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},Ve="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,He=Ve&&"function"==typeof ReadableStream,$e=Ve&&("function"==typeof TextEncoder?(Ge=new TextEncoder,e=>Ge.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ge;const ze=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},We=He&&ze((()=>{let e=!1;const t=new Request(ye.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Ye=He&&ze((()=>z.isReadableStream(new Response("").body))),Qe={stream:Ye&&(e=>e.body)};var Je;Ve&&(Je=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Qe[e]&&(Qe[e]=z.isFunction(Je[e])?t=>t[e]():(t,r)=>{throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,r)})})));const Xe={http:null,xhr:Ue,fetch:Ve&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:i,timeout:a,onDownloadProgress:s,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:d}=Be(e);u=u?(u+"").toLowerCase():"text";let p,h=Fe([o,i&&i.toAbortSignal()],a);const y=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(c&&We&&"get"!==r&&"head"!==r&&0!==(g=await(async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e)){const t=new Request(ye.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return z.isArrayBufferView(e)||z.isArrayBuffer(e)?e.byteLength:(z.isURLSearchParams(e)&&(e+=""),z.isString(e)?(await $e(e)).byteLength:void 0)})(t):r})(l,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(z.isFormData(n)&&(e=r.headers.get("content-type"))&&l.setContentType(e),r.body){const[e,t]=De(g,Me(Ce(c)));n=qe(r.body,65536,e,t)}}z.isString(f)||(f=f?"include":"omit");const o="credentials"in Request.prototype;p=new Request(t,{...d,signal:h,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:o?f:void 0});let i=await fetch(p);const a=Ye&&("stream"===u||"response"===u);if(Ye&&(s||a&&y)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=i[t]}));const t=z.toFiniteNumber(i.headers.get("content-length")),[r,n]=s&&De(t,Me(Ce(s),!0))||[];i=new Response(qe(i.body,65536,r,(()=>{n&&n(),y&&y()})),e)}u=u||"text";let b=await Qe[z.findKey(Qe,u)||"text"](i,e);return!a&&y&&y(),await new Promise(((t,r)=>{Te(t,r,{data:b,headers:Se.from(i.headers),status:i.status,statusText:i.statusText,config:e,request:p})}))}catch(t){if(y&&y(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,p),{cause:t.cause||t});throw W.from(t,t&&t.code,e,p)}})};z.forEach(Xe,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Ze=e=>`- ${e}`,et=e=>z.isFunction(e)||null===e||!1===e;var tt=e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let i=0;i<t;i++){let t;if(r=e[i],n=r,!et(r)&&(n=Xe[(t=String(r)).toLowerCase()],void 0===n))throw new W(`Unknown adapter '${t}'`);if(n)break;o[t||"#"+i]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new W("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ze).join("\n"):" "+Ze(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function rt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new je(null,e)}function nt(e){return rt(e),e.headers=Se.from(e.headers),e.data=Ae.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),tt(e.adapter||me.adapter)(e).then((function(t){return rt(e),t.data=Ae.call(e,e.transformResponse,t),t.headers=Se.from(t.headers),t}),(function(t){return Pe(t)||(rt(e),t&&t.response&&(t.response.data=Ae.call(e,e.transformResponse,t.response),t.response.headers=Se.from(t.response.headers))),Promise.reject(t)}))}const ot={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{ot[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const it={};ot.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.7] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,i)=>{if(!1===e)throw new W(n(o," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!it[o]&&(it[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var at={assertOptions:function(e,t,r){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const i=n[o],a=t[i];if(a){const t=e[i],r=void 0===t||a(t,i,e);if(!0!==r)throw new W("option "+i+" must be "+r,W.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new W("Unknown option "+i,W.ERR_BAD_OPTION)}},validators:ot};const st=at.validators;class ct{constructor(e){this.defaults=e,this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ke(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;void 0!==r&&at.assertOptions(r,{silentJSONParsing:st.transitional(st.boolean),forcedJSONParsing:st.transitional(st.boolean),clarifyTimeoutError:st.transitional(st.boolean)},!1),null!=n&&(z.isFunction(n)?t.paramsSerializer={serialize:n}:at.assertOptions(n,{encode:st.function,serialize:st.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&z.merge(o.common,o[t.method]);o&&z.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=Se.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,f=0;if(!s){const e=[nt.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);f<l;)u=u.then(e[f++],e[f++]);return u}l=a.length;let d=t;for(f=0;f<l;){const e=a[f++],t=a[f++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=nt.call(this,d)}catch(e){return Promise.reject(e)}for(f=0,l=c.length;f<l;)u=u.then(c[f++],c[f++]);return u}getUri(e){return ae(Le((e=ke(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}z.forEach(["delete","get","head","options"],(function(e){ct.prototype[e]=function(t,r){return this.request(ke(r||{},{method:e,url:t,data:(r||{}).data}))}})),z.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,o){return this.request(ke(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ct.prototype[e]=t(),ct.prototype[e+"Form"]=t(!0)}));var ut=ct;class lt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,o){r.reason||(r.reason=new je(e,n,o),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new lt((function(t){e=t})),cancel:e}}}var ft=lt;const dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dt).forEach((([e,t])=>{dt[t]=e}));var pt=dt;const ht=function e(t){const r=new ut(t),o=n(ut.prototype.request,r);return z.extend(o,ut.prototype,r,{allOwnKeys:!0}),z.extend(o,r,null,{allOwnKeys:!0}),o.create=function(r){return e(ke(t,r))},o}(me);ht.Axios=ut,ht.CanceledError=je,ht.CancelToken=ft,ht.isCancel=Pe,ht.VERSION="1.7.7",ht.toFormData=te,ht.AxiosError=W,ht.Cancel=ht.CanceledError,ht.all=function(e){return Promise.all(e)},ht.spread=function(e){return function(t){return e.apply(null,t)}},ht.isAxiosError=function(e){return z.isObject(e)&&!0===e.isAxiosError},ht.mergeConfig=ke,ht.AxiosHeaders=Se,ht.formToJSON=e=>ge(z.isHTMLForm(e)?new FormData(e):e),ht.getAdapter=tt,ht.HttpStatusCode=pt,ht.default=ht,e.exports=ht},8630:(e,t,r)=>{var n;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=o(e);function o(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(n=o(t.Reflect,n)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,o=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",a="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!a&&!s,u={create:a?function(){return q(Object.create(null))}:s?function(){return q({__proto__:null})}:function(){return q({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),f="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[i]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,o=r+1;o<n;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,I(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,o)},t.prototype.entries=function(){return new r(this._keys,this._values,a)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[i]=function(){return this.entries()},t.prototype._find=function(e,t){if(!I(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(I(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function o(e,t){return t}function a(e,t){return[e,t]}}(),d="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new f}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[i]=function(){return this.keys()},e}(),p="function"==typeof WeakMap?WeakMap:function(){var e=u.create(),t=n();return function(){function e(){this._key=n()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=n()},e}();function n(){var t;do{t="@@WeakMap@@"+a()}while(u.has(e,t));return e[t]=!0,t}function o(e,n){if(!r.call(e,t)){if(!n)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function i(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function a(){var e=function(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):i(t,e),t}return i(new Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",r=0;r<16;++r){var n=e[r];4!==r&&6!==r&&8!==r||(t+="-"),n<16&&(t+="0"),t+=n.toString(16).toLowerCase()}return t}}(),h=n?Symbol.for("@reflect-metadata:registry"):void 0,y=function(){var e;return!S(h)&&P(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[h]),S(e)&&(e=function(){var e,r,n,o;S(h)||void 0===t.Reflect||h in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,o=e.getOwnMetadataKeys,i=e.deleteMetadata,a=new p;return{isProviderFor:function(e,t){var r=a.get(e);return!(S(r)||!r.has(t))||!!o(e,t).length&&(S(r)&&(r=new d,a.set(e,r)),r.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:o,OrdinaryDeleteMetadata:i}}(t.Reflect));var i=new p,a={registerProvider:s,getProvider:u,setProvider:y};return a;function s(t){if(!Object.isExtensible(a))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case S(r):r=t;break;case r===t:break;case S(n):n=t;break;case n===t:break;default:void 0===o&&(o=new d),o.add(t)}}function c(t,i){if(!S(r)){if(r.isProviderFor(t,i))return r;if(!S(n)){if(n.isProviderFor(t,i))return r;if(!S(o))for(var a=N(o);;){var s=B(a);if(!s)return;var c=k(s);if(c.isProviderFor(t,i))return U(a),c}}}if(!S(e)&&e.isProviderFor(t,i))return e}function u(e,t){var r,n=i.get(e);return S(n)||(r=n.get(t)),S(r)?(S(r=c(e,t))||(S(n)&&(n=new f,i.set(e,n)),n.set(t,r)),r):r}function l(e){if(S(e))throw new TypeError;return r===e||n===e||!S(o)&&o.has(e)}function y(e,t,r){if(!l(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!S(n))return!1;var o=i.get(e);S(o)&&(o=new f,i.set(e,o)),o.set(t,r)}return!0}}()),!S(h)&&P(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,h,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new p,r={isProviderFor:function(e,r){var n=t.get(e);return!S(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,o){n(r,o,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var o=n(t,r,!1);return!S(o)&&T(o.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var o=n(t,r,!1);if(!S(o))return o.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],o=n(e,t,!1);if(S(o))return r;for(var i=N(o.keys()),a=0;;){var s=B(i);if(!s)return r.length=a,r;var c=k(s);try{r[a]=c}catch(e){try{U(i)}finally{throw e}}a++}},OrdinaryDeleteMetadata:function(e,r,o){var i=n(r,o,!1);if(S(i))return!1;if(!i.delete(e))return!1;if(0===i.size){var a=t.get(r);S(a)||(a.delete(o),0===a.size&&t.delete(a))}return!0}};return y.registerProvider(r),r;function n(n,o,i){var a=t.get(n),s=!1;if(S(a)){if(!i)return;a=new f,t.set(n,a),s=!0}var c=a.get(o);if(S(c)){if(!i)return;if(c=new f,a.set(o,c),!e.setProvider(n,o,r))throw a.delete(o),s&&t.delete(n),new Error("Wrong provider for target.")}return c}}(y);function b(e,t,r){if(m(e,t,r))return!0;var n=F(t);return!A(n)&&b(e,n,r)}function m(e,t,r){var n=K(t,r,!1);return!S(n)&&T(n.OrdinaryHasOwnMetadata(e,t,r))}function v(e,t,r){if(m(e,t,r))return w(e,t,r);var n=F(t);return A(n)?void 0:v(e,n,r)}function w(e,t,r){var n=K(t,r,!1);if(!S(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function E(e,t,r,n){K(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function O(e,t){var r=_(e,t),n=F(e);if(null===n)return r;var o=O(n,t);if(o.length<=0)return r;if(r.length<=0)return o;for(var i=new d,a=[],s=0,c=r;s<c.length;s++){var u=c[s];i.has(u)||(i.add(u),a.push(u))}for(var l=0,f=o;l<f.length;l++)u=f[l],i.has(u)||(i.add(u),a.push(u));return a}function _(e,t){var r=K(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function R(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function S(e){return void 0===e}function A(e){return null===e}function P(e){return"object"==typeof e?null!==e:"function"==typeof e}function j(e,t){switch(R(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=L(e,o);if(void 0!==n){var i=n.call(e,r);if(P(i))throw new TypeError;return i}return function(e,t){if("string"===t){var r=e.toString;if(C(r)&&!P(o=r.call(e)))return o;if(C(n=e.valueOf)&&!P(o=n.call(e)))return o}else{var n;if(C(n=e.valueOf)&&!P(o=n.call(e)))return o;var o,i=e.toString;if(C(i)&&!P(o=i.call(e)))return o}throw new TypeError}(e,"default"===r?"number":r)}function T(e){return!!e}function M(e){var t=j(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function D(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function C(e){return"function"==typeof e}function x(e){return"function"==typeof e}function I(e,t){return e===t||e!=e&&t!=t}function L(e,t){var r=e[t];if(null!=r){if(!C(r))throw new TypeError;return r}}function N(e){var t=L(e,i);if(!C(t))throw new TypeError;var r=t.call(e);if(!P(r))throw new TypeError;return r}function k(e){return e.value}function B(e){var t=e.next();return!t.done&&t}function U(e){var t=e.return;t&&t.call(e)}function F(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var o=n.constructor;return"function"!=typeof o||o===e?t:o}function K(e,t,r){var n=y.getProvider(e,t);if(!S(n))return n;if(r){if(y.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function q(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(S(r)){if(!D(e))throw new TypeError;if(!x(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!S(n)&&!A(n)){if(!x(n))throw new TypeError;t=n}}return t}(e,t)}if(!D(e))throw new TypeError;if(!P(t))throw new TypeError;if(!P(n)&&!S(n)&&!A(n))throw new TypeError;return A(n)&&(n=void 0),function(e,t,r,n){for(var o=e.length-1;o>=0;--o){var i=(0,e[o])(t,r,n);if(!S(i)&&!A(i)){if(!P(i))throw new TypeError;n=i}}return n}(e,t,r=M(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!P(r))throw new TypeError;if(!S(n)&&!function(e){switch(R(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;E(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!P(r))throw new TypeError;return S(n)||(n=M(n)),E(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=M(r)),b(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=M(r)),m(e,t,r)})),e("getMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=M(r)),v(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=M(r)),w(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!P(e))throw new TypeError;return S(t)||(t=M(t)),O(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!P(e))throw new TypeError;return S(t)||(t=M(t)),_(e,t)})),e("deleteMetadata",(function(e,t,r){if(!P(t))throw new TypeError;if(S(r)||(r=M(r)),!P(t))throw new TypeError;S(r)||(r=M(r));var n=K(t,r,!1);return!S(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(n||(n={}))},8128:e=>{"use strict";e.exports=JSON.parse('{"name":"nano","description":"The official CouchDB client for Node.js","license":"Apache-2.0","homepage":"http://github.com/apache/couchdb-nano","repository":"http://github.com/apache/couchdb-nano","version":"10.1.4","author":"Apache CouchDB <dev@couchdb.apache.org> (http://couchdb.apache.org)","keywords":["couchdb","data","request","json","nosql","micro","nano","database"],"dependencies":{"axios":"^1.7.4","qs":"^6.13.0","node-abort-controller":"^3.1.1"},"devDependencies":{"@types/node":"^22.3.0","jest":"^29.7.0","nock":"^13.5.4","standard":"^17.1.0","typescript":"^5.5.4"},"scripts":{"standard":"standard --fix","test":"standard && tsc lib/nano.d.ts && npm run jest","jest":"jest test/* --coverage --env node"},"main":"./lib/nano.js","types":"./lib/nano.d.ts","engines":{"node":">=14"},"pre-commit":["test"],"standard":{"env":["jest"]}}')}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r(7729)})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("for-couchdb",[],t):"object"==typeof exports?exports["for-couchdb"]=t():e["for-couchdb"]=t()}(this,(()=>(()=>{var e={2050:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBAdapter=void 0;const n=r(9430),o=r(2640),a=r(5922);r(8630);const s=r(7335),i=r(6746),c=r(5940),u=r(4699),l=r(9514),d=r(2879);class f extends n.Adapter{constructor(e,t){super(e,t)}get Clauses(){return this.factory||(this.factory=new i.Factory(this)),this.factory}Query(){return super.Query()}get Statement(){return new s.CouchDBStatement(this)}parseCondition(e){const{attr1:t,operator:r,comparison:o}=e;let a={};if(-1===[n.GroupOperator.AND,n.GroupOperator.OR,n.Operator.NOT].indexOf(r))a[t]={},a[t][(0,c.translateOperators)(r)]=o;else if(r===n.Operator.NOT)a=this.parseCondition(t).selector,a[(0,c.translateOperators)(n.Operator.NOT)]={},a[(0,c.translateOperators)(n.Operator.NOT)][t.attr1]=o;else{const e=this.parseCondition(t).selector,n=this.parseCondition(o).selector;a=function(e,t,r){const n={selector:{}};return n.selector[e]=[t,r],n}((0,c.translateOperators)(r),e,n).selector}return{selector:a}}async Sequence(e){return new u.CouchDBSequence(e)}async initialize(){const e=n.Adapter.models(this.flavour);return this.index(...e)}async index(...e){const t=(0,d.generateIndexes)(e);for(const e of t){const t=await this.native.createIndex(e),{result:r,id:n,name:o}=t;if("existing"===r)throw new a.ConflictError(`Index for table ${o} with id ${n}`)}}async raw(e,t=!0){try{const r=await this.native.find(e);return t?r.docs:r}catch(e){throw this.parseError(e)}}async create(e,t,r){const s={};let i;s[o.CouchDBKeys.TABLE]=e,s[o.CouchDBKeys.ID]=this.generateId(e,t),Object.assign(s,r);try{i=await this.native.insert(s)}catch(e){throw this.parseError(e)}if(!i.ok)throw new a.InternalError(`Failed to insert doc id: ${t} in table ${e}`);return Object.defineProperty(r,n.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:i.rev}),r}async createAll(e,t,r){if(t.length!==r.length)throw new a.InternalError("Ids and models must have the same length");const s=t.map(((t,n)=>{const a={};return a[o.CouchDBKeys.TABLE]=e,a[o.CouchDBKeys.ID]=this.generateId(e,t),Object.assign(a,r[n]),a}));let i;try{i=await this.native.bulk({docs:s})}catch(e){throw this.parseError(e)}if(!i.every((e=>!e.error))){const e=i.reduce(((e,t,r)=>(t.error&&e.push(`el ${r}: ${t.error}${t.reason?` - ${t.reason}`:""}`),e)),[]);throw new a.InternalError(e.join("\n"))}return r.forEach(((e,t)=>(n.Repository.setMetadata(e,i[t].rev),e))),r}async read(e,t){const r=this.generateId(e,t);let o;try{o=await this.native.get(r)}catch(e){throw this.parseError(e)}return Object.defineProperty(o,n.PersistenceKeys.METADATA,{enumerable:!1,writable:!1,value:o._rev}),o}async readAll(e,t){return(await this.native.fetch({keys:t.map((t=>this.generateId(e,t)))},{})).rows.map((e=>{if(e.error)throw new a.InternalError(e.error);if(e.doc){const t=Object.assign({},e.doc);return Object.defineProperty(t,n.PersistenceKeys.METADATA,{enumerable:!1,writable:!1,value:e.doc[o.CouchDBKeys.REV]}),t}throw new a.InternalError("Should be impossible")}))}async update(e,t,r){const s={};s[o.CouchDBKeys.TABLE]=e,s[o.CouchDBKeys.ID]=this.generateId(e,t);const i=r[n.PersistenceKeys.METADATA];if(!i)throw new a.InternalError(`No revision number found for record with id ${t}`);let c;Object.assign(s,r),s[o.CouchDBKeys.REV]=i;try{c=await this.native.insert(s)}catch(e){throw this.parseError(e)}if(!c.ok)throw new a.InternalError(`Failed to update doc id: ${t} in table ${e}`);return Object.defineProperty(r,n.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:c.rev}),r}async updateAll(e,t,r){if(t.length!==r.length)throw new a.InternalError("Ids and models must have the same length");const s=t.map(((t,s)=>{const i={};i[o.CouchDBKeys.TABLE]=e,i[o.CouchDBKeys.ID]=this.generateId(e,t);const c=r[s][n.PersistenceKeys.METADATA];if(!c)throw new a.InternalError(`No revision number found for record with id ${t}`);return Object.assign(i,r[s]),i[o.CouchDBKeys.REV]=c,i}));let i;try{i=await this.native.bulk({docs:s})}catch(e){throw this.parseError(e)}if(!i.every((e=>!e.error))){const e=i.reduce(((e,t,r)=>(t.error&&e.push(`el ${r}: ${t.error}${t.reason?` - ${t.reason}`:""}`),e)),[]);throw new a.InternalError(e.join("\n"))}return r.forEach(((e,t)=>(n.Repository.setMetadata(e,i[t].rev),e))),r}async delete(e,t){const r=this.generateId(e,t);let o;try{o=await this.native.get(r),await this.native.destroy(r,o._rev)}catch(e){throw this.parseError(e)}return Object.defineProperty(o,n.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:o._rev}),o}async deleteAll(e,t){const r=await this.native.fetch({keys:t.map((t=>this.generateId(e,t)))},{});return(await this.native.bulk({docs:r.rows.map((e=>(e[o.CouchDBKeys.DELETED]=!0,e)))})).forEach((e=>{e.error&&console.error(e.error)})),r.rows.map((e=>{if(e.error)throw new a.InternalError(e.error);if(e.doc){const t=Object.assign({},e.doc);return Object.defineProperty(t,n.PersistenceKeys.METADATA,{enumerable:!1,writable:!1,value:e.doc[o.CouchDBKeys.REV]}),t}throw new a.InternalError("Should be impossible")}))}generateId(e,t){return[e,t].join(o.CouchDBKeys.SEPARATOR)}parseError(e,t){return f.parseError(e,t)}isReserved(e){return!!e.match(o.reservedAttributes)}static parseError(e,t){if(e instanceof a.BaseError)return e;let r="";if("string"==typeof e){if(r=e,r.match(/already exist|update conflict/g))return new a.ConflictError(r);if(r.match(/missing|deleted/g))return new a.NotFoundError(r)}else e.code?(r=e.code,t=t||e.message):e.statusCode?(r=e.statusCode,t=t||e.message):r=e.message;switch(r.toString()){case"401":case"412":case"409":return new a.ConflictError(t);case"404":return new a.NotFoundError(t);case"400":return r.toString().match(/No\sindex\sexists/g)?new l.IndexError(e):new a.InternalError(e);default:return r.toString().match(/ECONNREFUSED/g)?new n.ConnectionError(e):new a.InternalError(e)}}}t.CouchDBAdapter=f},2640:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBKeys=t.reservedAttributes=void 0,t.reservedAttributes=/^_.*$/g,t.CouchDBKeys={SEPARATOR:"_",ID:"_id",REV:"_rev",DELETED:"_deleted",TABLE:"??table",DDOC:"ddoc",NATIVE:"__native",INDEX:"index"}},9514:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IndexError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.IndexError=o},7729:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(8958),t),o(r(1206),t),o(r(3847),t),o(r(3344),t),o(r(2050),t),o(r(2640),t),o(r(9514),t),o(r(5732),t),o(r(2552),t),t.VERSION="0.1.0"},2879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateIndexes=function(e){const t=function(e,t,r,n=a.DefaultSeparator){return[...e.map((e=>e===o.CouchDBKeys.TABLE?"table":e)),...r||[],...t?[t]:[],o.CouchDBKeys.INDEX].join(n)}([o.CouchDBKeys.TABLE]),r={};return r[t]={index:{fields:[o.CouchDBKeys.TABLE]},name:t,ddoc:t,type:"json"},e.forEach((e=>{const t=n.Repository.indexes(e);Object.entries(t).forEach((([t,i])=>{const c=Object.keys(i)[0];let{directions:u,compositions:l}=i[c];const d=n.Repository.table(e);function f(e){const i=[d,t,...l,n.PersistenceKeys.INDEX].join(a.DefaultSeparator);if(r[i]={index:{fields:[t,...l,o.CouchDBKeys.TABLE].reduce(((t,r)=>{if(e){const n={};n[r]=e,t.push(n)}else t.push(r);return t}),[])},name:i,ddoc:i,type:"json"},!e){const e={};e[o.CouchDBKeys.TABLE]={},e[o.CouchDBKeys.TABLE][s.CouchDBOperator.EQUAL]=d,r[i].index.partial_filter_selector=e}}l=l||[],f(),u&&u.forEach((e=>f(e)))}))})),Object.values(r)};const n=r(9430),o=r(2640),a=r(5922),s=r(2755)},8958:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(2879),t)},8850:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1206:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(8850),t)},8986:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Sequence=void 0;const a=r(2302),s=r(9430);let i=class extends s.BaseModel{constructor(e){super(e),this.id=void 0,this.current=void 0}};t.Sequence=i,n([(0,s.pk)(),o("design:type",String)],i.prototype,"id",void 0),n([(0,a.required)(),(0,s.index)(),o("design:type",Object)],i.prototype,"current",void 0),t.Sequence=i=n([(0,s.table)("??sequence"),(0,s.uses)("nano"),(0,a.model)(),o("design:paramtypes",[Object])],i)},3847:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(8986),t)},9505:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBFromClause=void 0;const n=r(9430),o=r(2640),a=r(9430);class s extends n.FromClause{constructor(e){super(e)}build(e){const t={};return t[o.CouchDBKeys.TABLE]={},t[o.CouchDBKeys.TABLE]="string"==typeof this.selector?this.selector:a.Repository.table(this.selector),e.selector=t,e}}t.CouchDBFromClause=s},7668:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBInsertClause=void 0;const n=r(9430),o=r(5922);class a extends n.InsertClause{constructor(e){super(e)}build(e){throw new o.InternalError("Not supported")}}t.CouchDBInsertClause=a},8233:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBPaginator=void 0;const n=r(9430),o=r(5922),a=r(3501);class s extends n.Paginator{get total(){throw new o.InternalError("The total pages api is not available for couchdb")}get count(){throw new o.InternalError("The record count api is not available for couchdb")}constructor(e,t,r){super(e,t,r)}prepare(e){const t=Object.assign({},e);return t.limit&&(this.limit=t.limit),t.limit=this.size,t}async page(e=1,...t){const r=Object.assign({},this.statement),s=this.stat.getTarget();if(1!==e){if(!this.bookMark)throw new n.PagingError("No bookmark. Did you start in the first page?");r.bookmark=this.bookMark}const i=await this.adapter.raw(r,!1,...t),{docs:c,bookmark:u,warning:l}=i;l&&console.warn(l);const d=r.fields&&r.fields.length?c:c.map((e=>{if(!s)throw new n.PagingError("No statement target defined");const t=(0,o.findPrimaryKey)(new s),r=t.id,i=e._id.split(o.DefaultSeparator);return i.splice(0,1),this.adapter.revert(e,s,r,(0,a.parseSequenceValue)(t.props.type,i.join(o.DefaultSeparator)))}));return this.bookMark=u,this._currentPage=e,d}}t.CouchDBPaginator=s},3433:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBSelectClause=void 0;const n=r(9430);class o extends n.SelectClause{constructor(e){super(e)}build(e){return this.selector&&this.selector!==n.Const.FULL_RECORD?(e.fields="string"==typeof this.selector?[this.selector]:this.selector,e):e}}t.CouchDBSelectClause=o},7335:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBStatement=void 0;const n=r(9430),o=r(5922),a=r(2640),s=r(3501),i=r(8233);class c extends n.Statement{constructor(e){super(e)}async execute(){try{const e=this.build();return e.limit||(e.limit=Number.MAX_SAFE_INTEGER),this.raw(e)}catch(e){throw new o.InternalError(e)}}async paginate(e){try{const t=this.build();return new i.CouchDBPaginator(this,e,t)}catch(e){throw new o.InternalError(e)}}processRecord(e,t,r){if(!e[a.CouchDBKeys.ID])throw new o.InternalError("No CouchDB Id definition found. Should not be possible");const[,...n]=e[a.CouchDBKeys.ID].split("_"),i=n.join("_");return this.adapter.revert(e,this.target,t,(0,s.parseSequenceValue)(r,i))}async raw(e,...t){const r=await this.adapter.raw(e,!0,...t);if(!this.fullRecord)return r;if(!this.target)throw new o.InternalError("No target defined in statement. should never happen");const n=(0,o.findPrimaryKey)(new this.target),a=n.id,s=n.props.type;return Array.isArray(r)?r.map((e=>this.processRecord(e,a,s))):this.processRecord(r,a,s)}}t.CouchDBStatement=c},9791:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBValuesClause=void 0;const n=r(9430),o=r(5922);class a extends n.ValuesClause{constructor(e){super(e)}build(e){throw new o.InternalError("Not implemented")}}t.CouchDBValuesClause=a},356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBWhereClause=void 0;const n=r(9430),o=r(2755),a=r(2302),s=r(2640);class i extends n.WhereClause{constructor(e){super(e)}build(e){const t=this.adapter.parseCondition(n.Condition.and(this.condition,n.Condition.attribute(s.CouchDBKeys.TABLE).eq(e.selector[s.CouchDBKeys.TABLE]))).selector,r=Object.keys(t);if(1===r.length&&-1!==Object.values(o.CouchDBGroupOperator).indexOf(r[0]))switch(r[0]){case o.CouchDBGroupOperator.AND:t[o.CouchDBGroupOperator.AND]=[...Object.values(t[o.CouchDBGroupOperator.AND]).reduce(((e,t)=>{const r=Object.keys(t);if(1!==r.length)throw new Error("Too many keys in query selector. should be one");const n=r[0];return n===o.CouchDBGroupOperator.AND?e.push(...t[n]):e.push(t),e}),[])],e.selector=t;break;case o.CouchDBGroupOperator.OR:{const r={};r[o.CouchDBGroupOperator.AND]=[t,...Object.entries(e.selector).map((([e,t])=>{const r={};return r[e]=t,r}))],e.selector=r;break}default:throw new Error("This should be impossible")}else Object.entries(t).forEach((([t,r])=>{e.selector[t]&&console.warn((0,a.sf)("A {0} query param is about to be overridden: {1} by {2}",t,e.selector[t],r)),e.selector[t]=r}));return e}}t.CouchDBWhereClause=i},2755:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBConst=t.CouchDBGroupOperator=t.CouchDBOperator=void 0,t.CouchDBOperator={EQUAL:"$eq",DIFFERENT:"$ne",BIGGER:"$gt",BIGGER_EQ:"$gte",SMALLER:"$lt",SMALLER_EQ:"$lte",NOT:"$not",IN:"$in",REGEXP:"$regex"},t.CouchDBGroupOperator={AND:"$and",OR:"$or"},t.CouchDBConst={NULL:"null"}},1084:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Factory=void 0;const n=r(9430),o=r(9430),a=r(9430),s=r(9430),i=r(9430),c=r(9505),u=r(5922),l=r(7668),d=r(7335),f=r(356),p=r(3433),h=r(9791),y=r(2755);class g extends n.ClauseFactory{constructor(e){super(e)}from(e,t){return new c.CouchDBFromClause({statement:e,selector:t})}groupBy(e,t){return new class extends i.GroupByClause{constructor(e){super(e)}build(e){throw new u.InternalError("Not implemented")}}({statement:e,selector:t})}insert(){return new l.CouchDBInsertClause({statement:new d.CouchDBStatement(this.adapter)})}limit(e,t){return new class extends o.LimitClause{constructor(e){super(e)}build(e){return e.limit=this.selector,e}}({statement:e,selector:t})}offset(e,t){return new class extends a.OffsetClause{constructor(e){super(e)}build(e){const t=parseInt(this.selector);if(isNaN(t))throw new n.QueryError("Failed to parse offset");return e.skip=t,e}}({statement:e,selector:t})}orderBy(e,t){return new class extends s.OrderByClause{constructor(e){super(e)}build(e){return e.sort=e.sort||[],e.selector=e.selector||{},this.selector.forEach((t=>{const[r,n]=t,o={};o[r]=n,e.sort.push(o),e.selector[r]||(e.selector[r]={},e.selector[r][y.CouchDBOperator.BIGGER]=null)})),e}}({statement:e,selector:t})}select(e){return new p.CouchDBSelectClause({statement:new d.CouchDBStatement(this.adapter),selector:e})}values(e,t){return new h.CouchDBValuesClause({statement:e,values:t})}where(e,t){return new f.CouchDBWhereClause({statement:e,condition:t})}}t.Factory=g},6746:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1084),t)},5940:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.translateOperators=function(e){for(const t of[n.CouchDBOperator,n.CouchDBGroupOperator]){const r=Object.keys(t).find((t=>t===e));if(r)return t[r]}throw new o.QueryError(`Could not find adapter translation for operator ${e}`)};const n=r(2755),o=r(9430)},4699:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.CouchDBSequence=void 0;const a=r(2302),s=r(8986),i=r(5922),c=r(9430),u=r(9430),l=r(3501);class d extends u.Sequence{constructor(e){super(e)}async current(){const{name:e,startWith:t}=this.options;try{const t=await this.repo.read(e);return this.parse(t.current)}catch(r){if(r instanceof i.NotFoundError){if(void 0===t)throw new i.InternalError("Starting value is not defined for a non existing sequence");try{return this.parse(t)}catch(e){throw new i.InternalError((0,a.sf)("Failed to parse initial value for sequence {0}: {1}",t.toString(),e))}}throw new i.InternalError((0,a.sf)("Failed to retrieve current value for sequence {0}: {1}",e,r))}}parse(e){return(0,l.parseSequenceValue)(this.options.type,e)}async increment(e,t){const{type:r,incrementBy:n,name:o}=this.options;let a;const c=t||n;if(c%n!=0)throw new i.InternalError(`Value to increment does not consider the incrementBy setting: ${n}`);switch(r){case"Number":a=this.parse(e)+c;break;case"BigInt":a=this.parse(e)+BigInt(c);break;default:throw new i.InternalError("Should never happen")}let u;try{u=await this.repo.update(new s.Sequence({id:o,current:a}))}catch(e){if(!(e instanceof i.NotFoundError))throw e;u=await this.repo.create(new s.Sequence({id:o,current:a}))}return u.current}async next(){const e=await this.current();return this.increment(e)}async range(e){const t=await this.current(),r=this.parse(this.options.incrementBy),n=await this.increment(t,this.parse(e)*r),o=[];for(let n=1;n<=e;n++)o.push(t+r*this.parse(n));if(o[o.length-1]!==n)throw new i.InternalError("Miscalculation of range");return o}}t.CouchDBSequence=d,n([(0,c.repository)(s.Sequence),o("design:type",Object)],d.prototype,"repo",void 0)},3344:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(4699),t)},3501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseSequenceValue=function(e,t){switch(e){case"Number":return"string"==typeof t?parseInt(t):"number"==typeof t?t:BigInt(t);case"BigInt":return BigInt(t);default:throw new n.InternalError("Should never happen")}};const n=r(5922)},5732:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2552:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reAuth=i,t.wrapDocumentScope=function(e,t,r,n){const a=e.use(t);return["insert","get","put","destroy","find"].forEach((t=>{const o=a[t];Object.defineProperty(a,t,{enumerable:!1,configurable:!0,value:async(...t)=>(await i(e,r,n),o.call(a,...t))})})),Object.defineProperty(a,o.CouchDBKeys.NATIVE,{enumerable:!1,configurable:!1,writable:!1,value:e}),a},t.testReservedAttributes=function(e){return e.match(/^_.*$/g)},t.generateIndexName=c,t.generateIndexDoc=function(e,t,r,n,i=a.DefaultSeparator){const u={};let l;if(u[o.CouchDBKeys.TABLE]={},u[o.CouchDBKeys.TABLE][s.CouchDBOperator.EQUAL]=t,n){const t={};t[e]=n;const a=(r||[]).map((e=>{const t={};return t[e]=n,t})),s={};s[o.CouchDBKeys.TABLE]=n,l=[t,...a,s]}else l=[e,...r||[],o.CouchDBKeys.TABLE];const d=c(e,t,r,n,i);return{index:{fields:l},ddoc:[d,o.CouchDBKeys.DDOC].join(i),name:d}};const n=r(9430),o=r(2640),a=r(5922),s=r(2755);async function i(e,t,r){return e.auth(t,r)}function c(e,t,r,o,s=a.DefaultSeparator){const i=[n.PersistenceKeys.INDEX,t,e];return r&&i.push(...r),o&&i.push(o),i.join(s)}},4097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pkOnCreate=d,t.pk=function(e=o.DefaultSequenceOptions){return e=Object.assign({},o.DefaultSequenceOptions,e),(0,s.apply)((0,c.index)([l.OrderDirection.ASC,l.OrderDirection.DSC]),(0,n.required)(),(0,a.readonly)(),(0,n.propMetadata)(i.Repository.key(a.DBKeys.ID),e),(0,a.onCreate)(d,e))};const n=r(2302),o=r(5176),a=r(5922),s=r(32),i=r(1317),c=r(5562),u=r(8470),l=r(4315);async function d(e,t,r,n){if(!t.type||n[r])return;let o;t.name||(t.name=(0,u.sequenceNameForModel)(n,"pk"));try{o=await this.adapter.Sequence(t)}catch(e){throw new a.InternalError(`Failed to instantiate Sequence ${t.name}: ${e}`)}var s,i,c;s=n,i=r,c=await o.next(),Object.defineProperty(s,i,{enumerable:!0,writable:!1,configurable:!0,value:c})}},1053:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(4097),t),o(r(8470),t)},8470:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTableName=s,t.sequenceNameForModel=function(e,...t){return[s(e),...t].join("_")};const n=r(2302),o=r(1111),a=r(149);function s(e){return Reflect.getMetadata(o.Adapter.key(a.PersistenceKeys.TABLE),e instanceof n.Model?e.constructor:e)||(e instanceof n.Model?e.constructor.name:e.name)}},9430:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0;const a=r(4315),s=r(465);o(r(1053),t),o(r(3631),t),o(r(8768),t),o(r(7550),t),o(r(1135),t),o(r(4315),t),o(r(5638),t),s.Injectables.setRegistry(new a.InjectablesRegistry),t.VERSION="0.3.2"},7922:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7214:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5702:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2443:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9599:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1678:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5176:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BigIntSequence=t.NumericSequence=t.DefaultSequenceOptions=void 0,t.DefaultSequenceOptions={type:"Number",startWith:0,incrementBy:1,cycle:!1},t.NumericSequence={type:"Number",startWith:0,incrementBy:1,cycle:!1},t.BigIntSequence={type:"BigInt",startWith:0,incrementBy:1,cycle:!1}},3631:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(7922),t),o(r(7214),t),o(r(5702),t),o(r(2443),t),o(r(9599),t),o(r(1678),t),o(r(5176),t)},5298:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseModel=void 0;const a=r(5922),s=r(2302),i=r(5562);class c extends s.Model{constructor(e){super(e)}}t.BaseModel=c,n([(0,a.timestamp)(a.DBOperations.CREATE),o("design:type",Date)],c.prototype,"createdOn",void 0),n([(0,a.timestamp)(),o("design:type",Date)],c.prototype,"updatedOn",void 0),n([(0,i.createdBy)(),o("design:type",String)],c.prototype,"createdBy",void 0),n([(0,i.updatedBy)(),o("design:type",String)],c.prototype,"updatedBy",void 0)},1421:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.User=void 0;const a=r(2302),s=r(4097);let i=class extends a.Model{constructor(e){super(e)}};t.User=i,n([(0,s.pk)(),o("design:type",String)],i.prototype,"id",void 0),n([(0,a.list)([String]),o("design:type",Array)],i.prototype,"roles",void 0),n([(0,a.list)([String]),o("design:type",Array)],i.prototype,"affiliations",void 0),t.User=i=n([(0,a.model)(),o("design:paramtypes",[Object])],i)},7907:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOrUpdate=c,t.oneToOneOnCreate=async function(e,t,r,s){const i=s[r];if(!i)return;if("object"!=typeof i){const t=p(s,r),n=await t.read(i);return await d(e,s,r,i,n),void(s[r]=i)}const c=n.Model.get(t.class);if(!c)throw new a.InternalError(`Could not find model ${t.class}`);const u=o.Repository.forModel(c),l=await u.create(i),f=(0,a.findPrimaryKey)(l).id;await d(e,s,r,l[f],l),s[r]=l[f]},t.oneToOneOnUpdate=async function(e,t,r,n){const o=n[r];if(!o)return;if(t.cascade.update!==i.Cascade.CASCADE)return;if("object"!=typeof o){const t=p(n,r),a=await t.read(o);return await d(e,n,r,o,a),void(n[r]=o)}const s=await c(n[r],e),u=(0,a.findPrimaryKey)(s).id;await d(e,n,r,s[u],s),n[r]=s[u]},t.oneToOneOnDelete=async function(e,t,r,o){const a=o[r];if(!a)return;if(t.cascade.update!==i.Cascade.CASCADE)return;const s=p(o,r);let c;c=a instanceof n.Model?await s.delete(o[r][s.pk],e):await s.delete(o[r],e),await d(e,o,r,c[s.pk],c)},t.oneToManyOnCreate=u,t.oneToManyOnUpdate=async function(e,t,r,n){const{cascade:o}=t;if(o.update===i.Cascade.CASCADE)return u.call(this,e,t,r,n)},t.oneToManyOnDelete=async function(e,t,r,n){if(t.cascade.delete!==i.Cascade.CASCADE)return;const s=n[r];if(!s||!s.length)return;const c=typeof s[0];if(!s.every((e=>typeof e===c)))throw new a.InternalError(`Invalid operation. All elements of property ${r} must match the same type.`);const u="object"===c,l=u?o.Repository.forModel(s[0]):p(n,r),f=new Set([...u?s.map((e=>e[l.pk])):s]);for(const t of f.values()){const o=await l.delete(t,e);await d(e,n,r,t,o)}n[r]=[...f]},t.getPopulateKey=l,t.cacheModelForPopulate=d,t.populate=async function(e,t,r,n){if(!t.populate)return;const o=n[r],s=Array.isArray(o);if(void 0===o||s&&0===o.length)return;const i=await async function(e,t,r,n){let o,s;const i=[];for(const c of n){o=l(t.constructor.name,r,c);try{s=await e.get(o)}catch(e){const n=p(t,r);if(!n)throw new a.InternalError("Could not find repo");s=await n.read(c)}i.push(s)}return i}(e,n,r,s?o:[o]);n[r]=s?i:i[0]},t.repositoryFromTypeMetadata=p;const n=r(2302),o=r(1317),a=r(5922),s=r(149),i=r(5780);async function c(e,t,r){if(!r){const t=n.Model.get(e.constructor.name);if(!t)throw new a.InternalError(`Could not find model ${e.constructor.name}`);r=o.Repository.forModel(t)}if(void 0===e[r.pk])return r.create(e,t);try{return r.update(e,t)}catch(n){if(!(n instanceof a.NotFoundError))throw n;return r.create(e,t)}}async function u(e,t,r,n){const o=n[r];if(!o||!o.length)return;const s=typeof o[0];if(!o.every((e=>typeof e===s)))throw new a.InternalError(`Invalid operation. All elements of property ${r} must match the same type.`);const i=new Set([...o]);if("object"!==s){const t=p(n,r);for(const o of i){const a=await t.read(o);await d(e,n,r,o,a)}return void(n[r]=[...i])}const u=(0,a.findPrimaryKey)(o[0]).id,l=new Set;for(const t of o){const o=await c(t,e);await d(e,n,r,o[u],o),l.add(o[u])}n[r]=[...l]}function l(e,t,r){return[s.PersistenceKeys.POPULATE,e,t,r].join(".")}async function d(e,t,r,n,o){const a=l(t.constructor.name,r,n);return e.put(a,o)}const f=["array","string","number","boolean","symbol","function","object","undefined","null","bigint"];function p(e,t){const r=Reflect.getMetadata(n.Validation.key(Array.isArray(e[t])?n.ValidationKeys.LIST:n.ValidationKeys.TYPE),e,t),s=Array.isArray(e[t])?r.class:r.customTypes;if(!r||!s)throw new a.InternalError(`Failed to find types decorators for property ${t}`);const i=(Array.isArray(s)?[...s]:[s]).find((e=>!f.includes(`${e}`.toLowerCase())));if(!i)throw new a.InternalError(`Property key ${t} does not have a valid constructor type`);const c=n.Model.get(i);if(!c)throw new a.InternalError(`No registered model found for ${i}`);return o.Repository.forModel(c)}},5562:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.table=function(e){return(0,o.metadata)(c.Adapter.key(a.PersistenceKeys.TABLE),e)},t.column=function(e){return(0,i.propMetadata)(c.Adapter.key(a.PersistenceKeys.COLUMN),e)},t.index=function(e,t){return(0,i.propMetadata)(u.Repository.key(`${a.PersistenceKeys.INDEX}${t&&t.length?`.${t.join(".")}`:""}`),{directions:e,compositions:t})},t.uniqueOnCreateUpdate=f,t.unique=function(){return(0,o.apply)((0,n.onCreateUpdate)(f),(0,i.propMetadata)(u.Repository.key(a.PersistenceKeys.UNIQUE),{}))},t.createdByOnCreateUpdate=p,t.createdBy=function(){return(0,o.apply)((0,n.onCreate)(p),(0,i.propMetadata)(u.Repository.key(a.PersistenceKeys.CREATED_BY),{}))},t.updatedBy=function(){return(0,o.apply)((0,n.onCreateUpdate)(p),(0,i.propMetadata)(u.Repository.key(a.PersistenceKeys.CREATED_BY),{}))},t.oneToOne=function(e,t=s.DefaultCascade,r=!0){i.Model.register(e);const c={class:e.name,cascade:t,populate:r};return(0,o.apply)((0,i.prop)(a.PersistenceKeys.RELATIONS),(0,i.type)([e.name,String.name,Number.name,BigInt.name]),(0,n.onCreate)(d.oneToOneOnCreate,c),(0,n.onUpdate)(d.oneToOneOnUpdate,c),(0,n.onDelete)(d.oneToOneOnDelete,c),(0,n.afterAny)(d.populate,c),(0,i.propMetadata)(u.Repository.key(a.PersistenceKeys.ONE_TO_ONE),c))},t.oneToMany=function(e,t=s.DefaultCascade,r=!0){i.Model.register(e);const c={class:e.name,cascade:t,populate:r};return(0,o.apply)((0,i.prop)(a.PersistenceKeys.RELATIONS),(0,i.list)([e,String,Number,BigInt]),(0,n.onCreate)(d.oneToManyOnCreate,c),(0,n.onUpdate)(d.oneToManyOnUpdate,c),(0,n.onDelete)(d.oneToManyOnDelete,c),(0,n.afterAny)(d.populate,c),(0,i.propMetadata)(u.Repository.key(a.PersistenceKeys.ONE_TO_MANY),c))},t.manyToOne=function(e,t=s.DefaultCascade,r=!0){i.Model.register(e);const n={class:e.name,cascade:t,populate:r};return(0,o.apply)((0,i.prop)(a.PersistenceKeys.RELATIONS),(0,i.type)([e.name,String.name,Number.name,BigInt.name]),(0,i.propMetadata)(u.Repository.key(a.PersistenceKeys.MANY_TO_ONE),n))};const n=r(5922),o=r(32),a=r(149),s=r(5780),i=r(2302),c=r(1111),u=r(1317),l=r(1880),d=r(7907);async function f(e,t,r,o){if(o[r]&&(await this.select().where(l.Condition.attribute(r).eq(o[r])).execute()).length)throw new n.ConflictError(`model already exists with property ${r} equal to ${JSON.stringify(o[r],void 0,2)}`)}async function p(e,t,r,n){const o=await this.adapter.user();n[r]=o.id}},8768:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(5298),t),o(r(5562),t),o(r(8151),t),o(r(1421),t)},8151:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1111:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Adapter=void 0;const n=r(5922),o=r(2302),a=r(149),s=r(5039),i=r(1317);class c{static{this._cache={}}get native(){return this._native}constructor(e,t){this.flavour=t,this._observers=[],this._native=e,c._cache[t]=this}Query(){return new s.Query(this)}isReserved(e){return!e}async timestamp(){return new Date}async context(e,t){return n.Context.from(e,t)}prepare(e,t){const r=Object.entries(e).reduce(((t,[r,o])=>{const a=i.Repository.column(e,r);if(this.isReserved(a))throw new n.InternalError(`Property name ${a} is reserved`);return t[a]=o,t}),{});return e[a.PersistenceKeys.METADATA]&&Object.defineProperty(r,a.PersistenceKeys.METADATA,{enumerable:!1,writable:!1,configurable:!0,value:e[a.PersistenceKeys.METADATA]}),{record:r,id:e[t]}}revert(e,t,r,n){const s={};s[r]=n;const c="string"==typeof t?o.Model.build(s,t):new t(s),u=e[a.PersistenceKeys.METADATA],l=Object.keys(c).reduce(((t,n)=>(n===r||(t[n]=e[i.Repository.column(t,n)]),t)),c);return u&&Object.defineProperty(l,a.PersistenceKeys.METADATA,{enumerable:!1,configurable:!1,writable:!1,value:u}),l}async createAll(e,t,r,...o){if(t.length!==r.length)throw new n.InternalError("Ids and models must have the same length");return Promise.all(t.map(((t,n)=>this.create(e,t,r[n],...o))))}async readAll(e,t,...r){return Promise.all(t.map((t=>this.read(e,t,...r))))}async updateAll(e,t,r,...o){if(t.length!==r.length)throw new n.InternalError("Ids and models must have the same length");return Promise.all(t.map(((t,n)=>this.update(e,t,r[n],...o))))}async deleteAll(e,t,...r){return Promise.all(t.map((t=>this.delete(e,t,...r))))}observe(e){if(-1!==this._observers.indexOf(e))throw new n.InternalError("Observer already registered");this._observers.push(e)}unObserve(e){const t=this._observers.indexOf(e);if(-1===t)throw new n.InternalError("Failed to find Observer");this._observers.splice(t,1)}async updateObservers(...e){(await Promise.allSettled(this._observers.map((t=>t.refresh(...e))))).forEach(((e,t)=>{"rejected"===e.status&&console.warn(`Failed to update observable ${this._observers[t]}: ${e.reason}`)}))}static get current(){return this._current}static get(e){if(e in this._cache)return this._cache[e];throw new n.InternalError(`No Adapter registered under ${e}.`)}static setCurrent(e){const t=this.get(e);if(!t)throw new n.NotFoundError(`No persistence flavour ${e} registered`);this._current=t}static key(e){return i.Repository.key(e)}static models(e){try{const t=o.Model.getRegistry().cache;return Object.values(t).map((t=>{let r=Reflect.getMetadata(c.key(a.PersistenceKeys.ADAPTER),t);if(r&&r===e)return t;if(!r){if(!Reflect.getMetadata(i.Repository.key(n.DBKeys.REPOSITORY),t))return;const e=i.Repository.forModel(t);return r=Reflect.getMetadata(c.key(a.PersistenceKeys.ADAPTER),e),r}})).filter((e=>!!e))}catch(e){throw new n.InternalError(e)}}}t.Adapter=c},5205:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sequence=void 0;const n=r(8470);t.Sequence=class{constructor(e){this.options=e}static pk(e){return(0,n.sequenceNameForModel)(e,"pk")}}},149:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.Roles=t.PersistenceKeys=void 0,function(e){e.INDEX="index",e.UNIQUE="unique",e.ADAPTER="adapter",e.INJECTABLE="decaf_{0}_adapter_for_{1}",e.TABLE="table",e.COLUMN="column",e.METADATA="__metadata",e.RELATIONS="__relations",e.CLAUSE_SEQUENCE="clause-sequence",e.CREATED_BY="ownership.created-by",e.UPDATED_BY="ownership.updated-by",e.ONE_TO_ONE="relations.one-to-one",e.ONE_TO_MANY="relations.one-to-many",e.MANY_TO_ONE="relations.many-to-one",e.POPULATE="populate"}(r||(t.PersistenceKeys=r={})),function(e){e.ADMIN="admin",e.WRITER="writer",e.READER="reader"}(n||(t.Roles=n={}))},8864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uses=function(e){return t=>(0,n.metadata)(a.Adapter.key(o.PersistenceKeys.ADAPTER),e)(t)};const n=r(32),o=r(149),a=r(1111)},1931:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.ConnectionError=o},7550:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1111),t),o(r(149),t),o(r(8864),t),o(r(1931),t),o(r(5205),t)},550:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Clause=void 0;const a=r(2302),s=r(500),i=(r(5048),r(6996));class c extends a.Model{constructor(e){if(super(),this.priority=e?.priority,this.statement=e?.statement,!this.statement||!this.priority)throw new s.QueryError("Missing statement or priority. Should be impossible");this.statement.addClause(this)}get adapter(){return this.statement.getAdapter()}get Clauses(){return this.statement.getAdapter().Clauses}getPriority(){return this.priority}async execute(){return this.statement.execute()}async paginate(e){return this.statement.paginate(e)}toString(){return this.constructor.name}}t.Clause=c,n([(0,a.required)(),o("design:type",Number)],c.prototype,"priority",void 0),n([(0,a.required)(),(0,a.type)("object"),o("design:type",i.Statement)],c.prototype,"statement",void 0)},940:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClauseFactory=void 0,t.ClauseFactory=class{constructor(e){this.adapter=e}}},1880:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Condition=void 0;const a=r(2302),s=r(5048),i=r(500);class c extends a.Model{constructor(e,t,r){super(),this.attr1=void 0,this.operator=void 0,this.comparison=void 0,this.attr1=e,this.operator=t,this.comparison=r}and(e){return c.and(this,e)}or(e){return c.or(this,e)}not(e){return new c(this,s.Operator.NOT,e)}hasErrors(...e){const t=super.hasErrors(...e);if(t)return t;if("string"==typeof this.attr1){if(this.comparison instanceof c)return{comparison:{condition:"Both sides of the comparison must be of the same type"}};if(-1===Object.values(s.Operator).indexOf(this.operator))return{operator:{condition:(0,a.sf)("Invalid operator {0}",this.operator)}}}if(this.attr1 instanceof c){if(!(this.comparison instanceof c)&&this.operator!==s.Operator.NOT)return{comparison:{condition:(0,a.sf)("Invalid operator {0}",this.operator)}};if(-1===Object.values(s.GroupOperator).indexOf(this.operator)&&this.operator!==s.Operator.NOT)return{operator:{condition:(0,a.sf)("Invalid operator {0}",this.operator)}}}}static and(e,t){return c.group(e,s.GroupOperator.AND,t)}static or(e,t){return c.group(e,s.GroupOperator.OR,t)}static group(e,t,r){return new c(e,t,r)}static attribute(e){return(new c.Builder).attribute(e)}static{this.Builder=class{constructor(){this.attr1=void 0,this.operator=void 0,this.comparison=void 0}attribute(e){return this.attr1=e,this}eq(e){return this.setOp(s.Operator.EQUAL,e)}dif(e){return this.setOp(s.Operator.DIFFERENT,e)}gt(e){return this.setOp(s.Operator.BIGGER,e)}lt(e){return this.setOp(s.Operator.SMALLER,e)}gte(e){return this.setOp(s.Operator.BIGGER_EQ,e)}lte(e){return this.setOp(s.Operator.SMALLER_EQ,e)}in(e){return this.setOp(s.Operator.IN,e)}regexp(e){return this.setOp(s.Operator.REGEXP,"string"==typeof e?new RegExp(e):e)}setOp(e,t){return this.operator=e,this.comparison=t,this.build()}build(){try{return new c(this.attr1,this.operator,this.comparison)}catch(e){throw new i.QueryError(e)}}}}static get builder(){return new c.Builder}}t.Condition=c,n([(0,a.required)(),o("design:type",Object)],c.prototype,"attr1",void 0),n([(0,a.required)(),o("design:type",String)],c.prototype,"operator",void 0),n([(0,a.required)(),o("design:type",Object)],c.prototype,"comparison",void 0)},2354:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Paginator=void 0;const n=r(500);t.Paginator=class{get current(){return this._currentPage}get total(){return this._totalPages}get count(){return this._recordCount}get statement(){return this._statement||(this._statement=this.prepare(this._rawStatement)),this._statement}get adapter(){return this.stat.getAdapter()}constructor(e,t,r){this.stat=e,this.size=t,this._rawStatement=r}async next(){return this.page(this.current+1)}async previous(){return this.page(this.current-1)}validatePage(e){if(e<1||!Number.isInteger(e))throw new n.PagingError("page number cannot be under 1 and must be an integer");if(e>this._totalPages)throw new n.PagingError("page number cannot be under 1 and must be an integer")}}},5039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Query=void 0;const n=r(5048);t.Query=class{constructor(e){this.adapter=e}select(e=n.Const.FULL_RECORD){return this.adapter.Clauses.select(e)}min(e){return this.select().min(e)}max(e){return this.select().max(e)}distinct(e){return this.select().distinct(e)}count(e){return this.select().count(e)}insert(){return this.adapter.Clauses.insert()}}},6996:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.Statement=void 0;const a=r(2302),s=r(5048),i=r(500),c=r(5638),u=r(7550),l=r(5922);class d extends a.Model{constructor(e){super(),this.clauses=void 0,this.target=void 0,this.fullRecord=!1,this.type=void 0,this.adapter=e}build(){if(!this.clauses)throw new i.QueryError((0,a.sf)("Failed to build Statement:\n{0}","No Clauses"));this.clauses.sort(((e,t)=>e.getPriority()-t.getPriority()));const e=this.hasErrors();if(e)throw new i.QueryError((0,a.sf)("Poorly built statement: {0}",e.toString()));let t;try{const e=function(t,r={}){const n=t.shift();if(!n)return r;const o=n.build(r);return e(t,o)};t=e(new Array(...this.clauses))}catch(e){throw new i.QueryError(e)}return t}async execute(){try{const e=this.build();return this.raw(e)}catch(e){throw new l.InternalError(e)}}async raw(e,...t){const r=await this.adapter.raw(e,!0,...t);if(!this.fullRecord)return r;if(!this.target)throw new l.InternalError("No target defined in statement. should never happen");const n=(0,l.findPrimaryKey)(new this.target).id,o=function(e){const t=e[n];return this.adapter.revert(e,this.target,n,t)}.bind(this);return Array.isArray(r)?r.map(o):o(r)}hasErrors(...e){const t=super.hasErrors(...e);if(t)return t;for(const e in this.clauses){const t=this.clauses[e].hasErrors();if(t)return t}}addClause(e){this.clauses||(this.clauses=[]);const t=e.getPriority(),r=this.clauses.map(((e,t)=>({index:t,clause:e}))).find((e=>e.clause.getPriority()===t));r&&(this.clauses[r.index]=e),this.clauses.push(e)}getAdapter(){return this.adapter}setTarget(e){if(this.target)throw new i.QueryError((0,a.sf)("Output class already defined to {0}",this.target.name));this.target=e}getTarget(){if(!this.target)throw new l.InternalError("No target defined for statement");return this.target}setFullRecord(){this.fullRecord=!0}setMode(e){this.type=e}}t.Statement=d,n([(0,a.required)(),(0,a.minlength)(s.MandatoryPriorities.length),(0,c.clauseSequence)(),o("design:type",Array)],d.prototype,"clauses",void 0),n([(0,a.required)(),(0,a.type)(["object"]),o("design:type",u.Adapter)],d.prototype,"adapter",void 0),n([(0,a.required)(),o("design:type",Object)],d.prototype,"target",void 0),n([(0,a.required)(),o("design:type",String)],d.prototype,"type",void 0)},1843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FromClause=void 0;const n=r(5048),o=r(311),a=r(500),s=r(2302);class i extends o.SelectorBasedClause{constructor(e){if(super(Object.assign({},e,{priority:n.Priority.FROM})),this.selector="string"==typeof this.selector?s.Model.get(this.selector):this.selector,!this.selector)throw new a.QueryError((0,s.stringFormat)("Could not find selector model: {0}"));this.statement.setTarget(this.selector)}where(e){return this.Clauses.where(this.statement,e)}orderBy(...e){return this.Clauses.orderBy(this.statement,e)}groupBy(e){return this.Clauses.groupBy(this.statement,e)}limit(e){return this.Clauses.limit(this.statement,e)}offset(e){return this.Clauses.offset(this.statement,e)}}t.FromClause=i},1997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupByClause=void 0;const n=r(5048),o=r(311);class a extends o.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:n.Priority.GROUP_BY}))}}t.GroupByClause=a},8484:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.InsertClause=void 0;const a=r(5048),s=r(550),i=r(2302);class c extends s.Clause{constructor(e){super(Object.assign({},e,{priority:a.Priority.SELECT})),this.table=void 0}into(e){return this.table=e.name,this.statement.setTarget(e),this}values(...e){return this.Clauses.values(this.statement,e)}where(e){return this.Clauses.where(this.statement,e)}}t.InsertClause=c,n([(0,i.required)(),o("design:type",String)],c.prototype,"table",void 0)},4006:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LimitClause=void 0;const n=r(311),o=r(5048);class a extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.GROUP_BY}))}offset(e){return this.Clauses.offset(this.statement,e)}}t.LimitClause=a},7582:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OffsetClause=void 0;const n=r(311),o=r(5048);class a extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.GROUP_BY}))}}t.OffsetClause=a},7068:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrderByClause=void 0;const n=r(311),o=r(5048);class a extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.ORDER_BY}))}groupBy(e){return this.Clauses.groupBy(this.statement,e)}limit(e){return this.Clauses.limit(this.statement,e)}offset(e){return this.Clauses.offset(this.statement,e)}}t.OrderByClause=a},3667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectClause=void 0;const n=r(311),o=r(5048);class a extends n.SelectorBasedClause{constructor(e){super(Object.assign({},e,{priority:o.Priority.SELECT})),this.isDistinct=!1,this.isCount=!1,this.isMax=!1,this.isMin=!1,this.selector===o.Const.FULL_RECORD&&this.statement.setFullRecord(),this.statement.setMode(o.StatementType.QUERY)}distinct(e){return this.isDistinct=!0,this.selector=e,this}count(e){return this.selector=e,this}min(e){return this.selector=e,this}max(e){return this.selector=e,this}from(e){return this.Clauses.from(this.statement,e)}}t.SelectClause=a},311:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectorBasedClause=void 0;const a=r(550),s=r(2302);class i extends a.Clause{constructor(e){super(e),this.selector=void 0,this.selector=e.selector}toString(){return this.constructor.name+`[${this.selector}]`}}t.SelectorBasedClause=i,n([(0,s.required)(),o("design:type",Object)],i.prototype,"selector",void 0)},9333:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ValuesClause=void 0;const a=r(550),s=r(5048),i=r(2302);class c extends a.Clause{constructor(e){super(Object.assign({},e,{priority:s.Priority.FROM})),this.models=void 0,this.models=e?.models}}t.ValuesClause=c,n([(0,i.required)(),(0,i.type)(Array.name),o("design:type",Array)],c.prototype,"models",void 0)},4190:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.WhereClause=void 0;const a=r(550),s=r(1880),i=r(2302),c=r(5048);class u extends a.Clause{constructor(e){super(Object.assign({},e,{priority:c.Priority.WHERE})),this.condition=void 0,this.condition=e?.condition}orderBy(...e){return this.Clauses.orderBy(this.statement,e)}groupBy(e){return this.Clauses.groupBy(this.statement,e)}limit(e){return this.Clauses.limit(this.statement,e)}offset(e){return this.Clauses.offset(this.statement,e)}hasErrors(...e){return super.hasErrors(...e)||this.condition.hasErrors()}}t.WhereClause=u,n([(0,i.required)(),(0,i.type)("Condition"),o("design:type",s.Condition)],u.prototype,"condition",void 0)},7656:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1843),t),o(r(1997),t),o(r(8484),t),o(r(4006),t),o(r(7582),t),o(r(7068),t),o(r(3667),t),o(r(311),t),o(r(9333),t),o(r(4190),t)},5048:(e,t)=>{"use strict";var r,n,o,a,s;Object.defineProperty(t,"__esModule",{value:!0}),t.StatementType=t.MandatoryPriorities=t.Priority=t.Const=t.GroupOperator=t.Operator=void 0,function(e){e.EQUAL="EQUAL",e.DIFFERENT="DIFFERENT",e.BIGGER="BIGGER",e.BIGGER_EQ="BIGGER_EQ",e.SMALLER="SMALLER",e.SMALLER_EQ="SMALLER_EQ",e.NOT="NOT",e.IN="IN",e.REGEXP="REGEXP"}(r||(t.Operator=r={})),function(e){e.AND="AND",e.OR="OR"}(n||(t.GroupOperator=n={})),function(e){e.NULL="NULL",e.FULL_RECORD="*"}(o||(t.Const=o={})),function(e){e[e.FROM=1]="FROM",e[e.JOIN=1.1]="JOIN",e[e.WHERE=2]="WHERE",e[e.GROUP_BY=3]="GROUP_BY",e[e.HAVING=4]="HAVING",e[e.SELECT=5]="SELECT",e[e.ORDER_BY=6]="ORDER_BY",e[e.LIMIT=7]="LIMIT",e[e.OFFSET=7.1]="OFFSET"}(a||(t.Priority=a={})),t.MandatoryPriorities=[a.FROM,a.SELECT],function(e){e.QUERY="query",e.TRANSACTION="transaction"}(s||(t.StatementType=s={}))},500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PagingError=t.QueryError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.QueryError=o;class a extends n.BaseError{constructor(e){super(a.name,e)}}t.PagingError=a},1135:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(7656),t),o(r(550),t),o(r(940),t),o(r(1880),t),o(r(5048),t),o(r(500),t),o(r(1953),t),o(r(2354),t),o(r(5039),t),o(r(1989),t),o(r(6996),t),o(r(8780),t)},1953:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1989:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8780:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1317:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(5922),o=r(1111),a=r(2302),s=r(149),i=r(5039),c=r(5780),u=r(32),l=r(5205),d=r(8470),f=r(7550);class p extends n.Repository{static{this._cache={}}get adapter(){if(!this._adapter)throw new n.InternalError("No adapter found for this repository. did you use the @uses decorator or pass it in the constructor?");return this._adapter}get tableName(){return this._tableName||(this._tableName=p.table(this.class)),this._tableName}constructor(e,t){if(super(t),this.observers=[],e&&(this._adapter=e),t&&(p.register(t,this),e)){const r=Reflect.getMetadata(o.Adapter.key(s.PersistenceKeys.ADAPTER),t);if(r&&r!==e.flavour)throw new n.InternalError("Incompatible flavours");(0,f.uses)(e.flavour)(t)}[this.createAll,this.readAll,this.updateAll,this.deleteAll].forEach((e=>{const t=e.name;(0,n.wrapMethodWithContext)(this,this[t+"Prefix"],e,this[t+"Suffix"])}))}async context(e){return this.adapter.context(e,this.class)}async create(e,...t){let{record:r,id:n}=this.adapter.prepare(e,this.pk);return r=await this.adapter.create(this.tableName,n,r,...t),this.adapter.revert(r,this.class,this.pk,n)}async createAll(e,...t){if(!e.length)return e;const r=e.map((e=>this.adapter.prepare(e,this.pk))),n=r.map((e=>e.id));let o=r.map((e=>e.record));return o=await this.adapter.createAll(this.tableName,n,o,...t),o.map(((e,t)=>this.adapter.revert(e,this.class,this.pk,n[t])))}async createAllPrefix(e,...t){const r=await n.Context.args(this,n.OperationKeys.CREATE,this.class,t);if(!e.length)return[e,...r.args];const o=p.getSequenceOptions(e[0]);let a=[];o.type&&(o.name||(o.name=l.Sequence.pk(e[0])),a=await(await this.adapter.Sequence(o)).range(e.length));const s=(e=await Promise.all(e.map((async(e,t)=>((e=new this.class(e))[this.pk]=a[t],await(0,n.enforceDBDecorators)(this,r.context,e,n.OperationKeys.CREATE,n.OperationKeys.ON),e))))).map((e=>e.hasErrors())).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(s)throw new n.ValidationError(s);return[e,...r.args]}async read(e,...t){const r=await this.adapter.read(this.tableName,e,...t);return this.adapter.revert(r,this.class,this.pk,e)}async readAll(e,...t){return(await this.adapter.readAll(this.tableName,e,...t)).map(((t,r)=>this.adapter.revert(t,this.class,this.pk,e[r])))}async update(e,...t){let{record:r,id:n}=this.adapter.prepare(e,this.pk);return r=await this.adapter.update(this.tableName,n,r,...t),this.adapter.revert(r,this.class,this.pk,n)}async updatePrefix(e,...t){const r=await n.Context.args(this,n.OperationKeys.UPDATE,this.class,t),o=e[this.pk];if(!o)throw new n.InternalError(`No value for the Id is defined under the property ${this.pk}`);const a=await this.read(o,...r.args);e=this.merge(a,e),await(0,n.enforceDBDecorators)(this,r.context,e,n.OperationKeys.UPDATE,n.OperationKeys.ON,a);const s=e.hasErrors(a,...p.relations(this.class));if(s)throw new n.ValidationError(s.toString());return p.getMetadata(a)&&(p.getMetadata(e)||p.setMetadata(e,p.getMetadata(a))),[e,...r.args]}async updateAll(e,...t){const r=e.map((e=>this.adapter.prepare(e,this.pk)));return(await this.adapter.updateAll(this.tableName,r.map((e=>e.id)),r.map((e=>e.record)),...t)).map(((e,t)=>this.adapter.revert(e,this.class,this.pk,r[t].id)))}async updateAllPrefix(e,...t){const r=await n.Context.args(this,n.OperationKeys.UPDATE,this.class,t),o=e.map((e=>{const t=e[this.pk];if(!t)throw new n.InternalError("missing id on update operation");return t})),a=await this.readAll(o,...r.args);e=e.map(((e,t)=>(e=this.merge(a[t],e),p.getMetadata(a[t])&&(p.getMetadata(e)||p.setMetadata(e,p.getMetadata(a[t]))),e))),await Promise.all(e.map(((e,t)=>(0,n.enforceDBDecorators)(this,r.context,e,n.OperationKeys.UPDATE,n.OperationKeys.ON,a[t]))));const s=e.map(((e,t)=>e.hasErrors(a[t],e))).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(s)throw new n.ValidationError(s);return e.forEach(((e,t)=>{p.getMetadata(a[t])&&(p.getMetadata(e)||p.setMetadata(e,p.getMetadata(a[t])))})),[e,...r.args]}async delete(e,...t){const r=await this.adapter.delete(this.tableName,e,...t);return this.adapter.revert(r,this.class,this.pk,e)}async deleteAll(e,...t){return(await this.adapter.deleteAll(this.tableName,e,...t)).map(((t,r)=>this.adapter.revert(t,this.class,this.pk,e[r])))}select(e){return new i.Query(this.adapter).select(e).from(this.class)}async query(e,t,r=c.OrderDirection.ASC,n,o){const a=[t,r],s=this.select().where(e).orderBy(a);return n&&s.limit(n),o&&s.offset(o),s.execute()}async timestamp(){return this.adapter.timestamp()}observe(e){if(-1!==this.observers.indexOf(e))throw new n.InternalError("Observer already registered");this.observers.push(e)}unObserve(e){const t=this.observers.indexOf(e);if(-1===t)throw new n.InternalError("Failed to find Observer");this.observers.splice(t,1)}async updateObservers(...e){(await Promise.allSettled(this.observers.map((t=>t.refresh(...e))))).forEach(((e,t)=>{"rejected"===e.status&&console.warn(`Failed to update observable ${this.observers[t]}: ${e.reason}`)}))}static forModel(e){let t;try{t=this.get(e)}catch(e){t=p}if(t instanceof p)return t;const r=Reflect.getMetadata(o.Adapter.key(s.PersistenceKeys.ADAPTER),e)||Reflect.getMetadata(o.Adapter.key(s.PersistenceKeys.ADAPTER),t),a=r?o.Adapter.get(r):void 0;if(!a)throw new n.InternalError(`No registered persistence adapter found flavour ${r}`);return new t(a,e)}static get(e){const t=this.table(e);if(t in this._cache)return this._cache[t];throw new n.InternalError(`Could not find repository registered under ${t}`)}static register(e,t){const r=this.table(e);if(r in this._cache)throw new n.InternalError(`${r} already registered as a repository`);this._cache[r]=t}static setMetadata(e,t){Object.defineProperty(e,s.PersistenceKeys.METADATA,{enumerable:!1,configurable:!0,writable:!1,value:t})}static getMetadata(e){const t=Object.getOwnPropertyDescriptor(e,s.PersistenceKeys.METADATA);return t?t.value:void 0}static removeMetadata(e){Object.getOwnPropertyDescriptor(e,s.PersistenceKeys.METADATA)&&delete e[s.PersistenceKeys.METADATA]}static getSequenceOptions(e){const t=(0,n.findPrimaryKey)(e).id,r=Reflect.getMetadata(p.key(n.DBKeys.ID),e,t);if(!r)throw new n.InternalError("No sequence options defined for model. did you use the @pk decorator?");return r}static indexes(e){const t=(0,u.getAllPropertyDecorators)(e instanceof a.Model?e:new e,n.DBKeys.REFLECT);return Object.entries(t||{}).reduce(((e,[t,r])=>{const n=r.filter((e=>e.key.startsWith(s.PersistenceKeys.INDEX)));if(n&&n.length)for(const r of n){const{key:n,props:o}=r;e[t]=e[t]||{},e[t][n]=o}return e}),{})}static relations(e){const t=[];let r=e instanceof a.Model?Object.getPrototypeOf(e):e.prototype;for(;null!=r;){const e=r[s.PersistenceKeys.RELATIONS];e&&t.push(...e),r=Object.getPrototypeOf(r)}return t}static table(e){return(0,d.getTableName)(e)}static column(e,t){return Reflect.getMetadata(o.Adapter.key(s.PersistenceKeys.COLUMN),e,t)||t}}t.Repository=p},5780:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCascade=t.Cascade=t.OrderDirection=void 0,function(e){e.ASC="asc",e.DSC="desc"}(r||(t.OrderDirection=r={})),function(e){e.CASCADE="cascade",e.NONE="none"}(n||(t.Cascade=n={})),t.DefaultCascade={update:n.CASCADE,delete:n.NONE}},9383:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repository=function(e,t){return(r,i)=>i?(0,n.inject)(t||e.name)(r,i):((0,a.metadata)(s.Repository.key(o.DBKeys.REPOSITORY),t||r.name)(e),s.Repository.register(e,r),(0,n.injectable)(t||r.name,!0,(t=>{Object.defineProperty(t,o.DBKeys.CLASS,{enumerable:!1,configurable:!1,writable:!1,value:e})}))(r))};const n=r(465),o=r(5922),a=r(32),s=r(1317)},1136:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObserverError=void 0;const n=r(5922);class o extends n.BaseError{constructor(e){super(o.name,e)}}t.ObserverError=o},4315:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(5780),t),o(r(9383),t),o(r(1136),t),o(r(7849),t),o(r(1317),t),o(r(576),t),o(r(6500),t)},7849:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectablesRegistry=void 0;const n=r(465),o=r(1317),a=r(2302),s=r(6500),i=r(149),c=r(1111);class u extends n.InjectableRegistryImp{constructor(){super()}get(e){let t=super.get(e);if(!t)try{const r=a.Model.get(e);if(r&&(t=o.Repository.forModel(r)),t){if(t instanceof o.Repository)return t;const e=Reflect.getMetadata(c.Adapter.key(i.PersistenceKeys.ADAPTER),t.constructor)||Reflect.getMetadata(c.Adapter.key(i.PersistenceKeys.ADAPTER),r);n.Injectables.register(t,(0,s.generateInjectableNameForRepository)(r,e))}}catch(e){return}return t}}t.InjectablesRegistry=u},576:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateInjectableNameForRepository=function(e,t){if(!t){const r=a.Adapter.key(s.PersistenceKeys.ADAPTER);if(!(t=Reflect.getMetadata(r,e instanceof i.Model?e.constructor:e)))throw new n.InternalError(`Could not retrieve flavour from model ${e instanceof i.Model?e.constructor.name:e.name}`)}return(0,o.sf)(s.PersistenceKeys.INJECTABLE,t,c.Repository.table(e))};const n=r(5922),o=r(2302),a=r(1111),s=r(149),i=r(2302),c=r(1317)},2864:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ClauseSequenceValidator=void 0;const a=r(2302),s=r(32),i=r(550),c=r(5048),u=r(500),l=r(149);let d=class extends a.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES[l.PersistenceKeys.CLAUSE_SEQUENCE]){super(e)}validateSequence(e,t){return c.MandatoryPriorities.every((t=>!!e.find((e=>e.getPriority()===t))))?void 0:this.getMessage((0,a.sf)(t||this.message,"Missing required Clause Priorities"))}hasErrors(e,t){try{if(!(e&&Array.isArray(e)&&e.length&&e.every((e=>e instanceof i.Clause))))return this.getMessage((0,a.sf)(t||this.message,"No or invalid Clauses found"));const r=e,n=r.reduce(((e,t)=>{const r=t.hasErrors();return r&&(e?e+=(0,a.sf)("\nClause {0}: {1}",t.constructor.name,r.toString()):e=(0,a.sf)("Clause {0}: {1}",t.constructor.name,r.toString())),e}),void 0);if(n)return this.getMessage((0,a.sf)(t||this.message,n.toString()));if(!0!==(()=>{const e=r.map((e=>e.getPriority()));if(new Set(e).size!==e.length)return"Not all clauses have unique priorities";const t=e.sort(((e,t)=>t-e));return!!(0,s.isEqual)(e,t)||"Clauses are not properly sorted"})())return this.getMessage((0,a.sf)(t||this.message,"Invalid prioritization"));if(this.validateSequence(r,t))return this.getMessage((0,a.sf)(t||this.message,"Invalid sequence"))}catch(t){throw new u.QueryError((0,a.sf)("Failed to verify clause sequence {0}: {1}",e,t))}}};t.ClauseSequenceValidator=d,t.ClauseSequenceValidator=d=n([(0,a.validator)(l.PersistenceKeys.CLAUSE_SEQUENCE),o("design:paramtypes",[String])],d)},4776:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clauseSequence=function(e){return(0,n.propMetadata)(n.Validation.key(n.ValidationKeys.REQUIRED),{message:e||n.DEFAULT_ERROR_MESSAGES[o.PersistenceKeys.CLAUSE_SEQUENCE]})};const n=r(2302),o=r(7550);Object.defineProperty(n.DEFAULT_ERROR_MESSAGES,o.PersistenceKeys.CLAUSE_SEQUENCE,{value:"Invalid clause sequence: {0}"}),Object.defineProperty(n.ValidationKeys,"CLAUSE_SEQUENCE",{value:o.PersistenceKeys.CLAUSE_SEQUENCE})},5638:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(4776),t),o(r(2864),t)},9501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.id=function(){return(0,o.apply)((0,n.required)(),(0,a.readonly)(),(0,n.propMetadata)(i.Repository.key(s.DBKeys.ID),{}))};const n=r(2302),o=r(32),a=r(3162),s=r(4367),i=r(9191)},5537:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(9501),t),o(r(3802),t)},3802:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findPrimaryKey=i,t.findModelId=function(e,t=!1){const r=i(e).id,n=e[r];if(!n&&!t)throw new s.InternalError((0,a.sf)("No value for the Id is defined under the property {0}",r));return n};const n=r(4367),o=r(592),a=r(2302),s=r(3036);function i(e){const t=(0,o.getAllPropertyDecoratorsRecursive)(e,void 0,n.DBKeys.REFLECT+n.DBKeys.ID),r=Object.entries(t).reduce(((e,[t,r])=>{const n=r.filter((e=>e.key!==a.ModelKeys.TYPE));return n&&n.length&&(e[t]=e[t]||[],e[t].push(...n)),e}),{});if(!r||!Object.keys(r).length)throw new s.InternalError("Could not find ID decorated Property");if(Object.keys(r).length>1)throw new s.InternalError((0,a.sf)(Object.keys(r).join(", ")));const i=Object.keys(r)[0];if(!i)throw new s.InternalError("Could not find ID decorated Property");return{id:i,props:r[i][0].props}}},5922:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(5537),t),o(r(8403),t),o(r(2828),t),o(r(7781),t),o(r(9191),t),o(r(3162),t)},3949:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1101:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7674:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8403:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(3949),t),o(r(1101),t),o(r(7674),t)},4367:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_TIMESTAMP_FORMAT=t.DefaultSeparator=t.DBKeys=void 0;const n=r(2302);t.DBKeys={REFLECT:`${n.ModelKeys.REFLECT}persistence.`,REPOSITORY:"repository",CLASS:"_class",ID:"id",INDEX:"index",UNIQUE:"unique",SERIALIZE:"serialize",READONLY:"readonly",TIMESTAMP:"timestamp",HASH:"hash",COMPOSED:"composed",ORIGINAL:"__originalObj"},t.DefaultSeparator="_",t.DEFAULT_TIMESTAMP_FORMAT="dd/MM/yyyy HH:mm:ss:S"},3793:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hashOnCreateUpdate=u,t.hash=l,t.composedFromCreateUpdate=d,t.composedFromKeys=function(e,t=n.DefaultSeparator,r=!1,o="",a=""){return f(e,r,t,"keys",o,a)},t.composed=function(e,t=n.DefaultSeparator,r=!1,o="",a=""){return f(e,r,t,"values",o,a)};const n=r(4367),o=r(32),a=r(2302),s=r(6441),i=r(3036),c=r(9553);function u(e,t,r,n){if(!r[t])return;const o=a.Hashing.hash(r[t]);n&&r[t]===o||(r[t]=o)}function l(){return(0,o.apply)((0,s.onCreateUpdate)(u),(0,a.propMetadata)(c.Repository.key(n.DBKeys.HASH),{}))}function d(e,t,r,n){try{const{args:e,type:o,prefix:s,suffix:c,separator:u}=t,l=e.map((e=>{if(!(e in n))throw new i.InternalError((0,a.sf)("Property {0} not found to compose from",e));if("keys"===o)return e;if(void 0===n[e])throw new i.InternalError((0,a.sf)("Property {0} does not contain a value to compose from",e));return n[e].toString()}));s&&l.unshift(s),c&&l.push(c),n[r]=l.join(u)}catch(e){throw new i.InternalError(`Failed to compose value: ${e}`)}}function f(e,t=!1,r=n.DefaultSeparator,i="values",u="",f=""){const p={args:e,hashResult:t,separator:r,type:i,prefix:u,suffix:f},h=[(0,s.onCreateUpdate)(d,p),(0,a.propMetadata)(c.Repository.key(n.DBKeys.COMPOSED),p)];return t&&h.push(l()),(0,o.apply)(...h)}},2828:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(6569),t),o(r(4367),t),o(r(3793),t),o(r(9607),t)},9607:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2302),o=r(6569);n.Model.prototype.hasErrors=function(e,...t){!e||e instanceof n.Model||(t.unshift(e),e=void 0);const r=(0,n.validate)(this,...t);return r||!e?r:(0,o.validateCompare)(e,this,...t)}},6569:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateCompare=function(e,t,...r){const i=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&-1===r.indexOf(e)&&i.push((0,o.getPropertyDecorators)(a.UpdateValidationKeys.REFLECT,t,e));let c;for(const r of i){const{prop:o,decorators:a}=r;if(a.shift(),!a||!a.length)continue;let s;for(const i of a){const a=n.Validation.get(i.key);if(!a){console.error(`Could not find Matching validator for ${i.key} for property ${String(r.prop)}`);continue}const c=a.updateHasErrors(t[o.toString()],e[o.toString()],...Object.values(i.props));c&&(s=s||{},s[i.key]=c)}s&&(c=c||{},c[r.prop.toString()]=s)}for(const a of Object.keys(t).filter((e=>!(r.includes(e)||c&&c[e])))){let r;const i=(0,o.getPropertyDecorators)(n.ValidationKeys.REFLECT,t,a).decorators,u=(0,o.getPropertyDecorators)(n.ValidationKeys.REFLECT,t,a).decorators.filter((e=>-1!==[n.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!u||!u.length)continue;const l=u.pop(),d=l.props.name?[l.props.name]:Array.isArray(l.props.customTypes)?l.props.customTypes:[l.props.customTypes],f=Object.values(n.ReservedModels).map((e=>e.toLowerCase()));for(const o of d){if(-1===f.indexOf(o.toLowerCase()))switch(o){case Array.name:case Set.name:if(i.length&&i.find((e=>e.key===n.ValidationKeys.LIST))){let n,i;switch(o){case Array.name:n=t[a],i=e[a];break;case Set.name:n=t[a].values(),i=e[a].values();break;default:throw new Error(`Invalid attribute type ${o}`)}r=n.map((e=>{const t=(0,s.findModelId)(e,!0);if(!t)return"Failed to find model id";const r=i.find((e=>t===(0,s.findModelId)(e,!0)));return r?e.hasErrors(r):void 0})).filter((e=>!!e)),r?.length||(r=void 0)}break;default:try{t[a]&&e[a]&&(r=t[a].hasErrors(e[a]))}catch(e){console.warn((0,n.sf)("Model should be validatable but its not"))}}r&&(c=c||{},c[a]=r)}}return c?new n.ModelErrorDefinition(c):void 0};const n=r(2302),o=r(32),a=r(3162),s=r(5537)},9121:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Operations=void 0;const n=r(2302),o=r(4300),a=r(6050);class s{constructor(){}static getHandlerName(e){return e.name?e.name:(console.warn("Handler name not defined. A name will be generated, but this is not desirable. please avoid using anonymous functions"),n.Hashing.hash(e.toString()))}static key(e){return a.OperationKeys.REFLECT+e}static get(e,t,r){return s.registry.get(e,t,r)}static getOpRegistry(){return s.registry||(s.registry=new o.OperationsRegistry),s.registry}static register(e,t,r,n){s.getOpRegistry().register(e,t,r,n)}}t.Operations=s},4300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OperationsRegistry=void 0;const n=r(9121);t.OperationsRegistry=class{constructor(){this.cache={}}get(e,t,r,n){let o;n=n||[];try{o="string"==typeof e?e:e.constructor.name,n.unshift(...Object.values(this.cache[o][t][r]||[]))}catch(t){if("string"==typeof e||e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return n}let a=Object.getPrototypeOf(e);return a.constructor.name===o&&(a=Object.getPrototypeOf(a)),this.get(a,t,r,n)}register(e,t,r,o){const a=r.constructor.name,s=n.Operations.getHandlerName(e);this.cache[a]||(this.cache[a]={}),this.cache[a][o]||(this.cache[a][o]={}),this.cache[a][o][t]||(this.cache[a][o][t]={}),this.cache[a][o][t][s]||(this.cache[a][o][t][s]=e)}}},6050:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DBOperations=t.OperationKeys=void 0,function(e){e.REFLECT="decaf.model.db.operations.",e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.ON="on.",e.AFTER="after."}(r||(t.OperationKeys=r={})),t.DBOperations={CREATE:[r.CREATE],READ:[r.READ],UPDATE:[r.UPDATE],DELETE:[r.DELETE],CREATE_UPDATE:[r.CREATE,r.UPDATE],READ_CREATE:[r.READ,r.CREATE],ALL:[r.CREATE,r.READ,r.UPDATE,r.DELETE]}},6441:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.onCreateUpdate=function(e,t){return i(n.DBOperations.CREATE_UPDATE,e,t)},t.onUpdate=function(e,t){return i(n.DBOperations.UPDATE,e,t)},t.onCreate=function(e,t){return i(n.DBOperations.CREATE,e,t)},t.onRead=function(e,t){return i(n.DBOperations.READ,e,t)},t.onDelete=function(e,t){return i(n.DBOperations.DELETE,e,t)},t.onAny=function(e,t){return i(n.DBOperations.ALL,e,t)},t.on=i,t.afterCreateUpdate=function(e,t){return c(n.DBOperations.CREATE_UPDATE,e,t)},t.afterUpdate=function(e,t){return c(n.DBOperations.UPDATE,e,t)},t.afterCreate=function(e,t){return c(n.DBOperations.CREATE,e,t)},t.afterRead=function(e,t){return c(n.DBOperations.READ,e,t)},t.afterDelete=function(e,t){return c(n.DBOperations.DELETE,e,t)},t.afterAny=function(e,t){return c(n.DBOperations.ALL,e,t)},t.after=c,t.operation=u;const n=r(6050),o=r(9121),a=r(32),s=r(2302);function i(e=n.DBOperations.ALL,t,r){return u(n.OperationKeys.ON,e,t,r)}function c(e=n.DBOperations.ALL,t,r){return u(n.OperationKeys.AFTER,e,t,r)}function u(e,t=n.DBOperations.ALL,r,i){return(n,c)=>{const u=n.constructor.name,l=t.reduce(((t,a)=>{const l=e+a;let d=Reflect.getMetadata(o.Operations.key(l),n,c);d||(d={operation:a,handlers:{}});const f=o.Operations.getHandlerName(r);return d.handlers[u]&&d.handlers[u][c]&&f in d.handlers[u][c]||(d.handlers[u]=d.handlers[u]||{},d.handlers[u][c]=d.handlers[u][c]||{},d.handlers[u][c][f]={data:i},t.push(function(e,t){return(r,n)=>{o.Operations.register(t,e,r,n)}}(l,r),(0,s.propMetadata)(o.Operations.key(l),d))),t}),[]);return(0,a.apply)(...l)(n,c)}}},7781:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(6050),t),o(r(6441),t),o(r(9121),t),o(r(4300),t),o(r(5970),t)},5970:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2022:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRepository=void 0;const n=r(2302),o=r(592),a=r(6050),s=r(3036),i=r(749),c=r(3802),u=r(2586);t.BaseRepository=class{get class(){if(!this._class)throw new s.InternalError("No class definition found for this repository");return this._class}get pk(){return this._pk||(this._pk=(0,c.findPrimaryKey)(new this.class).id),this._pk}constructor(e){e&&(this._class=e);const t=this;[this.create,this.read,this.update,this.delete].forEach((e=>{const r=e.name;(0,i.wrapMethodWithContext)(t,t[r+"Prefix"],e,t[r+"Suffix"])}))}async timestamp(){return new Date}async context(e){return u.Context.from(e,this.class)}async createAll(e,...t){return Promise.all(e.map((e=>this.create(e,...t))))}async createPrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.CREATE,this.class,t);return e=new this.class(e),await(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.CREATE,a.OperationKeys.ON),[e,...r.args]}async createSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.CREATE,a.OperationKeys.AFTER),e}async createAllPrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.CREATE,this.class,t);return await Promise.all(e.map((async e=>(e=new this.class(e),await(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.CREATE,a.OperationKeys.ON),e)))),[e,...r.args]}async createAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.CREATE,a.OperationKeys.AFTER)))),e}async readAll(e,...t){return await Promise.all(e.map((e=>this.read(e,...t))))}async readSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.READ,a.OperationKeys.AFTER),e}async readPrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.READ,this.class,t),n=new this.class;return n[this.pk]=e,await(0,o.enforceDBDecorators)(this,r.context,n,a.OperationKeys.READ,a.OperationKeys.ON),[e,...r.args]}async readAllPrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.READ,this.class,t);return await Promise.all(e.map((async e=>{const t=new this.class;return t[this.pk]=e,(0,o.enforceDBDecorators)(this,r.context,t,a.OperationKeys.READ,a.OperationKeys.ON)}))),[e,...r.args]}async readAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.READ,a.OperationKeys.AFTER)))),e}async updateAll(e,...t){return Promise.all(e.map((e=>this.update(e,...t))))}async updateSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.UPDATE,a.OperationKeys.AFTER),e}async updatePrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.UPDATE,this.class,t),n=e[this.pk];if(!n)throw new s.InternalError(`No value for the Id is defined under the property ${this.pk}`);const i=await this.read(n);return await(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.UPDATE,a.OperationKeys.ON,i),[e,...r.args]}async updateAllPrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.UPDATE,this.class,t);return await Promise.all(e.map((e=>(e=new this.class(e),(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.UPDATE,a.OperationKeys.ON),e)))),[e,...r.args]}async updateAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.UPDATE,a.OperationKeys.AFTER)))),e}async deleteAll(e,...t){return Promise.all(e.map((e=>this.delete(e,...t))))}async deleteSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.DELETE,a.OperationKeys.AFTER),e}async deletePrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.DELETE,this.class,t),n=await this.read(e,...r.args);return await(0,o.enforceDBDecorators)(this,r.context,n,a.OperationKeys.DELETE,a.OperationKeys.ON),[e,...r.args]}async deleteAllPrefix(e,...t){const r=await u.Context.args(this,a.OperationKeys.DELETE,this.class,t),n=await this.readAll(e,...r.args);return await Promise.all(n.map((async e=>(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.DELETE,a.OperationKeys.ON)))),[e,...r.args]}async deleteAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.DELETE,a.OperationKeys.AFTER)))),e}merge(e,t){const r=e=>Object.entries(e).reduce(((e,[t,r])=>(void 0!==r&&(e[t]=r),e)),{});return new this.class(Object.assign({},r(e),r(t)))}toString(){return(0,n.sf)("[{0}] - Repository for {1}",this.constructor.name,this.class.name)}}},2586:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;const n=r(8569),o=r(3036);class a extends n.DataCache{constructor(e,t,r){super(),this.operation=e,this.model=t,this.parent=r}async get(e){try{return super.get(e)}catch(t){if(this.parent)return this.parent.get(e);throw t}}async pop(e){if(e in this.cache)return super.pop(e);if(!this.parent)throw new o.NotFoundError(`Key ${e} not in dataStore`);return this.parent.pop(e)}child(e,t){return this.constructor(e,t,this)}static async from(e,t){return new a(e,t)}static async args(e,t,r,n){const o=n.pop();let s;return o?o instanceof a?(s=o,n.push(o)):(s=await e.context(t,r),n.push(o,s)):(s=await e.context(t,r),n.push(s)),{context:s,args:n}}}t.Context=a},8569:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataCache=void 0;const n=r(3036);t.DataCache=class{constructor(){this.cache={}}async get(e){if(!(e in this.cache))throw new n.NotFoundError(`Key ${e} not in dataStore`);return this.cache[e]}async push(e,t){if(e in this.cache)throw new n.ConflictError(`Key ${e} already in dataStore`);this.cache[e]=t}async put(e,t){this.cache[e]=t}async pop(e){const t=this.get(e);return delete this.cache[e],t}async filter(e){return"string"==typeof e&&(e=new RegExp(e)),Object.keys(this.cache).filter((t=>!!e.exec(t))).map((e=>this.cache[e]))}async purge(e){e?await this.pop(e):this.cache={}}}},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(592),o=r(6050),a=r(3036),s=r(2022),i=r(4367),c=r(2586);class u extends s.BaseRepository{constructor(e){super(e)}async createPrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.CREATE,this.class,t);e=new this.class(e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.CREATE,o.OperationKeys.ON);const s=e.hasErrors();if(s)throw new a.ValidationError(s.toString());return[e,...r.args]}async createAllPrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.CREATE,this.class,t);await Promise.all(e.map((async e=>(e=new this.class(e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.CREATE,o.OperationKeys.ON),e))));const s=e.map((e=>e.hasErrors())).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(s)throw new a.ValidationError(s);return[e,...r.args]}async updatePrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.UPDATE,this.class,t),s=e[this.pk];if(!s)throw new a.InternalError(`No value for the Id is defined under the property ${this.pk}`);const i=await this.read(s);e=this.merge(i,e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.UPDATE,o.OperationKeys.ON,i);const u=e.hasErrors(i);if(u)throw new a.ValidationError(u.toString());return[e,...r.args]}async updateAllPrefix(e,...t){const r=await c.Context.args(this,o.OperationKeys.UPDATE,this.class,t),s=e.map((e=>{const t=e[this.pk];if(!t)throw new a.InternalError(`No value for the Id is defined under the property ${this.pk}`);return t})),i=await this.readAll(s,...r.args);e=e.map(((e,t)=>this.merge(i[t],e))),await Promise.all(e.map(((e,t)=>(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.UPDATE,o.OperationKeys.ON,i[t]))));const u=e.map(((e,t)=>e.hasErrors(i[t],e))).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(u)throw new a.ValidationError(u);return[e,...r.args]}static key(e){return i.DBKeys.REFLECT+e}}t.Repository=u},3036:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConflictError=t.NotFoundError=t.SerializationError=t.InternalError=t.ValidationError=t.BaseError=void 0;class r extends Error{constructor(e,t){if(t instanceof r)return t;super(`[${e}] ${t instanceof Error?t.message:t}`),t instanceof Error&&(this.stack=t.stack)}}t.BaseError=r;class n extends r{constructor(e){super(n.name,e)}}t.ValidationError=n;class o extends r{constructor(e){super(o.name,e)}}t.InternalError=o;class a extends r{constructor(e){super(a.name,e)}}t.SerializationError=a;class s extends r{constructor(e){super(s.name,e)}}t.NotFoundError=s;class i extends r{constructor(e){super(i.name,e)}}t.ConflictError=i},9191:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(2022),t),o(r(2586),t),o(r(8569),t),o(r(3036),t),o(r(9553),t),o(r(592),t),o(r(749),t)},592:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAllPropertyDecoratorsRecursive=t.getHandlerArgs=void 0,t.enforceDBDecorators=async function(e,r,a,u,l,d){const f=c(a,u,l);if(f)for(const c in f){const p=f[c];for(const f of p){const{key:p}=f,h=n.Operations.get(a,c,l+p);if(!h||!h.length)throw new s.InternalError(`Could not find registered handler for the operation ${l+p} under property ${c}`);const y=(0,t.getHandlerArgs)(f,c,a);if(!y||Object.values(y).length!==h.length)throw new s.InternalError((0,i.sf)("Args and handlers length do not match"));let g,O;for(let t=0;t<h.length;t++){g=h[t],O=Object.values(y)[t];const n=[r,O.data,c,a];if(u===o.OperationKeys.UPDATE&&l===o.OperationKeys.ON){if(!d)throw new s.InternalError("Missing old model for update operation");n.push(d)}await g.apply(e,n)}}}},t.getDbDecorators=c;const n=r(9121),o=r(6050),a=r(32),s=r(3036),i=r(2302);function c(e,t,r){const n=(0,a.getAllPropertyDecorators)(e,o.OperationKeys.REFLECT+(r||""));if(n)return Object.keys(n).reduce(((e,r)=>{const o=n[r].filter((e=>e.key===t));return o&&o.length&&(e||(e={}),e[r]=o),e}),void 0)}t.getHandlerArgs=function(e,r,n,o){const a=n.constructor.name;if(!a)throw new s.InternalError("Could not determine model class");o=o||{},e.props.handlers[a]&&e.props.handlers[a][r]&&(o={...e.props.handlers[a][r],...o});let i=Object.getPrototypeOf(n);return i===Object.prototype?o:(i.constructor.name===a&&(i=Object.getPrototypeOf(i)),(0,t.getHandlerArgs)(e,r,i,o))},t.getAllPropertyDecoratorsRecursive=function(e,r,...n){const s=r||{},c=(0,a.getAllPropertyDecorators)(e,...n);if(c&&function(e){Object.entries(e).forEach((([e,t])=>{s[e]=s[e]||[],((e,...t)=>{t.forEach((t=>{let r;if(!(r=s[e].find((e=>e.key===t.key)))||r.props.operation!==t.props.operation)return void s[e].push(t);if(t.key===i.ModelKeys.TYPE)return;const{handlers:n,operation:a}=t.props;if(!a||!a.match(new RegExp(`^(:?${o.OperationKeys.ON}|${o.OperationKeys.AFTER})(:?${o.OperationKeys.CREATE}|${o.OperationKeys.READ}|${o.OperationKeys.UPDATE}|${o.OperationKeys.DELETE})$`)))return void s[e].push(t);const c=r.props.handlers;Object.entries(n).forEach((([e,t])=>{e in c?Object.entries(t).forEach((([t,r])=>{t in c[e]?Object.entries(r).forEach((([r,n])=>{r in c[e][t]?console.warn((0,i.sf)("Skipping handler registration for {0} under prop {0} because handler is the same",e,t)):c[e][t][r]=n})):c[e][t]=r})):c[e]=t}))}))})(e,...t)}))}(c),Object.getPrototypeOf(e)===Object.prototype)return s;const u=Object.getPrototypeOf(e);return u?(0,t.getAllPropertyDecoratorsRecursive)(u,s,...n):s}},749:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prefixMethod=function(e,t,r,n){const o=async function(...e){const n=await Promise.resolve(r.call(this,...e));return Promise.resolve(t.apply(this,n))}.bind(e),a=n||t.name;Object.defineProperty(o,"name",{enumerable:!0,configurable:!0,writable:!1,value:a}),e[a]=o},t.suffixMethod=function(e,t,r,n){const o=async function(...e){const n=await Promise.resolve(t.call(this,...e));return r.call(this,...n)}.bind(e),a=n||t.name;Object.defineProperty(o,"name",{enumerable:!0,configurable:!0,writable:!1,value:a}),e[a]=o},t.wrapMethodWithContext=function(e,t,r,a,s){const i=async function(...s){let i=t.call(e,...s);i instanceof Promise&&(i=await i);const c=i[i.length-1];if(!(c instanceof n.Context))throw new o.InternalError("Missing a context");let u=await r.call(e,...i);return u instanceof Promise&&(u=await u),u=a.call(this,u,c),u instanceof Promise&&(u=await u),u}.bind(e),c=s||r.name;Object.defineProperty(i,"name",{enumerable:!0,configurable:!0,writable:!1,value:c}),e[c]=i};const n=r(2586),o=r(3036)},6753:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateValidationKeys=t.DEFAULT_ERROR_MESSAGES=void 0;const n=r(4367);t.DEFAULT_ERROR_MESSAGES={ID:{INVALID:"This Id is invalid",REQUIRED:"The Id is mandatory"},READONLY:{INVALID:"This cannot be updated"},TIMESTAMP:{REQUIRED:"Timestamp is Mandatory",DATE:"The Timestamp must the a valid date",INVALID:"This value must always increase"}},t.UpdateValidationKeys={REFLECT:"db.update.validation.",TIMESTAMP:n.DBKeys.TIMESTAMP,READONLY:n.DBKeys.READONLY}},9252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.readonly=function(e=a.DEFAULT_ERROR_MESSAGES.READONLY.INVALID){return(0,n.propMetadata)(n.Validation.updateKey(o.DBKeys.READONLY),{message:e})},t.timestampHandler=d,t.timestamp=function(e=s.DBOperations.CREATE_UPDATE,t=o.DEFAULT_TIMESTAMP_FORMAT){const r=[(0,n.date)(t,a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.DATE),(0,n.required)(a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.REQUIRED),(0,i.on)(e,d)];return-1!==e.indexOf(s.OperationKeys.UPDATE)&&r.push((0,n.propMetadata)(n.Validation.updateKey(o.DBKeys.TIMESTAMP),{message:a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID})),(0,u.apply)(...r)},t.serializeOnCreateUpdate=f,t.serializeAfterAll=p,t.serialize=function(){return(0,u.apply)((0,i.onCreateUpdate)(f),(0,i.after)(s.DBOperations.ALL,p),(0,n.type)([String.name,Object.name]),(0,u.metadata)(l.Repository.key(o.DBKeys.SERIALIZE),{}))};const n=r(2302),o=r(4367),a=r(6753),s=r(6050),i=r(6441),c=r(3036),u=r(32),l=r(9191);async function d(e,t,r,n){n[r]=await this.timestamp()}async function f(e,t,r,o){if(r[t])try{r[t]=JSON.stringify(r[t])}catch(e){throw new c.SerializationError((0,n.sf)("Failed to serialize {0} property on {1} model: {2}",t,r.constructor.name,e.message))}}async function p(e,t,r){if(r[t]&&"string"==typeof r[t])try{r[t]=JSON.parse(r[t])}catch(e){throw new c.SerializationError((0,n.sf)("Failed to deserialize {0} property on {1} model: {2}",t,r.constructor.name,e.message))}}},3162:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(1362),t),o(r(6753),t),o(r(9252),t),o(r(6723),t)},6723:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2302),o=r(6753);n.Validation.updateKey=function(e){return o.UpdateValidationKeys.REFLECT+e}},9174:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ReadOnlyValidator=void 0;const a=r(2302),s=r(6753),i=r(32);let c=class extends a.Validator{constructor(){super(s.DEFAULT_ERROR_MESSAGES.READONLY.INVALID)}hasErrors(e,...t){}updateHasErrors(e,t,r){if(void 0!==e)return(0,i.isEqual)(e,t)?void 0:this.getMessage(r||this.message)}};t.ReadOnlyValidator=c,t.ReadOnlyValidator=c=n([(0,a.validator)(s.UpdateValidationKeys.READONLY),o("design:paramtypes",[])],c)},8944:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TimestampValidator=void 0;const a=r(2302),s=r(6753);let i=class extends a.Validator{constructor(){super(s.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID)}hasErrors(e,...t){}updateHasErrors(e,t,r){if(void 0!==e){r=r||this.getMessage(r||this.message);try{e=new Date(e),t=new Date(t)}catch(e){return r}return e<=t?r:void 0}}};t.TimestampValidator=i,t.TimestampValidator=i=n([(0,a.validator)(s.UpdateValidationKeys.TIMESTAMP),o("design:paramtypes",[])],i)},4981:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateValidator=void 0;const n=r(2302);class o extends n.Validator{constructor(e=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...t){super(e,...t)}}t.UpdateValidator=o},1362:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(9174),t),o(r(8944),t),o(r(4981),t)},2302:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(4072),t),o(r(5030),t),o(r(5643),t),t.VERSION="1.4.0"},3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Model=void 0;const n=r(4744),o=r(1825),a=r(32),s=r(2709),i=r(2252),c=r(9683),u=r(7675),l=r(5021),d=r(1318),f=r(8539);let p,h;class y{constructor(e){}hasErrors(...e){return(0,s.validate)(this,...e)}equals(e,...t){return(0,a.isEqual)(this,e,...t)}serialize(){return y.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}hash(){return y.hash(this)}static deserialize(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.SERIALIZATION),this.constructor);return t&&t.serializer?n.Serialization.deserialize(e,t.serializer,...t.args||[]):n.Serialization.deserialize(e)}static fromObject(e,t){t||(t={});for(const r of y.getAttributes(e))e[r]=t[r]||void 0;return e}static fromModel(e,t){let r,n;t||(t={});const o=y.getAttributes(e);for(const s of o){if(e[s]=t[s]||void 0,"object"!=typeof e[s])continue;const o=(0,c.isPropertyModel)(e,s);if(o){try{e[s]=y.build(e[s],"string"==typeof o?o:void 0)}catch(e){console.log(e)}continue}const i=(0,a.getPropertyDecorators)(l.ValidationKeys.REFLECT,e,s).decorators;if(r=i.filter((e=>-1!==[u.ModelKeys.TYPE,l.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,d.sf)("failed to find decorators for property {0}",s));n=r.pop();const p=n.props.name?[n.props.name]:Array.isArray(n.props.customTypes)?n.props.customTypes:[n.props.customTypes],h=Object.values(f.ReservedModels).map((e=>e.toLowerCase()));p.forEach((t=>{if(-1===h.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(i.length){const r=i.find((e=>e.key===l.ValidationKeys.LIST));if(r){const n=r.props.class.find((e=>!f.jsTypes.includes(e.toLowerCase())));if("Array"===t&&(e[s]=e[s].map((e=>["object","function"].includes(typeof e)&&n?y.build(e,n):e))),"Set"===t){const t=new Set;for(const r of e[s])["object","function"].includes(typeof r)&&n?t.add(y.build(r,n)):t.add(r);e[s]=t}}}break;default:e[s]&&(e[s]=y.build(e[s],t))}}catch(e){console.log(e)}}))}return e}static setBuilder(e){p=e}static getBuilder(){return p}static getRegistry(){return h||(h=new o.ModelRegistryManager),h}static setRegistry(e){h=e}static register(e,t){return y.getRegistry().register(e,t)}static get(e){return y.getRegistry().get(e)}static build(e={},t){return y.getRegistry().build(e,t)}static getMetadata(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.MODEL),e.constructor);if(!t)throw new Error("could not find metadata for provided "+e.constructor.name);return t}static getAttributes(e){const t=[];let r=e instanceof y?Object.getPrototypeOf(e):e.prototype;for(;null!=r;){const e=r[u.ModelKeys.ATTRIBUTE];e&&t.push(...e),r=Object.getPrototypeOf(r)}return t}static equals(e,t,...r){return(0,a.isEqual)(e,t,...r)}static hasErrors(e,...t){return(0,s.validate)(e,...t)}static serialize(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.SERIALIZATION),e.constructor);return t&&t.serializer?n.Serialization.serialize(this,t.serializer,...t.args||[]):n.Serialization.serialize(e)}static hash(e){const t=Reflect.getMetadata(this.key(u.ModelKeys.HASHING),e.constructor);return t&&t.algorithm?i.Hashing.hash(e,t.algorithm,...t.args||[]):i.Hashing.hash(e)}static key(e){return u.ModelKeys.REFLECT+e}}t.Model=y},3368:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&Object.defineProperty(this,t,{enumerable:!0,configurable:!1,value:e[t],writable:!1})}toString(){const e=this;return Object.keys(e).filter((t=>Object.prototype.hasOwnProperty.call(e,t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},1825:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelRegistryManager=void 0,t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;n.Model.register(t,e.name)}))};const n=r(3),o=r(1318),a=r(9683);t.ModelRegistryManager=class{constructor(e=a.isModel){this.cache={},this.testFunction=e}register(e,t){if("function"!=typeof e)throw new Error("Model registering failed. Missing Class name or constructor");t=t||e.name,this.cache[t]=e}get(e){try{return this.cache[e]}catch(e){return}}build(e={},t){if(!t&&!this.testFunction(e))throw new Error("Provided obj is not a Model object");const r=t||n.Model.getMetadata(e);if(!(r in this.cache))throw new Error((0,o.sf)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}}},8539:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.jsTypes=t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={})),t.jsTypes=["string","array","number","boolean","symbol","function","object","undefined","null","bigint"]},4939:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)},t.findLastProtoBeforeObject=function(e){let t=Object.getPrototypeOf(e);if(t===Object.prototype)return e;for(;t!==Object.prototype;){if(t=Object.getPrototypeOf(t),t===Object.prototype)return t;if(Object.getPrototypeOf(t)===Object.prototype)return t}throw new Error("Could not find proper prototype")},t.bindModelPrototype=function(e){if(e instanceof n.Model)return;function t(e,t){Object.setPrototypeOf(e,t)}const r=Object.getPrototypeOf(e);if(r===Object.prototype)return t(e,n.Model.prototype);for(;r!==Object.prototype;){const e=Object.getPrototypeOf(r);if(e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return t(r,n.Model.prototype)}throw new Error("Could not find proper prototype to bind")};const n=r(3)},754:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.model=function(e){return t=>{const r=function(...r){const i=(0,n.construct)(t,...r);(0,n.bindModelPrototype)(i);const c=a.Model.getBuilder();return c&&c(i,r.length?r[0]:void 0),(0,s.metadata)(a.Model.key(o.ModelKeys.MODEL),t.name)(i.constructor),e&&e(i,...r),i};return r.prototype=t.prototype,Object.defineProperty(r,"name",{writable:!1,enumerable:!0,configurable:!1,value:t.prototype.constructor.name}),(0,s.metadata)(a.Model.key(o.ModelKeys.MODEL),t.name)(t),a.Model.register(r,t.name),r}},t.hashedBy=function(e,...t){return(0,s.metadata)(a.Model.key(o.ModelKeys.HASHING),{algorithm:e,args:t})},t.serializedBy=function(e,...t){return(0,s.metadata)(a.Model.key(o.ModelKeys.SERIALIZATION),{serializer:e,args:t})};const n=r(4939),o=r(7675),a=r(3),s=r(32)},5643:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(8539),t),o(r(4939),t),o(r(754),t),o(r(3),t),o(r(3368),t),o(r(1825),t),o(r(1967),t),o(r(9683),t),o(r(2709),t)},1967:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9683:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPropertyModel=function(e,t){if(a(e[t]))return!0;const r=Reflect.getMetadata(n.ModelKeys.TYPE,e,t);return o.Model.get(r.name)?r.name:void 0},t.isModel=a;const n=r(7675),o=r(3);function a(e){try{return e instanceof o.Model||!!o.Model.getMetadata(e)}catch(e){return!1}}},2709:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validate=function(e,...t){const r=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&r.push((0,o.getPropertyDecorators)(u.ValidationKeys.REFLECT,e,n));let d;for(const t of r){const{prop:r,decorators:n}=t;if(!n||!n.length)continue;const o=n[0];let s;n.find((e=>e.key===u.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===o.props.name))))&&n.shift();for(const t of n){const n=c.Validation.get(t.key);if(!n)throw new Error(`Missing validator for ${t.key}`);const o=n.hasErrors(e[r.toString()],...t.key===a.ModelKeys.TYPE?[t.props]:Object.values(t.props));o&&(s=s||{},s[t.key]=o)}s&&(d=d||{},d[t.prop.toString()]=s)}for(const t of Object.keys(e).filter((e=>!d||!d[e]))){let r;const n=(0,o.getPropertyDecorators)(u.ValidationKeys.REFLECT,e,t).decorators,c=(0,o.getPropertyDecorators)(u.ValidationKeys.REFLECT,e,t).decorators.filter((e=>-1!==[a.ModelKeys.TYPE,u.ValidationKeys.TYPE].indexOf(e.key)));if(!c||!c.length)continue;const f=c.pop(),p=f.props.name?[f.props.name]:Array.isArray(f.props.customTypes)?f.props.customTypes:[f.props.customTypes],h=Object.values(i.ReservedModels).map((e=>e.toLowerCase()));for(const o of p){if(-1===h.indexOf(o.toLowerCase())){const a=Array.isArray(e[t])?u.ValidationKeys.LIST:u.ValidationKeys.TYPE,i=n.find((e=>e.key===a))||{};let c=[];if(i&&i.props){const r=Array.isArray(e[t])?i.props.class:i.props.customTypes;r&&(c=Array.isArray(r)?r.map((e=>`${e}`.toLowerCase())):[r.toLowerCase()])}const d=(e,t)=>{if("object"==typeof t||"function"==typeof t)return(0,l.isModel)(t)?t.hasErrors():c.includes(typeof t)?void 0:"Value has no validatable type"};switch(o){case Array.name:case Set.name:n.length&&n.find((e=>e.key===u.ValidationKeys.LIST))&&(r=(o===Array.name?e[t]:e[t].values()).map((e=>d(t,e))).filter((e=>!!e)),r?.length||(r=void 0));break;default:try{e[t]&&(r=d(t,e[t]))}catch(e){console.warn((0,s.sf)("Model should be validatable but its not: "+e))}}}r&&(d=d||{},d[t]=r)}}return d?new n.ModelErrorDefinition(d):void 0};const n=r(3368),o=r(32),a=r(7675),s=r(1318),i=r(8539),c=r(1375),u=r(5021),l=r(9683)},7675:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="decaf.model.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__model",e.CONSTRUCTION="constructed-by",e.ATTRIBUTE="__attributes",e.HASHING="hashing",e.SERIALIZATION="serialization"}(r||(t.ModelKeys=r={}))},5243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=a,t.bindDateToString=s,t.isValidDate=i,t.twoDigitPad=c,t.formatDate=u,t.parseDate=function(e,t){let r;if(t){if(t instanceof Date)try{r=a(u(t,e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=a(t,e);else if("number"==typeof t)r=a(u(new Date(t),e),e);else{if(!i(t))throw new Error(`Invalid value provided ${t}`);try{r=a(u(new Date(t),e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t,e))}}return s(r,e)}},r(8630);const n=r(5021),o=r(1318);function a(e,t){let r=t;r.match(/hh/)?r=r.replace("hh","(?<hour>\\d{2})"):r.match(/h/)?r=r.replace("h","(?<hour>\\d{1,2})"):r.match(/HH/)?r=r.replace("HH","(?<hour>\\d{2})"):r.match(/H/)&&(r=r.replace("H","(?<hour>\\d{1,2})")),r.match(/mm/)?r=r.replace("mm","(?<minutes>\\d{2})"):r.match(/m/)&&(r=r.replace("m","(?<minutes>\\d{1,2})")),r.match(/ss/)?r=r.replace("ss","(?<seconds>\\d{2})"):r.match(/s/)&&(r=r.replace("s","(?<seconds>\\d{1,2})")),r.match(/dd/)?r=r.replace("dd","(?<day>\\d{2})"):r.match(/d/)&&(r=r.replace("d","(?<day>\\d{1,2})")),r.match(/EEEE/)?r=r.replace("EEEE","(?<dayofweek>\\w+)"):r.match(/EEEE/)&&(r=r.replace("EEE","(?<dayofweek>\\w+)")),r.match(/yyyy/)?r=r.replace("yyyy","(?<year>\\d{4})"):r.match(/yy/)&&(r=r.replace("yy","(?<year>\\d{2})")),r.match(/MMMM/)?r=r.replace("MMMM","(?<monthname>\\w+)"):r.match(/MMM/)&&(r=r.replace("MMM","(?<monthnamesmall>\\w+)")),r.match(/MM/)?r=r.replace("MM","(?<month>\\d{2})"):r.match(/M/)&&(r=r.replace("M","(?<month>\\d{1,2})")),r=r.replace("S","(?<milis>\\d{1,3})").replace("aaa","(?<ampm>\\w{2})");const o=new RegExp(r,"g").exec(e);if(!o||!o.groups)return new Date(e);const a=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},s=a(o.groups.year),i=a(o.groups.day),c=o.groups.ampm;let u=a(o.groups.hour);c&&(u="PM"===c?u+12:u);const l=a(o.groups.minutes),d=a(o.groups.seconds),f=a(o.groups.milis),p=o.groups.monthname,h=o.groups.monthnamesmall;let y=o.groups.month;if(p)y=n.MONTH_NAMES.indexOf(p);else if(h){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(h.toLowerCase())));if(!t)return new Date(e);y=n.MONTH_NAMES.indexOf(t)}else y=a(`${y}`);return new Date(s,y-1,i,u,l,d,f)}function s(e,t){if(!e)return;const r=()=>u(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function i(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function c(e){return e<10?"0"+e:e.toString()}function u(e,t="yyyy/MM/dd"){const r=e.getDate(),o=e.getMonth(),a=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),u=e.getSeconds(),l=e.getMilliseconds(),d=s%12,f=c(d),p=c(s),h=c(i),y=c(u),g=s<12?"AM":"PM",O=n.DAYS_OF_WEEK_NAMES[e.getDay()],E=O.substr(0,3),b=c(r),v=o+1,_=c(v),m=n.MONTH_NAMES[o],w=m.substr(0,3),R=a+"",M=R.substr(2,2);return(t=t.replace("hh",f).replace("h",d.toString()).replace("HH",p).replace("H",s.toString()).replace("mm",h).replace("m",i.toString()).replace("ss",y).replace("s",u.toString()).replace("S",l.toString()).replace("dd",b).replace("d",r.toString()).replace("EEEE",O).replace("EEE",E).replace("yyyy",R).replace("yy",M).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",m).replace("MMM",w):t.replace("MM",_).replace("M",v.toString())}},3042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prop=a,t.propMetadata=function(e,t){return(0,n.apply)(a(),(0,n.metadata)(e,t))};const n=r(32),o=r(7675);function a(e=o.ModelKeys.ATTRIBUTE){return(t,r)=>{let n;n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:t[e]=[],n.includes(r)||n.push(r)}}},2252:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hashing=t.DefaultHashingMethod=void 0,t.hashCode=o,t.hashSerialization=function(e){return o(n.Serialization.serialize(e))},t.hashObj=a;const n=r(4744);function o(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t.toString()}function a(e){const t=function(e,t){const r=n(t);return"string"==typeof r?n((e||"")+n(t)):0|(e=((e=e||0)<<5)-e+r)},r=o,n=function(e){return void 0===e?"":-1!==["string","number","symbol"].indexOf(typeof e)?r(e.toString()):e instanceof Date?r(e.getTime()):Array.isArray(e)?e.reduce(t,void 0):Object.values(e).reduce(t,void 0)},a=Object.values(e).reduce(t,0);return("number"==typeof a?Math.abs(a):a).toString()}t.DefaultHashingMethod="default";class s{static{this.current=t.DefaultHashingMethod}static{this.cache={default:a}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw new Error(`No hashing method registered under ${e}`)}static register(e,t,r=!1){if(e in this.cache)throw new Error(`Hashing method ${e} already registered`);this.cache[e]=t,r&&(this.current=e)}static hash(e,t,...r){return t?this.get(t)(e,...r):this.get(this.current)(e,...r)}static setDefault(e){this.current=this.get(e)}}t.Hashing=s},4072:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(7675),t),o(r(5243),t),o(r(3042),t),o(r(2252),t),o(r(2417),t),o(r(4744),t),o(r(1318),t)},2417:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Serialization=t.DefaultSerializationMethod=t.JSONSerializer=void 0;const n=r(3),o=r(7675);class a{preSerialize(e){const t=Object.assign({},e),r=n.Model.getMetadata(e);return t[o.ModelKeys.ANCHOR]=r||e.constructor.name,t}deserialize(e){const t=JSON.parse(e),r=t[o.ModelKeys.ANCHOR];if(!r)throw new Error("Could not find class reference in serialized model");return n.Model.build(t,r)}serialize(e){return JSON.stringify(this.preSerialize(e))}}t.JSONSerializer=a,t.DefaultSerializationMethod="json";class s{static{this.current=t.DefaultSerializationMethod}static{this.cache={json:new a}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw new Error(`No serialization method registered under ${e}`)}static register(e,t,r=!1){if(e in this.cache)throw new Error(`Serialization method ${e} already registered`);this.cache[e]=new t,r&&(this.current=e)}static serialize(e,t,...r){return t?this.get(t).serialize(e,...r):this.get(this.current).serialize(e,...r)}static deserialize(e,t,...r){return t?this.get(t).deserialize(e,...r):this.get(this.current).deserialize(e,...r)}static setDefault(e){this.current=this.get(e)}}t.Serialization=s},1318:(e,t)=>{"use strict";function r(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r].toString():"undefined"}))}Object.defineProperty(t,"__esModule",{value:!0}),t.sf=void 0,t.stringFormat=r,t.sf=r},1375:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(3201),o=r(5021);class a{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&a.actingValidatorRegistry&&a.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),a.actingValidatorRegistry=e}static getRegistry(){return a.actingValidatorRegistry||(a.actingValidatorRegistry=new n.ValidatorRegistry),a.actingValidatorRegistry}static get(e){return a.getRegistry().get(e)}static register(...e){return a.getRegistry().register(...e)}static key(e){return o.ValidationKeys.REFLECT+e}}t.Validation=a},3576:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.DATE){super(e,Number.name,Date.name,String.name)}hasErrors(e,t,r){if(void 0!==e)return"string"==typeof e&&(e=new Date(e)),isNaN(e.getDate())?this.getMessage(r||this.message):void 0}};t.DateValidator=c,t.DateValidator=c=n([(0,i.validator)(s.ValidationKeys.DATE),o("design:paramtypes",[String])],c)},5224:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const a=r(5021),s=r(6174),i=r(8024);let c=class extends s.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.EMAIL){super(e)}hasErrors(e,t,r){return super.hasErrors(e,t||a.DEFAULT_PATTERNS.EMAIL,r)}};t.EmailValidator=c,t.EmailValidator=c=n([(0,i.validator)(a.ValidationKeys.EMAIL),o("design:paramtypes",[String])],c)},2888:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.LIST){super(e,Array.name,Set.name)}hasErrors(e,t,r){if(!e||(Array.isArray(e)?!e.length:!e.size))return;t=Array.isArray(t)?t:[t];let n,o=!0;for(let r=0;r<(Array.isArray(e)?e.length:e.size);r++)switch(n=e[r],typeof n){case"object":case"function":o=t.includes(n.constructor?.name);break;default:o=t.some((e=>typeof n===e.toLowerCase()))}return o?void 0:this.getMessage(r||this.message,t)}};t.ListValidator=c,t.ListValidator=c=n([(0,i.validator)(s.ValidationKeys.LIST),o("design:paramtypes",[String])],c)},2382:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length>t?this.getMessage(r||this.message,t):void 0}};t.MaxLengthValidator=c,t.MaxLengthValidator=c=n([(0,i.validator)(s.ValidationKeys.MAX_LENGTH),o("design:paramtypes",[String])],c)},9378:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.MAX){super(e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return e>t?this.getMessage(r||this.message,t):void 0}}};t.MaxValidator=c,t.MaxValidator=c=n([(0,i.validator)(s.ValidationKeys.MAX),o("design:paramtypes",[String])],c)},2396:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length<t?this.getMessage(r||this.message,t):void 0}};t.MinLengthValidator=c,t.MinLengthValidator=c=n([(0,i.validator)(s.ValidationKeys.MIN_LENGTH),o("design:paramtypes",[String])],c)},9320:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.MIN){super(e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return e<t?this.getMessage(r||this.message,t):void 0}}};t.MinValidator=c,t.MinValidator=c=n([(0,i.validator)(s.ValidationKeys.MIN),o("design:paramtypes",[String])],c)},3317:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const a=r(6174),s=r(5021),i=r(8024);let c=class extends a.PatternValidator{constructor(e=s.DEFAULT_ERROR_MESSAGES.PASSWORD){super(e)}hasErrors(e,t,r){return super.hasErrors(e,t||s.DEFAULT_ERROR_MESSAGES.PASSWORD,r||this.message)}};t.PasswordValidator=c,t.PasswordValidator=c=n([(0,i.validator)(s.ValidationKeys.PASSWORD),o("design:paramtypes",[Object])],c)},6174:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=t.regexpParser=void 0;const a=r(7036),s=r(5021),i=r(8024);t.regexpParser=new RegExp("^/(.+)/([gimus]*)$");let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,"string")}getPattern(e){if(!t.regexpParser.test(e))return new RegExp(e);const r=e.match(t.regexpParser);return new RegExp(r[1],r[2])}hasErrors(e,t,r){if(e){if(!t)throw new Error("Missing Pattern");return(t="string"==typeof t?this.getPattern(t):t).lastIndex=0,t.test(e)?void 0:this.getMessage(r||this.message)}}};t.PatternValidator=c,t.PatternValidator=c=n([(0,i.validator)(s.ValidationKeys.PATTERN),o("design:paramtypes",[String])],c)},8089:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.REQUIRED){super(e)}hasErrors(e,t){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t||this.message):void 0;default:return e?void 0:this.getMessage(t||this.message)}}};t.RequiredValidator=c,t.RequiredValidator=c=n([(0,i.validator)(s.ValidationKeys.REQUIRED),o("design:paramtypes",[String])],c)},6942:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const a=r(7036),s=r(5021),i=r(8024);let c=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.STEP){super(e,"number","string")}hasErrors(e,t,r){if(void 0!==e)return Number(e)%Number(t)!=0?this.getMessage(r||this.message,t):void 0}};t.StepValidator=c,t.StepValidator=c=n([(0,i.validator)(s.ValidationKeys.STEP),o("design:paramtypes",[String])],c)},4972:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const a=r(7036),s=r(5021),i=r(8024),c=r(1375),u=r(32),l=r(7675);let d=class extends a.Validator{constructor(e=s.DEFAULT_ERROR_MESSAGES.TYPE){super(e)}hasErrors(e,t,r){if(void 0!==e)return(0,u.evaluateDesignTypes)(e,t)?void 0:this.getMessage(r||this.message,"string"==typeof t?t:Array.isArray(t)?t.join(", "):t.name,typeof e)}};t.TypeValidator=d,t.TypeValidator=d=n([(0,i.validator)(s.ValidationKeys.TYPE),o("design:paramtypes",[String])],d),c.Validation.register({validator:d,validationKey:l.ModelKeys.TYPE,save:!1})},8689:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,s=a<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 i=e.length-1;i>=0;i--)(o=e[i])&&(s=(a<3?o(s):a>3?o(t,r,s):o(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const a=r(5021),s=r(6174),i=r(8024);let c=class extends s.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.URL){super(e)}hasErrors(e,t,r){return super.hasErrors(e,t||a.DEFAULT_PATTERNS.URL,r)}};t.URLValidator=c,t.URLValidator=c=n([(0,i.validator)(a.ValidationKeys.URL),o("design:paramtypes",[String])],c)},7036:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(5021),o=r(1318),a=r(32);t.Validator=class{constructor(e=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...t){this.message=e,t.length&&(this.acceptedTypes=t),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,o.sf)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?(0,a.checkTypes)(t,this.acceptedTypes)?e(t,...r):this.getMessage(n.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},3201:(e,t)=>{"use strict";function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyCache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyCache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const o={};o[t.toUpperCase()]=t,this.customKeyCache=Object.assign({},this.customKeyCache,o)}}))}}},5021:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PATTERNS=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0;const n=r(7675);t.ValidationKeys={REFLECT:`${n.ModelKeys.REFLECT}validation.`,VALIDATOR:"validator",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={REQUIRED:"This field is required",MIN:"The minimum value is {0}",MAX:"The maximum value is {0}",MIN_LENGTH:"The minimum length is {0}",MAX_LENGTH:"The maximum length is {0}",PATTERN:"The value does not match the pattern",EMAIL:"The value is not a valid email",URL:"The value is not a valid URL",TYPE:"Invalid type. Expected {0}, received {1}",STEP:"Invalid value. Not a step of {0}",DATE:"Invalid value. not a valid Date",DEFAULT:"There is an Error",PASSWORD:"Must be at least 8 characters and contain one of number, lower and upper case letters, and special character (@$!%*?&_-.,)",LIST:"Invalid list of {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.DEFAULT_PATTERNS={EMAIL:/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,URL:/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,PASSWORD:{CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g}}},8024:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validator=function(...e){return(0,a.apply)((t=>(e.forEach((e=>{n.Validation.register({validator:t,validationKey:e,save:!0})})),t)),(0,a.metadata)(n.Validation.key(o.ValidationKeys.VALIDATOR),e))};const n=r(1375),o=r(5021),a=r(32)},70:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.Validators=void 0;const a=r(3576),s=r(4972),i=r(3317),c=r(6942),u=r(8689),l=r(6174),d=r(9320),f=r(2396),p=r(9378),h=r(2382),y=r(8089),g=r(5224),O=r(2888);o(r(5021),t),o(r(3576),t),o(r(8024),t),o(r(5224),t),o(r(2888),t),o(r(2382),t),o(r(9378),t),o(r(2396),t),o(r(9320),t),o(r(3317),t),o(r(6174),t),o(r(8089),t),o(r(6942),t),o(r(7045),t),o(r(4972),t),o(r(8689),t),o(r(7036),t),o(r(3201),t),t.Validators={DateValidator:a.DateValidator,EmailValidator:g.EmailValidator,ListValidator:O.ListValidator,MaxLengthValidator:h.MaxLengthValidator,MaxValidator:p.MaxValidator,MinLengthValidator:f.MinLengthValidator,MinValidator:d.MinValidator,PasswordValidator:i.PasswordValidator,PatternValidator:l.PatternValidator,RequiredValidator:y.RequiredValidator,StepValidator:c.StepValidator,TypeValidator:s.TypeValidator,URLValidator:u.URLValidator}},7045:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9944:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.required=function(e=n.DEFAULT_ERROR_MESSAGES.REQUIRED){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.REQUIRED),{message:e})},t.min=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.MIN),{value:e,message:t,types:[Number.name,Date.name]})},t.max=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.MAX),{value:e,message:t,types:[Number.name,Date.name]})},t.step=function(e,t=n.DEFAULT_ERROR_MESSAGES.STEP){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.STEP),{value:e,message:t,types:[Number.name]})},t.minlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.MIN_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.maxlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.MAX_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.pattern=function(e,t=n.DEFAULT_ERROR_MESSAGES.PATTERN){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.PATTERN),{value:"string"==typeof e?e:e.toString(),message:t,types:[String.name]})},t.email=function(e=n.DEFAULT_ERROR_MESSAGES.EMAIL){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.EMAIL),{pattern:n.DEFAULT_PATTERNS.EMAIL,message:e,types:[String.name]})},t.url=function(e=n.DEFAULT_ERROR_MESSAGES.URL){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.URL),{pattern:n.DEFAULT_PATTERNS.URL,message:e,types:[String.name]})},t.type=function(e,t=n.DEFAULT_ERROR_MESSAGES.TYPE){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.TYPE),{customTypes:e,message:t})},t.date=function(e="dd/MM/yyyy",t=n.DEFAULT_ERROR_MESSAGES.DATE){return(r,c)=>{(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]})(r,c);const u=new WeakMap;Object.defineProperty(r,c,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,c);r&&!r.configurable||Object.defineProperty(this,c,{enumerable:!0,configurable:!1,get:()=>u.get(this),set:t=>{let r;try{r=(0,a.parseDate)(e,t),u.set(this,r)}catch(e){console.error((0,o.sf)("Failed to parse date: {0}",e.message||e))}}}),this[c]=t},get(){console.log("here")}})}},t.password=function(e=n.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH,t=n.DEFAULT_ERROR_MESSAGES.PASSWORD){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]})},t.list=c,t.set=function(e,t=n.DEFAULT_ERROR_MESSAGES.LIST){return c(e,"Set",t)},r(8630);const n=r(5021),o=r(1318),a=r(5243),s=r(3042),i=r(1375);function c(e,t="Array",r=n.DEFAULT_ERROR_MESSAGES.LIST){return(0,s.propMetadata)(i.Validation.key(n.ValidationKeys.LIST),{class:Array.isArray(e)?e.map((e=>e.name)):[e.name],type:t,message:r})}},5030:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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(70),t),o(r(9944),t),o(r(4213),t),o(r(1375),t)},4213:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},871:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Injectables=void 0;const n=r(3018);class o{static{this.actingInjectablesRegistry=void 0}constructor(){}static get(e,...t){return o.getRegistry().get(e,...t)}static register(e,...t){return o.getRegistry().register(e,...t)}static build(e,...t){return o.getRegistry().build(e,...t)}static setRegistry(e){o.actingInjectablesRegistry=e}static getRegistry(){return o.actingInjectablesRegistry||(o.actingInjectablesRegistry=new n.InjectableRegistryImp),o.actingInjectablesRegistry}static reset(){this.setRegistry(new n.InjectableRegistryImp)}static selectiveReset(e){const t="string"==typeof e?new RegExp(e):e;o.actingInjectablesRegistry.cache=Object.entries(o.actingInjectablesRegistry.cache).reduce(((e,[r,n])=>(r.match(t)||(e[r]=n),e)),{})}}t.Injectables=o},6030:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectablesKeys=void 0,t.InjectablesKeys={REFLECT:"inject.db.",INJECTABLE:"injectable",INJECT:"inject"}},8957:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inject=t.injectable=void 0;const n=r(6030),o=r(871),a=r(8730),s=e=>n.InjectablesKeys.REFLECT+e;t.injectable=(e=void 0,t=!1,r)=>a=>{const i=e||a.name,c=function(...e){let c=o.Injectables.get(i,...e);if(!c){if(o.Injectables.register(a,i,!0,t),c=o.Injectables.get(i,...e),!c)return;if(r)try{r(c)}catch(e){console.error(`Failed to call injectable callback for ${i}: ${e}`)}}const u=Object.assign({},{class:i});return Reflect.defineMetadata(s(n.InjectablesKeys.INJECTABLE),u,c.constructor),c};return c.prototype=a.prototype,Object.defineProperty(c,"name",{writable:!1,enumerable:!0,configurable:!1,value:a.prototype.constructor.name}),c},t.inject=(e,t)=>(r,i)=>{const c=new WeakMap,u=e||(0,a.getTypeFromDecorator)(r,i);if(!u)throw new Error("Could not get Type from decorator");Reflect.defineMetadata(s(n.InjectablesKeys.INJECT),{injectable:u},r,i),Object.defineProperty(r,i,{configurable:!0,get(){if(Object.getOwnPropertyDescriptor(r,i).configurable)return Object.defineProperty(this,i,{enumerable:!0,configurable:!1,get(){let e=c.get(this);if(!e){if(e=o.Injectables.get(u),!e)throw new Error(`Could not get Injectable ${u} to inject in ${r.constructor?r.constructor.name:r.name}'s ${i}`);if(t)try{e=t(e,r)}catch(e){console.error(e)}c.set(this,e)}return e}}),this[i]}})}},465:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(6030),t),o(r(8957),t),o(r(871),t),o(r(3018),t),o(r(8730),t),t.VERSION="1.4.4"},3018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InjectableRegistryImp=void 0,t.InjectableRegistryImp=class{constructor(){this.cache={}}get(e,...t){try{const r=this.cache[e],n={name:e};return(r.singleton||r.instance)&&r.instance||this.build(n,...t)}catch(e){return}}register(e,t=void 0,r=!0,n=!1){const o=e,a=!o.name&&o.constructor;if("function"!=typeof o&&!a)throw new Error("Injectable registering failed. Missing Class name or constructor");const s=t||(a&&a.name&&"Function"!==a.name?a.name:o.name);this.cache[s]&&!n||(this.cache[s]={instance:a?e:void 0,constructor:a?void 0:e,singleton:r})}build(e,...t){const{constructor:r,singleton:n}=this.cache[e.name],o=new r(...t);return this.cache[e.name]={instance:o,constructor:r,singleton:n},o}}},8730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeKey=void 0,t.getTypeFromDecorator=function(e,r){const n=Reflect.getMetadata(t.TypeKey,e,r);return"Function"!==n.name?n.name:void 0},r(8630),t.TypeKey="design:type"},1267:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ReflectionKeys=void 0,function(e){e.TYPE="design:type"}(r||(t.ReflectionKeys=r={}))},5530:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.metadata=function(e,t){return(r,n,o)=>{o?Reflect.defineMetadata(e,t,o.value):n?Reflect.defineMetadata(e,t,r,n):Reflect.defineMetadata(e,t,r)}},t.apply=function(...e){return(t,r,n)=>{for(const o of e)t instanceof Function&&!n?o(t):o(t,r,n)}},r(8630)},3032:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=function e(t,r,...n){if(t===r)return!0;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(!t||!r||"object"!=typeof t&&"object"!=typeof r)return t===r;if(null==t||null==r)return!1;if(typeof t!=typeof r)return!1;if(t.prototype!==r.prototype)return!1;const o=Object.keys(t).filter((e=>-1===n.indexOf(e)));return o.length===Object.keys(r).filter((e=>-1===n.indexOf(e))).length&&o.every((o=>-1!==n.indexOf(o)||e(t[o],r[o],...n)))}},32:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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}),t.VERSION=void 0,o(r(1267),t),o(r(5530),t),o(r(3032),t),o(r(2199),t),o(r(3115),t),t.VERSION="0.3.1"},2199:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3115:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPropertyDecorators=a,t.getTypeFromDecorator=function(e,t){const r=a(n.ReflectionKeys.TYPE,e,t,!1);if(!r||!r.decorators)return;const o=r.decorators.shift(),s=o.props?o.props.name:void 0;return"Function"!==s?s:void 0},t.getAllPropertyDecorators=function(e,...t){if(t&&t.length)return Object.getOwnPropertyNames(e).reduce(((r,n)=>(t.forEach(((t,o)=>{const s=a(t,e,n,0!==o);r||(r={}),function(e,t,r){r&&r.length&&(e[t]||(e[t]=[]),e[t].push(...r))}(r,n,s.decorators)})),r)),void 0)},t.getAllProperties=function(e,t=!0,r="Object"){const n=[];let o=e;const a=function(){if(!t)return;const e=Object.getPrototypeOf(o);return e&&e.constructor.name!==r?(o=e,o):void 0};do{Object.getOwnPropertyNames(o).forEach((function(e){-1===n.indexOf(e)&&n.push(e)}))}while(a());return n},t.getClassDecorators=function(e,t){return Reflect.getOwnMetadataKeys(t.constructor).filter((t=>t.toString().startsWith(e))).reduce(((r,n)=>{const o={key:n.substring(e.length),props:Reflect.getMetadata(n,t.constructor)};return r.concat(o)}),[])},t.checkType=s,t.checkTypes=i,t.evaluateDesignTypes=function(e,t){switch(typeof t){case"string":return s(e,t);case"object":return!Array.isArray(t)||i(e,t);case"function":return!t.name||"Object"===t.name||s(e,t.name);default:return!0}},r(8630);const n=r(1267),o=r(3032);function a(e,t,r,s=!1,i=!0,c){const u=function(e,t,r,o=!1,a){const s=Reflect.getMetadataKeys(t,r).filter((t=>o?t.toString().startsWith(e):t===n.ReflectionKeys.TYPE||t.toString().startsWith(e))).reduce(((o,a)=>{const s={key:a!==n.ReflectionKeys.TYPE?a.substring(e.length):a,props:Reflect.getMetadata(a,t,r)};return o.concat(s)}),a||[]);return{prop:r.toString(),decorators:s}}(e,t,r,s,c);return i&&Object.getPrototypeOf(t)!==Object.prototype?a(e,Object.getPrototypeOf(t.constructor),r,!0,i,u.decorators):{prop:u.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?((0,o.isEqual)(e.props,r[e.key])||console.log(`Found a similar decorator for the ${e.key} propertyof a ${t.constructor.name} model but with different attributes.The original one will be kept`),!1):(r[e.key.toString()]=e.props,!0)))}(u.decorators)}}function s(e,t){return typeof e===t||e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}function i(e,t){return!t.every((t=>!s(e,t)))}},8630:(e,t,r)=>{var n;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=o(e);function o(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(n=o(t.Reflect,n)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,o=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",s="function"==typeof Object.create,i={__proto__:[]}instanceof Array,c=!s&&!i,u={create:s?function(){return U(Object.create(null))}:i?function(){return U({__proto__:null})}:function(){return U({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),d="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[a]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,o=r+1;o<n;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,K(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,o)},t.prototype.entries=function(){return new r(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[a]=function(){return this.entries()},t.prototype._find=function(e,t){if(!K(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(K(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function o(e,t){return t}function s(e,t){return[e,t]}}(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new d}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[a]=function(){return this.keys()},e}(),p="function"==typeof WeakMap?WeakMap:function(){var e=u.create(),t=n();return function(){function e(){this._key=n()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=n()},e}();function n(){var t;do{t="@@WeakMap@@"+s()}while(u.has(e,t));return e[t]=!0,t}function o(e,n){if(!r.call(e,t)){if(!n)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function a(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function s(){var e=function(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):a(t,e),t}return a(new Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",r=0;r<16;++r){var n=e[r];4!==r&&6!==r&&8!==r||(t+="-"),n<16&&(t+="0"),t+=n.toString(16).toLowerCase()}return t}}(),h=n?Symbol.for("@reflect-metadata:registry"):void 0,y=function(){var e;return!M(h)&&j(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[h]),M(e)&&(e=function(){var e,r,n,o;M(h)||void 0===t.Reflect||h in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,o=e.getOwnMetadataKeys,a=e.deleteMetadata,s=new p;return{isProviderFor:function(e,t){var r=s.get(e);return!(M(r)||!r.has(t))||!!o(e,t).length&&(M(r)&&(r=new f,s.set(e,r)),r.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:o,OrdinaryDeleteMetadata:a}}(t.Reflect));var a=new p,s={registerProvider:i,getProvider:u,setProvider:y};return s;function i(t){if(!Object.isExtensible(s))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case M(r):r=t;break;case r===t:break;case M(n):n=t;break;case n===t:break;default:void 0===o&&(o=new f),o.add(t)}}function c(t,a){if(!M(r)){if(r.isProviderFor(t,a))return r;if(!M(n)){if(n.isProviderFor(t,a))return r;if(!M(o))for(var s=L(o);;){var i=x(s);if(!i)return;var c=B(i);if(c.isProviderFor(t,a))return V(s),c}}}if(!M(e)&&e.isProviderFor(t,a))return e}function u(e,t){var r,n=a.get(e);return M(n)||(r=n.get(t)),M(r)?(M(r=c(e,t))||(M(n)&&(n=new d,a.set(e,n)),n.set(t,r)),r):r}function l(e){if(M(e))throw new TypeError;return r===e||n===e||!M(o)&&o.has(e)}function y(e,t,r){if(!l(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!M(n))return!1;var o=a.get(e);M(o)&&(o=new d,a.set(e,o)),o.set(t,r)}return!0}}()),!M(h)&&j(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,h,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new p,r={isProviderFor:function(e,r){var n=t.get(e);return!M(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,o){n(r,o,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var o=n(t,r,!1);return!M(o)&&D(o.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var o=n(t,r,!1);if(!M(o))return o.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],o=n(e,t,!1);if(M(o))return r;for(var a=L(o.keys()),s=0;;){var i=x(a);if(!i)return r.length=s,r;var c=B(i);try{r[s]=c}catch(e){try{V(a)}finally{throw e}}s++}},OrdinaryDeleteMetadata:function(e,r,o){var a=n(r,o,!1);if(M(a))return!1;if(!a.delete(e))return!1;if(0===a.size){var s=t.get(r);M(s)||(s.delete(o),0===s.size&&t.delete(s))}return!0}};return y.registerProvider(r),r;function n(n,o,a){var s=t.get(n),i=!1;if(M(s)){if(!a)return;s=new d,t.set(n,s),i=!0}var c=s.get(o);if(M(c)){if(!a)return;if(c=new d,s.set(o,c),!e.setProvider(n,o,r))throw s.delete(o),i&&t.delete(n),new Error("Wrong provider for target.")}return c}}(y);function O(e,t,r){if(E(e,t,r))return!0;var n=k(t);return!P(n)&&O(e,n,r)}function E(e,t,r){var n=F(t,r,!1);return!M(n)&&D(n.OrdinaryHasOwnMetadata(e,t,r))}function b(e,t,r){if(E(e,t,r))return v(e,t,r);var n=k(t);return P(n)?void 0:b(e,n,r)}function v(e,t,r){var n=F(t,r,!1);if(!M(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function _(e,t,r,n){F(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function m(e,t){var r=w(e,t),n=k(e);if(null===n)return r;var o=m(n,t);if(o.length<=0)return r;if(r.length<=0)return o;for(var a=new f,s=[],i=0,c=r;i<c.length;i++){var u=c[i];a.has(u)||(a.add(u),s.push(u))}for(var l=0,d=o;l<d.length;l++)u=d[l],a.has(u)||(a.add(u),s.push(u));return s}function w(e,t){var r=F(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function R(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function M(e){return void 0===e}function P(e){return null===e}function j(e){return"object"==typeof e?null!==e:"function"==typeof e}function A(e,t){switch(R(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=N(e,o);if(void 0!==n){var a=n.call(e,r);if(j(a))throw new TypeError;return a}return function(e,t){if("string"===t){var r=e.toString;if(C(r)&&!j(o=r.call(e)))return o;if(C(n=e.valueOf)&&!j(o=n.call(e)))return o}else{var n;if(C(n=e.valueOf)&&!j(o=n.call(e)))return o;var o,a=e.toString;if(C(a)&&!j(o=a.call(e)))return o}throw new TypeError}(e,"default"===r?"number":r)}function D(e){return!!e}function S(e){var t=A(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function T(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function C(e){return"function"==typeof e}function I(e){return"function"==typeof e}function K(e,t){return e===t||e!=e&&t!=t}function N(e,t){var r=e[t];if(null!=r){if(!C(r))throw new TypeError;return r}}function L(e){var t=N(e,a);if(!C(t))throw new TypeError;var r=t.call(e);if(!j(r))throw new TypeError;return r}function B(e){return e.value}function x(e){var t=e.next();return!t.done&&t}function V(e){var t=e.return;t&&t.call(e)}function k(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var o=n.constructor;return"function"!=typeof o||o===e?t:o}function F(e,t,r){var n=y.getProvider(e,t);if(!M(n))return n;if(r){if(y.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function U(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(M(r)){if(!T(e))throw new TypeError;if(!I(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!M(n)&&!P(n)){if(!I(n))throw new TypeError;t=n}}return t}(e,t)}if(!T(e))throw new TypeError;if(!j(t))throw new TypeError;if(!j(n)&&!M(n)&&!P(n))throw new TypeError;return P(n)&&(n=void 0),function(e,t,r,n){for(var o=e.length-1;o>=0;--o){var a=(0,e[o])(t,r,n);if(!M(a)&&!P(a)){if(!j(a))throw new TypeError;n=a}}return n}(e,t,r=S(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!j(r))throw new TypeError;if(!M(n)&&!function(e){switch(R(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;_(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!j(r))throw new TypeError;return M(n)||(n=S(n)),_(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!j(t))throw new TypeError;return M(r)||(r=S(r)),O(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!j(t))throw new TypeError;return M(r)||(r=S(r)),E(e,t,r)})),e("getMetadata",(function(e,t,r){if(!j(t))throw new TypeError;return M(r)||(r=S(r)),b(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!j(t))throw new TypeError;return M(r)||(r=S(r)),v(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!j(e))throw new TypeError;return M(t)||(t=S(t)),m(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!j(e))throw new TypeError;return M(t)||(t=S(t)),w(e,t)})),e("deleteMetadata",(function(e,t,r){if(!j(t))throw new TypeError;if(M(r)||(r=S(r)),!j(t))throw new TypeError;M(r)||(r=S(r));var n=F(t,r,!1);return!M(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(n||(n={}))}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(7729)})()));
|