!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";var e,t,n,i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then}function o(e){switch(typeof e){case"string":case"symbol":return e.toString();case"function":return e.name;default:throw new Error(`Unexpected ${typeof e} service id type`)}}e||(e=1,n=t||(t={}),function(){var e="object"==typeof globalThis?globalThis:"object"==typeof i?i:"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){}}(),t=r(n);function r(e,t){return function(n,i){Object.defineProperty(e,n,{configurable:!0,writable:!0,value:i}),t&&t(n,i)}}void 0!==e.Reflect&&(t=r(e.Reflect,t)),function(e,t){var n=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,r=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",s="function"==typeof Object.create,a={__proto__:[]}instanceof Array,c=!s&&!a,u={create:s?function(){return he(Object.create(null))}:a?function(){return he({__proto__:null})}:function(){return he({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},d=Object.getPrototypeOf(Function),l="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ue(),h="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:de(),f="function"==typeof WeakMap?WeakMap:le(),p=i?Symbol.for("@reflect-metadata:registry"):void 0,v=oe(),g=se(v);function y(e,t,n,i){if(F(n)){if(!W(e))throw new TypeError;if(!G(t))throw new TypeError;return R(e,t)}if(!W(e))throw new TypeError;if(!$(t))throw new TypeError;if(!$(i)&&!F(i)&&!q(i))throw new TypeError;return q(i)&&(i=void 0),T(e,t,n=H(n),i)}function m(e,t){function n(n,i){if(!$(n))throw new TypeError;if(!F(i)&&!X(i))throw new TypeError;_(e,t,n,i)}return n}function b(e,t,n,i){if(!$(n))throw new TypeError;return F(i)||(i=H(i)),_(e,t,n,i)}function w(e,t,n){if(!$(t))throw new TypeError;return F(n)||(n=H(n)),P(e,t,n)}function S(e,t,n){if(!$(t))throw new TypeError;return F(n)||(n=H(n)),M(e,t,n)}function A(e,t,n){if(!$(t))throw new TypeError;return F(n)||(n=H(n)),k(e,t,n)}function I(e,t,n){if(!$(t))throw new TypeError;return F(n)||(n=H(n)),j(e,t,n)}function E(e,t){if(!$(e))throw new TypeError;return F(t)||(t=H(t)),B(e,t)}function O(e,t){if(!$(e))throw new TypeError;return F(t)||(t=H(t)),N(e,t)}function C(e,t,n){if(!$(t))throw new TypeError;if(F(n)||(n=H(n)),!$(t))throw new TypeError;F(n)||(n=H(n));var i=ce(t,n,!1);return!F(i)&&i.OrdinaryDeleteMetadata(e,t,n)}function R(e,t){for(var n=e.length-1;n>=0;--n){var i=(0,e[n])(t);if(!F(i)&&!q(i)){if(!G(i))throw new TypeError;t=i}}return t}function T(e,t,n,i){for(var r=e.length-1;r>=0;--r){var o=(0,e[r])(t,n,i);if(!F(o)&&!q(o)){if(!$(o))throw new TypeError;i=o}}return i}function P(e,t,n){if(M(e,t,n))return!0;var i=ie(t);return!q(i)&&P(e,i,n)}function M(e,t,n){var i=ce(t,n,!1);return!F(i)&&K(i.OrdinaryHasOwnMetadata(e,t,n))}function k(e,t,n){if(M(e,t,n))return j(e,t,n);var i=ie(t);return q(i)?void 0:k(e,i,n)}function j(e,t,n){var i=ce(t,n,!1);if(!F(i))return i.OrdinaryGetOwnMetadata(e,t,n)}function _(e,t,n,i){ce(n,i,!0).OrdinaryDefineOwnMetadata(e,t,n,i)}function B(e,t){var n=N(e,t),i=ie(e);if(null===i)return n;var r=B(i,t);if(r.length<=0)return n;if(n.length<=0)return r;for(var o=new h,s=[],a=0,c=n;a=0&&e=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,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 n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var i=this._keys.length,r=n+1;r=0;--n){var i=(0,e[n])(t);if(!j(i)&&!_(i)){if(!K(i))throw new TypeError;t=i}}return t}function I(e,t,n,i){for(var r=e.length-1;r>=0;--r){var o=(0,e[r])(t,n,i);if(!j(o)&&!_(o)){if(!N(o))throw new TypeError;i=o}}return i}function E(e,t,n){if(O(e,t,n))return!0;var i=Q(t);return!_(i)&&E(e,i,n)}function O(e,t,n){var i=ie(t,n,!1);return!j(i)&&q(i.OrdinaryHasOwnMetadata(e,t,n))}function C(e,t,n){if(O(e,t,n))return R(e,t,n);var i=Q(t);return _(i)?void 0:C(e,i,n)}function R(e,t,n){var i=ie(t,n,!1);if(!j(i))return i.OrdinaryGetOwnMetadata(e,t,n)}function T(e,t,n,i){ie(n,i,!0).OrdinaryDefineOwnMetadata(e,t,n,i)}function P(e,t){var n=M(e,t),i=Q(e);if(null===i)return n;var r=P(i,t);if(r.length<=0)return n;if(n.length<=0)return r;for(var o=new a,s=[],c=0,u=n;ce,e=>e+1),e}const v="Request",g="Singleton",y="Transient",m="ConstantValue",b="DynamicValue",w="Factory",S="Instance",A="Provider",I="ResolvedValue",E="ServiceRedirection";function*O(...e){for(const t of e)yield*t}class C{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#r(n,t[n]).push(e)}clone(){const e=this.#o(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const r of n)this.#c(this.#t[r],i.#t[r],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const r of i){const n=this.#e.get(r);if(void 0===n)throw new Error("Expecting model relation, none found");for(const i of n)i[e]===t&&this.#u(r,i);this.#e.delete(r)}}_buildNewInstance(e){return new C(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#o(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#r(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#d(e,t){const n=t.get(e);if(void 0===n)throw new Error("Expecting model to be cloned, none found");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error("Expecting relation to be cloned, none found");return n}#c(e,t,n){for(const[i,r]of e){const e=new Array;for(const t of r)e.push(this.#d(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[r,o]of e){const e=new Array;for(const t of o)e.push(this.#l(t,i));t.set(this.#d(r,n),e)}}#u(e,t){for(const n of Reflect.ownKeys(t))this.#h(e,n,t[n])}#h(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const r=i.indexOf(e);-1!==r&&i.splice(r,1),0===i.length&&this.#t[t].delete(n)}}}var R,x;(x=R||(R={})).moduleId="moduleId",x.serviceId="serviceId";class T{#f;#p;constructor(e,t){this.#f=t??new C({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#p=e}static build(e){return new T(e)}add(e,t){this.#f.add(e,t)}clone(){return new T(this.#p,this.#f.clone())}get(e){const t=[],n=this.#f.get(R.serviceId,e);void 0!==n&&t.push(n);const i=this.#p()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return O(...t)}removeAllByModuleId(e){this.#f.removeByRelation(R.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(R.serviceId,e)}}const P="@inversifyjs/core/classMetadataReflectKey";function M(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}const k="@inversifyjs/core/pendingClassMetadataCountReflectKey",j=Symbol.for("@inversifyjs/core/InversifyCoreError");class _ extends Error{[j];kind;constructor(e,t,n){super(t,n),this[j]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[j]}static isErrorOfKind(e,t){return _.is(e)&&e.kind===t}}var B,N,D,F,q;function U(e){const t=d(e,P)??M();if(!function(e){const t=d(e,k);return void 0!==t&&0!==t}(e))return function(e,t){const n=[];if(t.length0)throw new _(B.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join('", "')}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,t.constructorArguments),t;!function(e,t){const n=[];for(let i=0;i!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:n,serviceIdentifier:t,type:S}}function L(e){return e.isRight?{isRight:!0,value:e.value}:e}!function(e){e[e.injectionDecoratorConflict=0]="injectionDecoratorConflict",e[e.missingInjectionDecorator=1]="missingInjectionDecorator",e[e.planning=2]="planning",e[e.resolution=3]="resolution",e[e.unknown=4]="unknown"}(B||(B={})),function(e){e[e.unknown=32]="unknown"}(N||(N={})),function(e){e.id="id",e.moduleId="moduleId",e.serviceId="serviceId"}(D||(D={}));let z=class e extends C{_buildNewInstance(t){return new e(t)}_cloneModel(e){return function(e){switch(e.type){case m:case b:return{cache:L((t=e).cache),id:t.id,isSatisfiedBy:t.isSatisfiedBy,moduleId:t.moduleId,onActivation:t.onActivation,onDeactivation:t.onDeactivation,scope:t.scope,serviceIdentifier:t.serviceIdentifier,type:t.type,value:t.value};case w:return function(e){return{cache:L(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case S:return function(e){return{cache:L(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case A:return function(e){return{cache:L(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case I:return function(e){return{cache:L(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case E:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}var t}(e)}},K=class e{#v;#g;#p;constructor(e,t,n){this.#g=n??new z({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#p=e,this.#v=t}static build(t,n){return new e(t,n)}clone(){return new e(this.#p,this.#v,this.#g.clone())}get(e){const t=this.getNonParentBindings(e)??this.#p()?.get(e);if(void 0!==t)return t;const n=this.#y(e);return void 0===n?n:[n]}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#p();if(void 0===n){if(void 0===t){const t=this.#y(e);void 0!==t&&(yield t)}}else yield*n.getChained(e)}getBoundServices(){const e=new Set(this.#g.getAllKeys(D.serviceId)),t=this.#p();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#g.get(D.id,e)??this.#p()?.getById(e)}getByModuleId(e){return this.#g.get(D.moduleId,e)??this.#p()?.getByModuleId(e)}getNonParentBindings(e){return this.#g.get(D.serviceId,e)}getNonParentBoundServices(){return this.#g.getAllKeys(D.serviceId)}removeById(e){this.#g.removeByRelation(D.id,e)}removeAllByModuleId(e){this.#g.removeByRelation(D.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(D.serviceId,e)}set(e){const t={[D.id]:e.id,[D.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[D.moduleId]=e.moduleId),this.#g.add(e,t)}#y(e){if(void 0===this.#v||"function"!=typeof e)return;const t=$(this.#v,e);return this.set(t),t}};!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(F||(F={}));let V=class e{#m;#p;constructor(e,t){this.#m=t??new C({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#p=e}static build(t){return new e(t)}add(e,t){this.#m.add(e,t)}clone(){return new e(this.#p,this.#m.clone())}get(e){const t=[],n=this.#m.get(F.serviceId,e);void 0!==n&&t.push(n);const i=this.#p()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return O(...t)}removeAllByModuleId(e){this.#m.removeByRelation(F.moduleId,e)}removeAllByServiceId(e){this.#m.removeByRelation(F.serviceId,e)}};function H(e,t,n,i){const r=Array.isArray(e)?e:[e];if(void 0!==n)if("number"!=typeof n)Reflect.decorate(r,t.prototype,n);else for(const o of r)o(t,void 0,n);else Reflect.decorate(r,t)}function W(){return 0}function J(e){return t=>{void 0!==t&&t.kind===N.unknown&&h(e,k,W,e=>e-1)}}!function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"}(q||(q={}));const G=function(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===q.unmanaged)throw new _(B.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(i,...n)}}(function(e,t,n){return e===q.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return function(e){if(e.kind!==N.unknown&&!0!==e.isFromTypescriptParamType)throw new _(B.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(e),t===q.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function X(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var Q;function Z(e,t){return(n,i,r)=>{try{void 0===r?function(e,t){const n=Y(e,t);return(e,t)=>{h(e.constructor,P,M,X(n(e),t))}}(e,t)(n,i):"number"==typeof r?function(e,t){const n=Y(e,t);return(e,t,i)=>{if(!function(e,t){return"function"==typeof e&&void 0===t}(e,t))throw new _(B.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??""}" at class "${e.constructor.name}"`);h(e,P,M,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(n(e),i))}}(e,t)(n,i,r):function(e,t){const n=Y(e,t);return(e,t,i)=>{if(void 0===i.set)throw new _(B.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${t.toString()}" at class "${e.constructor.name}"`);h(e.constructor,P,M,X(n(e),t))}}(e,t)(n,i,r)}catch(o){!function(e,t,n,i){if(_.isErrorOfKind(i,B.injectionDecoratorConflict)){const r=function(e,t,n){if(void 0===n){if(void 0===t)throw new _(B.unknown,"Unexpected undefined property and index values");return{kind:Q.property,property:t,targetClass:e.constructor}}return"number"==typeof n?{index:n,kind:Q.parameter,targetClass:e}:{kind:Q.method,method:t,targetClass:e}}(e,t,n);throw new _(B.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${i.message}\n\nDetails\n\n${function(e){switch(e.kind){case Q.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case Q.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case Q.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(r)}`,{cause:i})}throw i}(n,i,r,o)}}}function Y(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}!function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"}(Q||(Q={}));const ee="@inversifyjs/core/classIsInjectableFlagReflectKey",te=[Array,BigInt,Boolean,Function,Number,Object,String];function ne(e){return e=>{!function(e){if(void 0!==d(e,ee))throw new _(B.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);l(e,ee,!0)}(e),function(e){const t=d(e,"design:paramtypes");void 0!==t&&h(e,P,M,function(e){return t=>(e.forEach((e,n)=>{var i,r;void 0!==t.constructorArguments[n]||(i=e,te.includes(i))||(t.constructorArguments[n]=(r=e,{isFromTypescriptParamType:!0,kind:q.singleInjection,name:void 0,optional:!1,tags:new Map,value:r}))}),t)}(t))}(e)}}var ie;function re(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||"InternalError"===e.name&&/too much recursion/.test(e.message))}!function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"}(ie||(ie={}));const oe=Symbol.for("@inversifyjs/core/LazyPlanServiceNode");class se{[oe];_serviceIdentifier;_serviceNode;constructor(e,t){this[oe]=!0,this._serviceNode=e,this._serviceIdentifier=t}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[oe]}invalidate(){this._serviceNode=void 0}isExpanded(){return void 0!==this._serviceNode}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}class ae{#b;constructor(e){this.#b=e}get name(){return this.#b.elem.name}get serviceIdentifier(){return this.#b.elem.serviceIdentifier}get tags(){return this.#b.elem.tags}getAncestor(){if(this.#b.elem.getAncestorsCalled=!0,void 0!==this.#b.previous)return new ae(this.#b.previous)}}function ce(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,r=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===r.length&&void 0!==e.autobindOptions&&"function"==typeof i){const n=$(e.autobindOptions,i);e.operations.setBinding(n),n.isSatisfiedBy(t)&&r.push(n)}return r}class ue{last;constructor(e){this.last=e}concat(e){return new ue({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function de(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new ue({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}function le(e){return void 0!==e.redirections}function he(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;var a,c,u,d,l,h;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=`Ambiguous bindings found for service: "${o(s[s.length-1]??n)}".${ge(s)}\n\nRegistered bindings:\n\n${e.map(e=>function(e){switch(e.type){case S:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case E:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", redirection: "${o(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${o(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding)).join("\n")}\n\nTrying to resolve bindings for "${pe(n,i)}".${ve(r)}`;throw new _(B.planning,t)}t||fe(n,i,r,s)}(e,t,r,s,n.elem,i):(a=e,c=t,u=r,d=s,l=n.elem,h=i,void 0!==a||c||fe(u,d,l,h))}function fe(e,t,n,i){const r=`No bindings found for service: "${o(i[i.length-1]??e)}".\n\nTrying to resolve bindings for "${pe(e,t)}".${ge(i)}${ve(n)}`;throw new _(B.planning,r)}function pe(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function ve(e){const t=0===e.tags.size?"":`\n- tags:\n - ${[...e.tags.keys()].map(e=>e.toString()).join("\n - ")}`;return`\n\nBinding constraints:\n- service identifier: ${o(e.serviceIdentifier)}\n- name: ${e.name?.toString()??"-"}${t}`}function ge(e){return 0===e.length?"":`\n\n- service redirections:\n - ${e.map(e=>o(e)).join("\n - ")}`}function ye(e,t,n,i){if(1===e.redirections.length){const[r]=e.redirections;return void(le(r)&&ye(r,t,n,[...i,r.binding.targetServiceIdentifier]))}he(e.redirections,t,n,i)}function me(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(le(i)&&ye(i,t,n,[i.binding.targetServiceIdentifier]))}he(e.bindings,t,n,[])}function be(e){return a.is(e)?e.unwrap():e}function we(e){return(t,n,i)=>{const r=be(i.value),o=n.concat({getAncestorsCalled:!1,name:i.name,serviceIdentifier:r,tags:i.tags}),s=new ae(o.last),a=i.kind===q.multipleInjection&&i.chained,c=ce(t,s,{chained:a}),u=[],d={bindings:u,isContextFree:!0,serviceIdentifier:r};if(u.push(...e(t,o,c,d,a)),d.isContextFree=!o.last.elem.getAncestorsCalled,i.kind===q.singleInjection){me(d,i.optional,o.last);const[e]=u;d.bindings=e}return d}}function Se(e){return(t,n,i)=>{const r=be(i.value),o=n.concat({getAncestorsCalled:!1,name:i.name,serviceIdentifier:r,tags:i.tags}),s=new ae(o.last),a=i.kind===ie.multipleInjection&&i.chained,c=ce(t,s,{chained:a}),u=[],d={bindings:u,isContextFree:!0,serviceIdentifier:r};if(u.push(...e(t,o,c,d,a)),d.isContextFree=!o.last.elem.getAncestorsCalled,i.kind===ie.singleInjection){me(d,i.optional,o.last);const[e]=u;d.bindings=e}return d}}function Ae(e){const t=function(e){return(t,n,i)=>{const r={binding:n,classMetadata:t.operations.getClassMetadata(n.implementationType),constructorParams:[],propertyParams:new Map},o={autobindOptions:t.autobindOptions,node:r,operations:t.operations,servicesBranch:t.servicesBranch};return e(o,i)}}(e),n=function(e){return(t,n,i)=>{const r={binding:n,params:[]},o={autobindOptions:t.autobindOptions,node:r,operations:t.operations,servicesBranch:t.servicesBranch};return e(o,i)}}(e),i=(e,i,o,s,a)=>{const c=le(s)?s.binding.targetServiceIdentifier:s.serviceIdentifier;e.servicesBranch.push(c);const u=[];for(const d of o)switch(d.type){case S:u.push(t(e,d,i));break;case I:u.push(n(e,d,i));break;case E:{const t=r(e,i,d,a);u.push(t);break}default:u.push({binding:d})}return e.servicesBranch.pop(),u},r=function(e){return(t,n,i,r)=>{const o={binding:i,redirections:[]},s=ce(t,new ae(n.last),{chained:r,customServiceIdentifier:i.targetServiceIdentifier});return o.redirections.push(...e(t,n,s,o,r)),o}}(i);return i}function Ie(e,t,n,i){if(void 0!==e&&(se.is(n)&&!n.isExpanded()||n.isContextFree)){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n,i)}class Ee extends se{#w;#S;#A;#I;constructor(e,t,n,i,r){super(r,be(i.value)),this.#S=t,this.#w=e,this.#A=n,this.#I=i}_buildPlanServiceNode(){return this.#S(this.#w,this.#A,this.#I)}}class Oe extends se{#w;#E;#A;#O;constructor(e,t,n,i,r){super(r,be(i.value)),this.#w=e,this.#E=t,this.#A=n,this.#O=i}_buildPlanServiceNode(){return this.#E(this.#w,this.#A,this.#O)}}function Ce(e,t,n,i){const r=function(e,t){const n=function(e,t){return(n,i,r)=>{if(r.kind===q.unmanaged)return;const o=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=a.is(e.value)?e.value.unwrap():e.value;return e.kind===q.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(r);if(void 0!==o){const e=n.operations.getPlan(o);if(void 0!==e&&e.tree.root.isContextFree)return e.tree.root}const s=t(n,i,r),c=new Ee(n,e,i,r,s);return Ie(o,n.operations,c,{bindingConstraintsList:i,chainedBindings:r.kind===q.multipleInjection&&r.chained,optionalBindings:r.optional}),c}}(e,t);return(e,t,i)=>{const r=t.classMetadata;for(const[o,s]of r.constructorArguments.entries())t.constructorParams[o]=n(e,i,s);for(const[o,s]of r.properties){const r=n(e,i,s);void 0!==r&&t.propertyParams.set(o,r)}return e.node}}(e,n),o=function(e,t){const n=function(e,t){return(n,i,r)=>{const o=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=a.is(e.value)?e.value.unwrap():e.value;return e.kind===ie.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(r);if(void 0!==o){const e=n.operations.getPlan(o);if(void 0!==e&&e.tree.root.isContextFree)return e.tree.root}const s=t(n,i,r),c=new Oe(n,e,i,r,s);return Ie(o,n.operations,c,{bindingConstraintsList:i,chainedBindings:r.kind===ie.multipleInjection&&r.chained,optionalBindings:r.optional}),c}}(e,t);return(e,t,i)=>{const r=t.binding.metadata;for(const[o,s]of r.arguments.entries())t.params[o]=n(e,i,s);return e.node}}(t,i);return(e,t)=>e.node.binding.type===S?r(e,e.node,t):o(e,e.node,t)}class Re extends se{#w;constructor(e,t){super(t,t.serviceIdentifier),this.#w=e}_buildPlanServiceNode(){return ke(this.#w)}}const xe=we(Me),Te=Se(Me),Pe=Ae(Ce(xe,Te,xe,Te));function Me(e,t,n,i,r){return Pe(e,t,n,i,r)}const ke=function(e){return t=>{const n=de(t),i=new ae(n.last),r=t.rootConstraints.isMultiple&&t.rootConstraints.chained,o=ce(t,i,{chained:r}),s=[],a={bindings:s,isContextFree:!0,serviceIdentifier:t.rootConstraints.serviceIdentifier};if(s.push(...e(t,n,o,a,r)),a.isContextFree=!n.last.elem.getAncestorsCalled,!t.rootConstraints.isMultiple){me(a,t.rootConstraints.isOptional??!1,n.last);const[e]=s;a.bindings=e}return a}}(Pe);function je(e){try{const n=(t=e).rootConstraints.isMultiple?{chained:t.rootConstraints.chained,isMultiple:!0,name:t.rootConstraints.name,optional:t.rootConstraints.isOptional??!1,serviceIdentifier:t.rootConstraints.serviceIdentifier,tag:t.rootConstraints.tag}:{isMultiple:!1,name:t.rootConstraints.name,optional:t.rootConstraints.isOptional??!1,serviceIdentifier:t.rootConstraints.serviceIdentifier,tag:t.rootConstraints.tag},i=e.operations.getPlan(n);if(void 0!==i)return i;const r=ke(e),o={tree:{root:new Re(e,r)}};return e.operations.setPlan(n,o),o}catch(n){!function(e,t){if(re(t)){const n=function(e){const t=[...e];return 0===t.length?"(No dependency trace)":t.map(o).join(" -> ")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new _(B.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}(e,n)}var t}var _e;!function(e){e.bindingAdded="bindingAdded",e.bindingRemoved="bindingRemoved"}(_e||(_e={}));class Be{#C;#R;#x;constructor(){this.#C=[],this.#R=8,this.#x=1024}*[Symbol.iterator](){let e=0;for(const t of this.#C){const n=t.deref();void 0===n?++e:yield n}this.#C.length>=this.#R&&this.#T(e)&&this.#P(e)}push(e){const t=new WeakRef(e);if(this.#C.push(t),this.#C.length>=this.#R&&this.#C.length%this.#x===0){let e=0;for(const t of this.#C)void 0===t.deref()&&++e;this.#T(e)&&this.#P(e)}}#P(e){const t=new Array(this.#C.length-e);let n=0;for(const i of this.#C)i.deref()&&(t[n++]=i);this.#C=t}#T(e){return e>=.5*this.#C.length}}const Ne=Ae(Ce(xe,Te,function(e,t,n){return De(e,t,n)},function(e,t,n){return Fe(e,t,n)})),De=function(e){const t=we(e);return(e,n,i)=>{try{return t(e,n,i)}catch(r){if(_.isErrorOfKind(r,B.planning))return;throw r}}}(Ne),Fe=function(e){const t=Se(e);return(e,n,i)=>{try{return t(e,n,i)}catch(r){if(_.isErrorOfKind(r,B.planning))return;throw r}}}(Ne);function qe(e,t,n,i,r){if(se.is(t)&&!t.isExpanded())return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1};const o=new ae(i.last);return!n.isSatisfiedBy(o)||i.last.elem.getAncestorsCalled?{isContextFreeBinding:!i.last.elem.getAncestorsCalled,shouldInvalidateServiceNode:!1}:function(e,t,n,i,r){let o;try{[o]=Ne(e,i,[n],t,r)}catch(s){if(re(s))return{isContextFreeBinding:!1,shouldInvalidateServiceNode:!0};throw s}return function(e,t){if(Array.isArray(e.bindings))e.bindings.push(t);else{if(void 0!==e.bindings){if(!se.is(e))throw new _(B.planning,"Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!0}}e.bindings=t}return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1}}(t,o)}(e,t,n,i,r)}function Ue(e,t,n,i){if(se.is(e)&&!e.isExpanded())return{bindingNodeRemoved:void 0,isContextFreeBinding:!0};const r=new ae(n.last);if(!t.isSatisfiedBy(r)||n.last.elem.getAncestorsCalled)return{bindingNodeRemoved:void 0,isContextFreeBinding:!n.last.elem.getAncestorsCalled};let o;if(Array.isArray(e.bindings))e.bindings=e.bindings.filter(e=>e.binding!==t||(o=e,!1));else if(e.bindings?.binding===t)if(o=e.bindings,i)e.bindings=void 0;else{if(!se.is(e))throw new _(B.planning,"Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");e.invalidate()}return{bindingNodeRemoved:o,isContextFreeBinding:!0}}class $e{#M;#k;#j;#_;#B;#N;constructor(){this.#M=new Map,this.#k=this.#D(),this.#j=this.#D(),this.#_=this.#D(),this.#B=this.#D(),this.#N=new Be}clearCache(){for(const e of this.#F())e.clear();for(const e of this.#N)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#q(this.#k,e).get(e.serviceIdentifier):this.#q(this.#B,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#q(this.#j,e).get(e.serviceIdentifier)?.get(e.name):this.#q(this.#_,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateServiceBinding(e){this.#U(e),this.#$(e),this.#L(e),this.#z(e),this.#K(e);for(const t of this.#N)t.invalidateServiceBinding(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#q(this.#k,e).set(e.serviceIdentifier,t):this.#V(this.#V(this.#q(this.#B,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#V(this.#q(this.#j,e),e.serviceIdentifier).set(e.name,t):this.#V(this.#V(this.#V(this.#q(this.#_,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e,t){let n=this.#M.get(e.serviceIdentifier);void 0===n&&(n=new Map,this.#M.set(e.serviceIdentifier,n)),n.set(e,t)}subscribe(e){this.#N.push(e)}#D(){const e=new Array(8);for(let t=0;tze(e,t))):ze(e,t)}function ze(e,t){return e.cache={isRight:!0,value:t},t}async function Ke(e,t,n){let i=await t,r=n.next();for(;!0!==r.done;)i=await r.value(e.context,i),r=n.next();return i}function Ve(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=r(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return function(e,t,n){const i=e.getActivations(t);return void 0===i?n:r(n)?Ke(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(r(t))return Ke(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}(e,t.serviceIdentifier,i)}function He(e){return(t,n)=>n.cache.isRight?n.cache.value:Le(n,Ve(t,n,e(t,n)))}const We=He(function(e,t){return t.value});function Je(e){return e}function Ge(e,t){return(n,i)=>{const r=e(i);switch(r.scope){case g:return r.cache.isRight?r.cache.value:Le(r,Ve(n,r,t(n,i)));case v:{if(n.requestScopeCache.has(r.id))return n.requestScopeCache.get(r.id);const e=Ve(n,r,t(n,i));return n.requestScopeCache.set(r.id,e),e}case y:return Ve(n,r,t(n,i))}}}const Xe=Ge(Je,function(e,t){return t.value(e.context)}),Qe=He(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(!(n in e))throw new _(B.resolution,`Expecting a "${n.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[n])throw new _(B.resolution,`Expecting a "${n.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(x){throw new _(B.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:x})}if(r(i))return async function(e,t,n){try{await n}catch(i){throw new _(B.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:i})}}(t,n,i)}}(e,t,n);return r(i)?i.then(()=>e):e}function Ye(e,t,n){if(0===n.size)return e;let i=e;for(const o of n)i=r(i)?i.then(e=>Ze(e,t,o)):Ze(i,t,o);return i}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),s=e(n,o,i);return r(s)?s.then(()=>Ye(o,i.binding,i.classMetadata.lifecycle.postConstructMethodNames)):Ye(o,i.binding,i.classMetadata.lifecycle.postConstructMethodNames)}}const tt=He(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const rt=function(e){return(t,n,i)=>{const o=[];for(const[s,a]of i.propertyParams){const c=i.classMetadata.properties.get(s);if(void 0===c)throw new _(B.resolution,`Expecting metadata at property "${s.toString()}", none found`);c.kind!==q.unmanaged&&void 0!==a.bindings&&(n[s]=e(t,a),r(n[s])&&o.push((async()=>{n[s]=await n[s]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(ht),ot=function(e){return function t(n,i){const r=[];for(const o of i.redirections)le(o)?r.push(...t(n,o)):r.push(e(n,o));return r}}(lt),st=function(e,t,n){return(i,o)=>{const s=e(i,o);return r(s)?t(s,i,o):n(s,i,o)}}(function(e){return(t,n)=>{const i=[];for(const r of n.constructorParams)void 0===r?i.push(void 0):i.push(e(t,r));return i.some(r)?Promise.all(i):i}}(ht),function(e){return async(t,n,i)=>{const r=await t;return e(r,n,i)}}(et(rt)),et(rt)),at=function(e){return(t,n)=>{const i=e(t,n);return r(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const r of n.params)i.push(e(t,r));return i.some(r)?Promise.all(i):i}}(ht)),ct=(e=>Ge(nt,e))(st),ut=(e=>Ge(it,e))(at);function dt(e){try{return ht(e,e.planResult.tree.root)}catch(t){!function(e,t){if(re(t)){const n=function(e){const t=[...e];return 0===t.length?"(No dependency trace)":t.map(o).join(" -> ")}(function(e){const t=e.planResult.tree.root,n=[];return function e(t){const i=n.indexOf(t);if(-1!==i)return[...n.slice(i),t].map(e=>e.serviceIdentifier);n.push(t);try{for(const n of function(e){const t=[],n=e.bindings;if(void 0===n)return t;const i=e=>{if(le(e))for(const t of e.redirections)i(t);else switch(e.binding.type){case S:{const n=e;for(const e of n.constructorParams)void 0!==e&&t.push(e);for(const e of n.propertyParams.values())t.push(e);break}case I:{const n=e;for(const e of n.params)t.push(e);break}}};if(Array.isArray(n))for(const r of n)i(r);else i(n);return t}(t)){const t=e(n);if(void 0!==t)return t}}finally{n.pop()}}(t)??[]}(e));throw new _(B.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}(e,t)}}function lt(e,t){switch(t.binding.type){case m:return We(e,t.binding);case b:return Xe(e,t.binding);case w:return Qe(e,t.binding);case S:return ct(e,t);case A:return tt(e,t.binding);case I:return ut(e,t)}}function ht(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)le(i)?n.push(...ot(e,i)):n.push(lt(e,i));return n.some(r)?Promise.all(n):n}(e,t.bindings):function(e,t){if(le(t)){const n=ot(e,t);if(1===n.length)return n[0];throw new _(B.resolution,"Unexpected multiple resolved values on single injection")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function pt(e,t){if("function"==typeof e[t])return e[t]()}function vt(e,t){const n=e.lifecycle.preDestroyMethodNames;if(0===n.size)return;let i;for(const r of n)i=void 0===i?pt(t,r):i.then(()=>pt(t,r));return i}function gt(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return r(n)?yt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){if(r(n.value(e)))return yt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function yt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===S){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return r(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?bt(e,t):n.then(()=>bt(e,t))}function bt(e,t){const n=t.cache;return r(n.value)?n.value.then(n=>wt(e,t,n)):wt(e,t,n.value)}function wt(e,t,n){let i;return void 0!==t.onDeactivation&&(i=(0,t.onDeactivation)(n)),void 0===i?gt(e,t.serviceIdentifier,n):i.then(()=>gt(e,t.serviceIdentifier,n))}function St(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===g&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const r of n){const t=mt(e,r);void 0!==t&&i.push(t)}return i.length>0?Promise.all(i).then(()=>{}):void 0}const At=Symbol.for("@inversifyjs/plugin/isPlugin"),It=Symbol.for("@inversifyjs/container/bindingIdentifier");function Et(e){return"object"==typeof e&&null!==e&&!0===e[It]}class Ot{static always=e=>!0}const Ct=Symbol.for("@inversifyjs/container/InversifyContainerError");class Rt extends Error{[Ct];kind;constructor(e,t,n){super(t,n),this[Ct]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[Ct]}static isErrorOfKind(e,t){return Rt.is(e)&&e.kind===t}}var xt;function Tt(e){return{[It]:!0,id:e.id}}function Pt(e){return t=>{for(let n=t.getAncestor();void 0!==n;n=n.getAncestor())if(e(n))return!0;return!1}}function Mt(e){return t=>t.name===e}function kt(e){return t=>t.serviceIdentifier===e}function jt(e,t){return n=>n.tags.has(e)&&n.tags.get(e)===t}function _t(e){return void 0===e.name&&0===e.tags.size}function Bt(e){const t=Pt(e);return e=>!t(e)}function Nt(e){return t=>{const n=t.getAncestor();return void 0===n||!e(n)}}function Dt(e){return t=>{const n=t.getAncestor();return void 0!==n&&e(n)}}!function(e){e[e.invalidOperation=0]="invalidOperation"}(xt||(xt={}));class Ft{#i;constructor(e){this.#i=e}getIdentifier(){return Tt(this.#i)}inRequestScope(){return this.#i.scope=v,new Lt(this.#i)}inSingletonScope(){return this.#i.scope=g,new Lt(this.#i)}inTransientScope(){return this.#i.scope=y,new Lt(this.#i)}}class qt{#t;#o;#a;#s;constructor(e,t,n,i){this.#t=e,this.#o=t,this.#a=n,this.#s=i}to(e){const t=U(e),n={cache:{isRight:!1,value:void 0},id:p(),implementationType:e,isSatisfiedBy:Ot.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:t.scope??this.#a,serviceIdentifier:this.#s,type:S};return this.#t(n),new zt(n)}toSelf(){if("function"!=typeof this.#s)throw new Error('"toSelf" function can only be applied when a newable function is used as service identifier');return this.to(this.#s)}toConstantValue(e){const t={cache:{isRight:!1,value:void 0},id:p(),isSatisfiedBy:Ot.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:g,serviceIdentifier:this.#s,type:m,value:e};return this.#t(t),new Lt(t)}toDynamicValue(e){const t={cache:{isRight:!1,value:void 0},id:p(),isSatisfiedBy:Ot.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:this.#a,serviceIdentifier:this.#s,type:b,value:e};return this.#t(t),new zt(t)}toResolvedValue(e,t){const n={cache:{isRight:!1,value:void 0},factory:e,id:p(),isSatisfiedBy:Ot.always,metadata:this.#r(t),moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:this.#a,serviceIdentifier:this.#s,type:I};return this.#t(n),new zt(n)}toFactory(e){const t={cache:{isRight:!1,value:void 0},factory:e,id:p(),isSatisfiedBy:Ot.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:g,serviceIdentifier:this.#s,type:w};return this.#t(t),new Lt(t)}toProvider(e){const t={cache:{isRight:!1,value:void 0},id:p(),isSatisfiedBy:Ot.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,provider:e,scope:g,serviceIdentifier:this.#s,type:A};return this.#t(t),new Lt(t)}toService(e){const t={id:p(),isSatisfiedBy:Ot.always,moduleId:this.#o,serviceIdentifier:this.#s,targetServiceIdentifier:e,type:E};this.#t(t)}#r(e){return{arguments:(e??[]).map(e=>{return"object"!=typeof(t=e)||a.is(t)?{kind:ie.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}:function(e){return!0===e.isMultiple}(e)?{chained:e.chained??!1,kind:ie.multipleInjection,name:e.name,optional:e.optional??!1,tags:new Map((e.tags??[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier}:{kind:ie.singleInjection,name:e.name,optional:e.optional??!1,tags:new Map((e.tags??[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier};var t})}}}class Ut{#i;constructor(e){this.#i=e}getIdentifier(){return Tt(this.#i)}onActivation(e){return this.#i.onActivation=e,new $t(this.#i)}onDeactivation(e){if(this.#i.onDeactivation=e,this.#i.scope!==g)throw new Rt(xt.invalidOperation,`Binding for service "${o(this.#i.serviceIdentifier)}" has a deactivation function, but its scope is not singleton. Deactivation functions can only be used with singleton bindings.`);return new $t(this.#i)}}class $t{#i;constructor(e){this.#i=e}getIdentifier(){return Tt(this.#i)}when(e){return this.#i.isSatisfiedBy=e,new Ut(this.#i)}whenAnyAncestor(e){return this.when(Pt(e))}whenAnyAncestorIs(e){return this.when(Pt(kt(e)))}whenAnyAncestorNamed(e){return this.when(Pt(Mt(e)))}whenAnyAncestorTagged(e,t){return this.when(Pt(jt(e,t)))}whenDefault(){return this.when(_t)}whenNamed(e){return this.when(Mt(e))}whenNoParent(e){return this.when(Nt(e))}whenNoParentIs(e){return this.when(Nt(kt(e)))}whenNoParentNamed(e){return this.when(Nt(Mt(e)))}whenNoParentTagged(e,t){return this.when(Nt(jt(e,t)))}whenParent(e){return this.when(Dt(e))}whenParentIs(e){return this.when(Dt(kt(e)))}whenParentNamed(e){return this.when(Dt(Mt(e)))}whenParentTagged(e,t){return this.when(Dt(jt(e,t)))}whenTagged(e,t){return this.when(jt(e,t))}whenNoAncestor(e){return this.when(Bt(e))}whenNoAncestorIs(e){return this.when(Bt(kt(e)))}whenNoAncestorNamed(e){return this.when(Bt(Mt(e)))}whenNoAncestorTagged(e,t){return this.when(Bt(jt(e,t)))}}class Lt extends $t{#c;constructor(e){super(e),this.#c=new Ut(e)}onActivation(e){return this.#c.onActivation(e)}onDeactivation(e){return this.#c.onDeactivation(e)}}class zt extends Lt{#u;constructor(e){super(e),this.#u=new Ft(e)}inRequestScope(){return this.#u.inRequestScope()}inSingletonScope(){return this.#u.inSingletonScope()}inTransientScope(){return this.#u.inTransientScope()}}class Kt{#l;#a;#d;#v;constructor(e,t,n,i){this.#l=e,this.#a=t,this.#d=n,this.#v=i}bind(e){return new qt(e=>{this.#p(e)},void 0,this.#a,e)}isBound(e,t){const n=this.#v.bindingService.get(e);return this.#g(e,n,t)}isCurrentBound(e,t){const n=this.#v.bindingService.getNonParentBindings(e);return this.#g(e,n,t)}async rebind(e){return await this.unbind(e),this.bind(e)}rebindSync(e){return this.unbindSync(e),this.bind(e)}async unbind(e){await this.#f(e)}async unbindAll(){const e=[...this.#v.bindingService.getNonParentBoundServices()];await Promise.all(e.map(async e=>function(e,t){const n=e.getBindings(t);return St(e,n)}(this.#l,e)));for(const t of e)this.#v.activationService.removeAllByServiceId(t),this.#v.bindingService.removeAllByServiceId(t),this.#v.deactivationService.removeAllByServiceId(t);this.#v.planResultCacheService.clearCache()}unbindSync(e){void 0!==this.#f(e)&&this.#S(e)}#p(e){this.#v.bindingService.set(e),this.#d.invalidateService({binding:e,kind:_e.bindingAdded})}#S(e){let t;if(Et(e)){const i=this.#v.bindingService.getById(e.id),r=(n=i,function(e){if(void 0===e)return;const t=e.next();return!0!==t.done?t.value:void 0}(n?.[Symbol.iterator]()))?.serviceIdentifier;t=void 0===r?"Unexpected asynchronous deactivation when unbinding binding identifier. Consider using Container.unbind() instead.":`Unexpected asynchronous deactivation when unbinding "${o(r)}" binding. Consider using Container.unbind() instead.`}else t=`Unexpected asynchronous deactivation when unbinding "${o(e)}" service. Consider using Container.unbind() instead.`;var n;throw new Rt(xt.invalidOperation,t)}#f(e){return Et(e)?this.#h(e):this.#E(e)}#h(e){const t=this.#v.bindingService.getById(e.id),n=void 0===t?void 0:[...t],i=St(this.#l,t);if(void 0!==i)return i.then(()=>{this.#b(n,e)});this.#b(n,e)}#b(e,t){if(this.#v.bindingService.removeById(t.id),void 0!==e)for(const n of e)this.#d.invalidateService({binding:n,kind:_e.bindingRemoved})}#E(e){const t=this.#v.bindingService.get(e),n=void 0===t?void 0:[...t],i=St(this.#l,t);if(void 0!==i)return i.then(()=>{this.#x(e,n)});this.#x(e,n)}#x(e,t){if(this.#v.activationService.removeAllByServiceId(e),this.#v.bindingService.removeAllByServiceId(e),this.#v.deactivationService.removeAllByServiceId(e),void 0!==t)for(const n of t)this.#d.invalidateService({binding:n,kind:_e.bindingRemoved})}#g(e,t,n){if(void 0===t)return!1;const i={getAncestor:()=>{},name:n?.name,serviceIdentifier:e,tags:new Map};void 0!==n?.tag&&i.tags.set(n.tag.key,n.tag.value);for(const r of t)if(r.isSatisfiedBy(i))return!0;return!1}}class Vt{#m;#l;#a;#d;#v;constructor(e,t,n,i,r){this.#m=e,this.#l=t,this.#a=n,this.#d=i,this.#v=r}async load(...e){await Promise.all(this.#n(...e))}loadSync(...e){const t=this.#n(...e);for(const n of t)if(void 0!==n)throw new Rt(xt.invalidOperation,"Unexpected asynchronous module load. Consider using Container.load() instead.")}async unload(...e){await Promise.all(this.#y(...e)),this.#A(e)}unloadSync(...e){const t=this.#y(...e);for(const n of t)if(void 0!==n)throw new Rt(xt.invalidOperation,"Unexpected asynchronous module unload. Consider using Container.unload() instead.");this.#A(e)}#w(e){return{bind:t=>new qt(e=>{this.#p(e)},e,this.#a,t),isBound:this.#m.isBound.bind(this.#m),onActivation:(t,n)=>{this.#v.activationService.add(n,{moduleId:e,serviceId:t})},onDeactivation:(t,n)=>{this.#v.deactivationService.add(n,{moduleId:e,serviceId:t})},rebind:this.#m.rebind.bind(this.#m),rebindSync:this.#m.rebindSync.bind(this.#m),unbind:this.#m.unbind.bind(this.#m),unbindSync:this.#m.unbindSync.bind(this.#m)}}#A(e){for(const t of e)this.#v.activationService.removeAllByModuleId(t.id),this.#v.bindingService.removeAllByModuleId(t.id),this.#v.deactivationService.removeAllByModuleId(t.id);this.#v.planResultCacheService.clearCache()}#n(...e){return e.map(e=>e.load(this.#w(e.id)))}#p(e){this.#v.bindingService.set(e),this.#d.invalidateService({binding:e,kind:_e.bindingAdded})}#y(...e){return e.map(e=>function(e,t){const n=e.getBindingsFromModule(t);return St(e,n)}(this.#l,e.id))}}class Ht{deactivationParams;constructor(e){var t;this.deactivationParams={getBindings:(t=e).bindingService.get.bind(t.bindingService),getBindingsFromModule:t.bindingService.getByModuleId.bind(t.bindingService),getClassMetadata:U,getDeactivations:t.deactivationService.get.bind(t.deactivationService)},e.onReset(()=>{!function(e,t){t.getBindings=e.bindingService.get.bind(e.bindingService),t.getBindingsFromModule=e.bindingService.getByModuleId.bind(e.bindingService),t.getDeactivations=e.deactivationService.get.bind(e.deactivationService)}(e,this.deactivationParams)})}}class Wt{planParamsOperations;#v;constructor(e){this.#v=e,this.planParamsOperations={getBindings:this.#v.bindingService.get.bind(this.#v.bindingService),getBindingsChained:this.#v.bindingService.getChained.bind(this.#v.bindingService),getClassMetadata:U,getPlan:this.#v.planResultCacheService.get.bind(this.#v.planResultCacheService),setBinding:this.#p.bind(this),setNonCachedServiceNode:this.#v.planResultCacheService.setNonCachedServiceNode.bind(this.#v.planResultCacheService),setPlan:this.#v.planResultCacheService.set.bind(this.#v.planResultCacheService)},this.#v.onReset(()=>{this.#R()})}#R(){this.planParamsOperations.getBindings=this.#v.bindingService.get.bind(this.#v.bindingService),this.planParamsOperations.getBindingsChained=this.#v.bindingService.getChained.bind(this.#v.bindingService),this.planParamsOperations.setBinding=this.#p.bind(this)}#p(e){this.#v.bindingService.set(e),this.#v.planResultCacheService.invalidateServiceBinding({binding:e,kind:_e.bindingAdded,operations:this.planParamsOperations})}}class Jt{#C;#v;constructor(e,t){this.#C=e,this.#v=t}invalidateService(e){this.#v.planResultCacheService.invalidateServiceBinding({...e,operations:this.#C.planParamsOperations})}}class Gt{#I;#k;#F;#v;constructor(e,t,n){this.#v=t,this.#F=n,this.#I=this.#T(e),this.#k=this.#_()}register(e,t){const n=new t(e,this.#k);if(!0!==n[At])throw new Rt(xt.invalidOperation,"Invalid plugin. The plugin must extend the Plugin class");n.load(this.#I)}#T(e){return{define:(t,n)=>{if(Object.prototype.hasOwnProperty.call(e,t))throw new Rt(xt.invalidOperation,`Container already has a method named "${String(t)}"`);e[t]=n},onPlan:this.#F.onPlan.bind(this.#F)}}#_(){const e=this.#v;return{get activationService(){return e.activationService},get bindingService(){return e.bindingService},get deactivationService(){return e.deactivationService},get planResultCacheService(){return e.planResultCacheService}}}}class Xt{activationService;bindingService;deactivationService;planResultCacheService;#O;constructor(e,t,n,i){this.activationService=e,this.bindingService=t,this.deactivationService=n,this.planResultCacheService=i,this.#O=[]}reset(e,t,n){this.activationService=e,this.bindingService=t,this.deactivationService=n,this.planResultCacheService.clearCache();for(const i of this.#O)i()}onReset(e){this.#O.push(e)}}class Qt{#j;#a;#z;#N;#M;#C;#v;constructor(e,t,n,i){this.#C=e,this.#v=t,this.#N=this.#P(),this.#j=n,this.#a=i,this.#z=e=>this.#v.activationService.get(e),this.#M=[],this.#v.onReset(()=>{this.#R()})}get(e,t){const n=this.#D(!1,e,t),i=this.#q(n);if(r(i))throw new Rt(xt.invalidOperation,`Unexpected asynchronous service when resolving service "${o(e)}"`);return i}getAll(e,t){const n=this.#D(!0,e,t),i=this.#q(n);if(r(i))throw new Rt(xt.invalidOperation,`Unexpected asynchronous service when resolving service "${o(e)}"`);return i}async getAllAsync(e,t){const n=this.#D(!0,e,t);return this.#q(n)}async getAsync(e,t){const n=this.#D(!1,e,t);return this.#q(n)}onPlan(e){this.#M.push(e)}#R(){this.#N=this.#P()}#L(e,t,n){const i=n?.name,r=n?.optional??!1,o=n?.tag;return e?{chained:n?.chained??!1,isMultiple:e,name:i,optional:r,serviceIdentifier:t,tag:o}:{isMultiple:e,name:i,optional:r,serviceIdentifier:t,tag:o}}#B(e,t,n){const i={autobindOptions:n?.autobind??this.#j?{scope:this.#a}:void 0,operations:this.#C.planParamsOperations,rootConstraints:this.#V(e,t,n),servicesBranch:[]};return this.#H(i,n),i}#V(e,t,n){return t?{chained:n?.chained??!1,isMultiple:t,serviceIdentifier:e}:{isMultiple:t,serviceIdentifier:e}}#D(e,t,n){const i=this.#L(e,t,n),r=this.#v.planResultCacheService.get(i);if(void 0!==r)return r;const o=je(this.#B(t,e,n));for(const s of this.#M)s(i,o);return o}#P(){return{get:this.get.bind(this),getAll:this.getAll.bind(this),getAllAsync:this.getAllAsync.bind(this),getAsync:this.getAsync.bind(this)}}#q(e){return dt({context:this.#N,getActivations:this.#z,planResult:e,requestScopeCache:new Map})}#H(e,t){void 0!==t&&(void 0!==t.name&&(e.rootConstraints.name=t.name),!0===t.optional&&(e.rootConstraints.isOptional=!0),void 0!==t.tag&&(e.rootConstraints.tag={key:t.tag.key,value:t.tag.value}),e.rootConstraints.isMultiple&&(e.rootConstraints.chained=t?.chained??!1))}}class Zt{#v;#G;constructor(e){this.#v=e,this.#G=[]}restore(){const e=this.#G.pop();if(void 0===e)throw new Rt(xt.invalidOperation,"No snapshot available to restore");this.#v.reset(e.activationService,e.bindingService,e.deactivationService)}snapshot(){this.#G.push({activationService:this.#v.activationService.clone(),bindingService:this.#v.bindingService.clone(),deactivationService:this.#v.deactivationService.clone()})}}const Yt=y;class en{#m;#U;#$;#v;#F;#K;constructor(e){const t=e?.autobind??!1,n=e?.defaultScope??Yt;this.#v=this.#J(e,t,n);const i=new Wt(this.#v),r=new Jt(i,this.#v),o=new Ht(this.#v);this.#m=new Kt(o.deactivationParams,n,r,this.#v),this.#U=new Vt(this.#m,o.deactivationParams,n,r,this.#v),this.#F=new Qt(i,this.#v,t,n),this.#$=new Gt(this,this.#v,this.#F),this.#K=new Zt(this.#v)}bind(e){return this.#m.bind(e)}get(e,t){return this.#F.get(e,t)}getAll(e,t){return this.#F.getAll(e,t)}async getAllAsync(e,t){return this.#F.getAllAsync(e,t)}async getAsync(e,t){return this.#F.getAsync(e,t)}isBound(e,t){return this.#m.isBound(e,t)}isCurrentBound(e,t){return this.#m.isCurrentBound(e,t)}async load(...e){return this.#U.load(...e)}loadSync(...e){this.#U.loadSync(...e)}onActivation(e,t){this.#v.activationService.add(t,{serviceId:e})}onDeactivation(e,t){this.#v.deactivationService.add(t,{serviceId:e})}register(e){this.#$.register(this,e)}restore(){this.#K.restore()}async rebind(e){return this.#m.rebind(e)}rebindSync(e){return this.#m.rebindSync(e)}snapshot(){this.#K.snapshot()}async unbind(e){await this.#m.unbind(e)}async unbindAll(){return this.#m.unbindAll()}unbindSync(e){this.#m.unbindSync(e)}async unload(...e){return this.#U.unload(...e)}unloadSync(...e){this.#U.unloadSync(...e)}#X(e,t){if(e)return{scope:t}}#J(e,t,n){const i=this.#X(t,n);if(void 0===e?.parent)return new Xt(T.build(()=>{}),K.build(()=>{},i),V.build(()=>{}),new $e);const r=new $e,o=e.parent;return o.#v.planResultCacheService.subscribe(r),new Xt(T.build(()=>o.#v.activationService),K.build(()=>o.#v.bindingService,i),V.build(()=>o.#v.deactivationService),r)}}var tn=Symbol.for("INJECTION");function nn(e,t,n,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){return Reflect.hasMetadata(tn,this,t)?Reflect.getMetadata(tn,this,t):n()},set:function(e){Reflect.defineMetadata(tn,e,this,t)}})}function rn(e,t){var n=function(e){return function(t){return function(n,i){nn(n,i,function(){return e.get(t)})}}}(e),i=function(e){return function(t,n){return function(i,r){nn(i,r,function(){return e.getNamed(t,n)})}}}(e),r=function(e){return function(t,n,i){return function(r,o){nn(r,o,function(){return e.getTagged(t,n,i)})}}}(e),o=function(e){return function(t){return function(n,i){nn(n,i,function(){return e.getAll(t)})}}}(e);return{lazyInject:n,lazyInjectNamed:i,lazyInjectTagged:r,lazyMultiInject:o}}class on{static defaultScope="Singleton";container=new en({autobind:!0,defaultScope:on.defaultScope});lazyInject=rn(this.container).lazyInject;get(e){return this.container.get(e)}getAll(e){return this.container.getAll(e)}bind(e){return this.container.bind(e)}bindForce(e){return this.container.isBound(e)?this.container.rebindSync(e):this.container.bind(e)}unbind(e){return this.container.unbindSync(e)}isBound(e){return this.container.isBound(e)}}const sn=new on;function an(){return e=>{H(ne(),e)}}function cn(e){return(t,n,i)=>{"function"==typeof t&&H(function(e){return Z(G(q.singleInjection,e),J)}(e),t,i)}}const un=Symbol("TradingAssetService");function dn(e,{include:t,exclude:n}={}){const i=e=>{const i=t=>"string"==typeof t?e===t:t.test(e);return t?t.some(i):!n||!n.some(i)};for(const[r,o]of(e=>{const t=new Set;do{for(const n of Reflect.ownKeys(e))t.add([e,n])}while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t})(e.constructor.prototype)){if("constructor"===o||!i(o))continue;const t=Reflect.getOwnPropertyDescriptor(r,o);t&&"function"==typeof t.value&&(e[o]=e[o].bind(e))}return e}const ln=Symbol("TradingAssetRepository"),hn=Symbol("HttpService");function fn(e,t){return function(){return e.apply(t,arguments)}}const{toString:pn}=Object.prototype,{getPrototypeOf:vn}=Object,{iterator:gn,toStringTag:yn}=Symbol,mn=(e=>t=>{const n=pn.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),bn=e=>(e=e.toLowerCase(),t=>mn(t)===e),wn=e=>t=>typeof t===e,{isArray:Sn}=Array,An=wn("undefined");function In(e){return null!==e&&!An(e)&&null!==e.constructor&&!An(e.constructor)&&Cn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const En=bn("ArrayBuffer");const On=wn("string"),Cn=wn("function"),Rn=wn("number"),xn=e=>null!==e&&"object"==typeof e,Tn=e=>{if("object"!==mn(e))return!1;const t=vn(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||yn in e||gn in e)},Pn=bn("Date"),Mn=bn("File"),kn=bn("Blob"),jn=bn("FileList"),_n=bn("URLSearchParams"),[Bn,Nn,Dn,Fn]=["ReadableStream","Request","Response","Headers"].map(bn);function qn(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let i,r;if("object"!=typeof e&&(e=[e]),Sn(e))for(i=0,r=e.length;i0;)if(i=n[r],t===i.toLowerCase())return i;return null}const $n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ln=e=>!An(e)&&e!==$n;const zn=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&vn(Uint8Array)),Kn=bn("HTMLFormElement"),Vn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Hn=bn("RegExp"),Wn=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};qn(n,(n,r)=>{let o;!1!==(o=t(n,r,e))&&(i[r]=o||n)}),Object.defineProperties(e,i)};const Jn=bn("AsyncFunction"),Gn=(Xn="function"==typeof setImmediate,Qn=Cn($n.postMessage),Xn?setImmediate:Qn?(Zn=`axios@${Math.random()}`,Yn=[],$n.addEventListener("message",({source:e,data:t})=>{e===$n&&t===Zn&&Yn.length&&Yn.shift()()},!1),e=>{Yn.push(e),$n.postMessage(Zn,"*")}):e=>setTimeout(e));var Xn,Qn,Zn,Yn;const ei="undefined"!=typeof queueMicrotask?queueMicrotask.bind($n):"undefined"!=typeof process&&process.nextTick||Gn,ti={isArray:Sn,isArrayBuffer:En,isBuffer:In,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Cn(e.append)&&("formdata"===(t=mn(e))||"object"===t&&Cn(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&En(e.buffer),t},isString:On,isNumber:Rn,isBoolean:e=>!0===e||!1===e,isObject:xn,isPlainObject:Tn,isEmptyObject:e=>{if(!xn(e)||In(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(x){return!1}},isReadableStream:Bn,isRequest:Nn,isResponse:Dn,isHeaders:Fn,isUndefined:An,isDate:Pn,isFile:Mn,isBlob:kn,isRegExp:Hn,isFunction:Cn,isStream:e=>xn(e)&&Cn(e.pipe),isURLSearchParams:_n,isTypedArray:zn,isFileList:jn,forEach:qn,merge:function e(){const{caseless:t,skipUndefined:n}=Ln(this)&&this||{},i={},r=(r,o)=>{const s=t&&Un(i,o)||o;Tn(i[s])&&Tn(r)?i[s]=e(i[s],r):Tn(r)?i[s]=e({},r):Sn(r)?i[s]=r.slice():n&&An(r)||(i[s]=r)};for(let o=0,s=arguments.length;o(qn(t,(t,i)=>{n&&Cn(t)?e[i]=fn(t,n):e[i]=t},{allOwnKeys:i}),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,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,i)=>{let r,o,s;const a={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)s=r[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&vn(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:mn,kindOfTest:bn,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return-1!==i&&i===n},toArray:e=>{if(!e)return null;if(Sn(e))return e;let t=e.length;if(!Rn(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[gn]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const i=[];for(;null!==(n=e.exec(t));)i.push(n);return i},isHTMLForm:Kn,hasOwnProperty:Vn,hasOwnProp:Vn,reduceDescriptors:Wn,freezeMethods:e=>{Wn(e,(t,n)=>{if(Cn(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=e[n];Cn(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},i=e=>{e.forEach(e=>{n[e]=!0})};return Sn(e)?i(e):i(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Un,global:$n,isContextDefined:Ln,isSpecCompliantForm:function(e){return!!(e&&Cn(e.append)&&"FormData"===e[yn]&&e[gn])},toJSONObject:e=>{const t=new Array(10),n=(e,i)=>{if(xn(e)){if(t.indexOf(e)>=0)return;if(In(e))return e;if(!("toJSON"in e)){t[i]=e;const r=Sn(e)?[]:{};return qn(e,(e,t)=>{const o=n(e,i+1);!An(o)&&(r[t]=o)}),t[i]=void 0,r}}return e};return n(e,0)},isAsyncFn:Jn,isThenable:e=>e&&(xn(e)||Cn(e))&&Cn(e.then)&&Cn(e.catch),setImmediate:Gn,asap:ei,isIterable:e=>null!=e&&Cn(e[gn])};function ni(e,t,n,i,r){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),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}ti.inherits(ni,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:ti.toJSONObject(this.config),code:this.code,status:this.status}}});const ii=ni.prototype,ri={};["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=>{ri[e]={value:e}}),Object.defineProperties(ni,ri),Object.defineProperty(ii,"isAxiosError",{value:!0}),ni.from=(e,t,n,i,r,o)=>{const s=Object.create(ii);ti.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return ni.call(s,a,c,n,i,r),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function oi(e){return ti.isPlainObject(e)||ti.isArray(e)}function si(e){return ti.endsWith(e,"[]")?e.slice(0,-2):e}function ai(e,t,n){return e?e.concat(t).map(function(e,t){return e=si(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ci=ti.toFlatObject(ti,{},null,function(e){return/^is[A-Z]/.test(e)});function ui(e,t,n){if(!ti.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(n=ti.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ti.isUndefined(t[e])})).metaTokens,r=n.visitor||u,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ti.isSpecCompliantForm(t);if(!ti.isFunction(r))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ti.isDate(e))return e.toISOString();if(ti.isBoolean(e))return e.toString();if(!a&&ti.isBlob(e))throw new ni("Blob is not supported. Use a Buffer instead.");return ti.isArrayBuffer(e)||ti.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,r){let a=e;if(e&&!r&&"object"==typeof e)if(ti.endsWith(n,"{}"))n=i?n:n.slice(0,-2),e=JSON.stringify(e);else if(ti.isArray(e)&&function(e){return ti.isArray(e)&&!e.some(oi)}(e)||(ti.isFileList(e)||ti.endsWith(n,"[]"))&&(a=ti.toArray(e)))return n=si(n),a.forEach(function(e,i){!ti.isUndefined(e)&&null!==e&&t.append(!0===s?ai([n],i,o):null===s?n:n+"[]",c(e))}),!1;return!!oi(e)||(t.append(ai(r,n,o),c(e)),!1)}const d=[],l=Object.assign(ci,{defaultVisitor:u,convertValue:c,isVisitable:oi});if(!ti.isObject(e))throw new TypeError("data must be an object");return function e(n,i){if(!ti.isUndefined(n)){if(-1!==d.indexOf(n))throw Error("Circular reference detected in "+i.join("."));d.push(n),ti.forEach(n,function(n,o){!0===(!(ti.isUndefined(n)||null===n)&&r.call(t,n,ti.isString(o)?o.trim():o,i,l))&&e(n,i?i.concat(o):[o])}),d.pop()}}(e),t}function di(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function li(e,t){this._pairs=[],e&&ui(e,this,t)}const hi=li.prototype;function fi(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function pi(e,t,n){if(!t)return e;const i=n&&n.encode||fi;ti.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(o=r?r(t,n):ti.isURLSearchParams(t)?t.toString():new li(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}hi.append=function(e,t){this._pairs.push([e,t])},hi.toString=function(e){const t=e?function(t){return e.call(this,t,di)}:di;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class vi{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ti.forEach(this.handlers,function(t){null!==t&&e(t)})}}const gi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yi={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:li,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},mi="undefined"!=typeof window&&"undefined"!=typeof document,bi="object"==typeof navigator&&navigator||void 0,wi=mi&&(!bi||["ReactNative","NativeScript","NS"].indexOf(bi.product)<0),Si="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ai=mi&&window.location.href||"http://localhost",Ii={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:mi,hasStandardBrowserEnv:wi,hasStandardBrowserWebWorkerEnv:Si,navigator:bi,origin:Ai},Symbol.toStringTag,{value:"Module"})),...yi};function Ei(e){function t(e,n,i,r){let o=e[r++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=r>=e.length;if(o=!o&&ti.isArray(i)?i.length:o,a)return ti.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!s;i[o]&&ti.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],r)&&ti.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let o;for(i=0;i{t(function(e){return ti.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),i,n,0)}),n}return null}const Oi={transitional:gi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,r=ti.isObject(e);r&&ti.isHTMLForm(e)&&(e=new FormData(e));if(ti.isFormData(e))return i?JSON.stringify(Ei(e)):e;if(ti.isArrayBuffer(e)||ti.isBuffer(e)||ti.isStream(e)||ti.isFile(e)||ti.isBlob(e)||ti.isReadableStream(e))return e;if(ti.isArrayBufferView(e))return e.buffer;if(ti.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ui(e,new Ii.classes.URLSearchParams,{visitor:function(e,t,n,i){return Ii.isNode&&ti.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=ti.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ui(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return r||i?(t.setContentType("application/json",!1),function(e,t,n){if(ti.isString(e))try{return(t||JSON.parse)(e),ti.trim(e)}catch(x){if("SyntaxError"!==x.name)throw x}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Oi.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(ti.isResponse(e)||ti.isReadableStream(e))return e;if(e&&ti.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(x){if(n){if("SyntaxError"===x.name)throw ni.from(x,ni.ERR_BAD_RESPONSE,this,null,this.response);throw x}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ii.classes.FormData,Blob:Ii.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ti.forEach(["delete","get","head","post","put","patch"],e=>{Oi.headers[e]={}});const Ci=ti.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"]),Ri=Symbol("internals");function xi(e){return e&&String(e).trim().toLowerCase()}function Ti(e){return!1===e||null==e?e:ti.isArray(e)?e.map(Ti):String(e)}function Pi(e,t,n,i,r){return ti.isFunction(i)?i.call(this,t,n):(r&&(t=n),ti.isString(t)?ti.isString(i)?-1!==t.indexOf(i):ti.isRegExp(i)?i.test(t):void 0:void 0)}let Mi=class{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function r(e,t,n){const r=xi(t);if(!r)throw new Error("header name must be a non-empty string");const o=ti.findKey(i,r);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=Ti(e))}const o=(e,t)=>ti.forEach(e,(e,n)=>r(e,n,t));if(ti.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ti.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&Ci[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t})(e),t);else if(ti.isObject(e)&&ti.isIterable(e)){let n,i,r={};for(const t of e){if(!ti.isArray(t))throw TypeError("Object iterator must return a key-value pair");r[i=t[0]]=(n=r[i])?ti.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(r,t)}else null!=e&&r(t,e,n);return this}get(e,t){if(e=xi(e)){const n=ti.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(ti.isFunction(t))return t.call(this,e,n);if(ti.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=xi(e)){const n=ti.findKey(this,e);return!(!n||void 0===this[n]||t&&!Pi(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function r(e){if(e=xi(e)){const r=ti.findKey(n,e);!r||t&&!Pi(0,n[r],r,t)||(delete n[r],i=!0)}}return ti.isArray(e)?e.forEach(r):r(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!Pi(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return ti.forEach(this,(i,r)=>{const o=ti.findKey(n,r);if(o)return t[o]=Ti(i),void delete t[r];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(r):String(r).trim();s!==r&&delete t[r],t[s]=Ti(i),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ti.forEach(this,(n,i)=>{null!=n&&!1!==n&&(t[i]=e&&ti.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Ri]=this[Ri]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=xi(e);t[i]||(!function(e,t){const n=ti.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[i]=!0)}return ti.isArray(e)?e.forEach(i):i(e),this}};function ki(e,t){const n=this||Oi,i=t||n,r=Mi.from(i.headers);let o=i.data;return ti.forEach(e,function(e){o=e.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function ji(e){return!(!e||!e.__CANCEL__)}function _i(e,t,n){ni.call(this,null==e?"canceled":e,ni.ERR_CANCELED,t,n),this.name="CanceledError"}function Bi(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new ni("Request failed with status code "+n.status,[ni.ERR_BAD_REQUEST,ni.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Mi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ti.reduceDescriptors(Mi.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ti.freezeMethods(Mi),ti.inherits(_i,ni,{__CANCEL__:!0});const Ni=(e,t,n=3)=>{let i=0;const r=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=i[s];r||(r=c),n[o]=a,i[o]=c;let d=s,l=0;for(;d!==o;)l+=n[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-r{r=o,n=null,i&&(clearTimeout(i),i=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-r;a>=o?s(e,t):(n=e,i||(i=setTimeout(()=>{i=null,s(n)},o-a)))},()=>n&&s(n)]}(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-i,c=r(a);i=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},Di=(e,t)=>{const n=null!=e;return[i=>t[0]({lengthComputable:n,total:e,loaded:i}),t[1]]},Fi=e=>(...t)=>ti.asap(()=>e(...t)),qi=Ii.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ii.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ii.origin),Ii.navigator&&/(msie|trident)/i.test(Ii.navigator.userAgent)):()=>!0,Ui=Ii.hasStandardBrowserEnv?{write(e,t,n,i,r,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ti.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),ti.isString(i)&&a.push(`path=${i}`),ti.isString(r)&&a.push(`domain=${r}`),!0===o&&a.push("secure"),ti.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function $i(e,t,n){let i=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(i||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Li=e=>e instanceof Mi?{...e}:e;function zi(e,t){t=t||{};const n={};function i(e,t,n,i){return ti.isPlainObject(e)&&ti.isPlainObject(t)?ti.merge.call({caseless:i},e,t):ti.isPlainObject(t)?ti.merge({},t):ti.isArray(t)?t.slice():t}function r(e,t,n,r){return ti.isUndefined(t)?ti.isUndefined(e)?void 0:i(void 0,e,0,r):i(e,t,0,r)}function o(e,t){if(!ti.isUndefined(t))return i(void 0,t)}function s(e,t){return ti.isUndefined(t)?ti.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(n,r,o){return o in t?i(n,r):o in e?i(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>r(Li(e),Li(t),0,!0)};return ti.forEach(Object.keys({...e,...t}),function(i){const o=c[i]||r,s=o(e[i],t[i],i);ti.isUndefined(s)&&o!==a||(n[i]=s)}),n}const Ki=e=>{const t=zi({},e);let{data:n,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=Mi.from(s),t.url=pi($i(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ti.isFormData(n))if(Ii.hasStandardBrowserEnv||Ii.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(ti.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(Ii.hasStandardBrowserEnv&&(i&&ti.isFunction(i)&&(i=i(t)),i||!1!==i&&qi(t.url))){const e=r&&o&&Ui.read(o);e&&s.set(r,e)}return t},Vi="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const i=Ki(e);let r=i.data;const o=Mi.from(i.headers).normalize();let s,a,c,u,d,{responseType:l,onUploadProgress:h,onDownloadProgress:f}=i;function p(){u&&u(),d&&d(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let v=new XMLHttpRequest;function g(){if(!v)return;const i=Mi.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());Bi(function(e){t(e),p()},function(e){n(e),p()},{data:l&&"text"!==l&&"json"!==l?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:i,config:e,request:v}),v=null}v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout,"onloadend"in v?v.onloadend=g:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(g)},v.onabort=function(){v&&(n(new ni("Request aborted",ni.ECONNABORTED,e,v)),v=null)},v.onerror=function(t){const i=new ni(t&&t.message?t.message:"Network Error",ni.ERR_NETWORK,e,v);i.event=t||null,n(i),v=null},v.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||gi;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new ni(t,r.clarifyTimeoutError?ni.ETIMEDOUT:ni.ECONNABORTED,e,v)),v=null},void 0===r&&o.setContentType(null),"setRequestHeader"in v&&ti.forEach(o.toJSON(),function(e,t){v.setRequestHeader(t,e)}),ti.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),l&&"json"!==l&&(v.responseType=i.responseType),f&&([c,d]=Ni(f,!0),v.addEventListener("progress",c)),h&&v.upload&&([a,u]=Ni(h),v.upload.addEventListener("progress",a),v.upload.addEventListener("loadend",u)),(i.cancelToken||i.signal)&&(s=t=>{v&&(n(!t||t.type?new _i(null,e,v):t),v.abort(),v=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(i.url);y&&-1===Ii.protocols.indexOf(y)?n(new ni("Unsupported protocol "+y+":",ni.ERR_BAD_REQUEST,e)):v.send(r||null)})},Hi=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,i=new AbortController;const r=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;i.abort(t instanceof ni?t:new _i(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,r(new ni(`timeout ${t} of ms exceeded`,ni.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(r):e.removeEventListener("abort",r)}),e=null)};e.forEach(e=>e.addEventListener("abort",r));const{signal:a}=i;return a.unsubscribe=()=>ti.asap(s),a}},Wi=function*(e,t){let n=e.byteLength;if(n{const r=async function*(e,t){for await(const n of Ji(e))yield*Wi(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,i&&i(e))};return new ReadableStream({async pull(e){try{const{done:t,value:i}=await r.next();if(t)return a(),void e.close();let o=i.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(i))}catch(t){throw a(t),t}},cancel:e=>(a(e),r.return())},{highWaterMark:2})},{isFunction:Xi}=ti,Qi=(({Request:e,Response:t})=>({Request:e,Response:t}))(ti.global),{ReadableStream:Zi,TextEncoder:Yi}=ti.global,er=(e,...t)=>{try{return!!e(...t)}catch(x){return!1}},tr=e=>{e=ti.merge.call({skipUndefined:!0},Qi,e);const{fetch:t,Request:n,Response:i}=e,r=t?Xi(t):"function"==typeof fetch,o=Xi(n),s=Xi(i);if(!r)return!1;const a=r&&Xi(Zi),c=r&&("function"==typeof Yi?(e=>t=>e.encode(t))(new Yi):async e=>new Uint8Array(await new n(e).arrayBuffer())),u=o&&a&&er(()=>{let e=!1;const t=new n(Ii.origin,{body:new Zi,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=s&&a&&er(()=>ti.isReadableStream(new i("").body)),l={stream:d&&(e=>e.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!l[e]&&(l[e]=(t,n)=>{let i=t&&t[e];if(i)return i.call(t);throw new ni(`Response type '${e}' is not supported`,ni.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const i=ti.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(ti.isBlob(e))return e.size;if(ti.isSpecCompliantForm(e)){const t=new n(Ii.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ti.isArrayBufferView(e)||ti.isArrayBuffer(e)?e.byteLength:(ti.isURLSearchParams(e)&&(e+=""),ti.isString(e)?(await c(e)).byteLength:void 0)})(t):i};return async e=>{let{url:r,method:s,data:a,signal:c,cancelToken:f,timeout:p,onDownloadProgress:v,onUploadProgress:g,responseType:y,headers:m,withCredentials:b="same-origin",fetchOptions:w}=Ki(e),S=t||fetch;y=y?(y+"").toLowerCase():"text";let A=Hi([c,f&&f.toAbortSignal()],p),I=null;const E=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let O;try{if(g&&u&&"get"!==s&&"head"!==s&&0!==(O=await h(m,a))){let e,t=new n(r,{method:"POST",body:a,duplex:"half"});if(ti.isFormData(a)&&(e=t.headers.get("content-type"))&&m.setContentType(e),t.body){const[e,n]=Di(O,Ni(Fi(g)));a=Gi(t.body,65536,e,n)}}ti.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in n.prototype,c={...w,signal:A,method:s.toUpperCase(),headers:m.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};I=o&&new n(r,c);let f=await(o?S(I,w):S(r,c));const p=d&&("stream"===y||"response"===y);if(d&&(v||p&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=f[t]});const t=ti.toFiniteNumber(f.headers.get("content-length")),[n,r]=v&&Di(t,Ni(Fi(v),!0))||[];f=new i(Gi(f.body,65536,n,()=>{r&&r(),E&&E()}),e)}y=y||"text";let C=await l[ti.findKey(l,y)||"text"](f,e);return!p&&E&&E(),await new Promise((t,n)=>{Bi(t,n,{data:C,headers:Mi.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:I})})}catch(C){if(E&&E(),C&&"TypeError"===C.name&&/Load failed|fetch/i.test(C.message))throw Object.assign(new ni("Network Error",ni.ERR_NETWORK,e,I),{cause:C.cause||C});throw ni.from(C,C&&C.code,e,I)}}},nr=new Map,ir=e=>{let t=e&&e.env||{};const{fetch:n,Request:i,Response:r}=t,o=[i,r,n];let s,a,c=o.length,u=nr;for(;c--;)s=o[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:tr(t)),u=a;return a};ir();const rr={http:null,xhr:Vi,fetch:{get:ir}};ti.forEach(rr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(x){}Object.defineProperty(e,"adapterName",{value:t})}});const or=e=>`- ${e}`,sr=e=>ti.isFunction(e)||null===e||!1===e;const ar={getAdapter:function(e,t){e=ti.isArray(e)?e:[e];const{length:n}=e;let i,r;const o={};for(let s=0;s`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ni("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(or).join("\n"):" "+or(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r},adapters:rr};function cr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _i(null,e)}function ur(e){cr(e),e.headers=Mi.from(e.headers),e.data=ki.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ar.getAdapter(e.adapter||Oi.adapter,e)(e).then(function(t){return cr(e),t.data=ki.call(e,e.transformResponse,t),t.headers=Mi.from(t.headers),t},function(t){return ji(t)||(cr(e),t&&t.response&&(t.response.data=ki.call(e,e.transformResponse,t.response),t.response.headers=Mi.from(t.response.headers))),Promise.reject(t)})}const dr="1.13.2",lr={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{lr[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const hr={};lr.transitional=function(e,t,n){function i(e,t){return"[Axios v"+dr+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,o)=>{if(!1===e)throw new ni(i(r," has been removed"+(t?" in "+t:"")),ni.ERR_DEPRECATED);return t&&!hr[r]&&(hr[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,o)}},lr.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const fr={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ni("options must be an object",ni.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const o=i[r],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new ni("option "+o+" must be "+n,ni.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ni("Unknown option "+o,ni.ERR_BAD_OPTION)}},validators:lr},pr=fr.validators;let vr=class{constructor(e){this.defaults=e||{},this.interceptors={request:new vi,response:new vi}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(x){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=zi(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:r}=t;void 0!==n&&fr.assertOptions(n,{silentJSONParsing:pr.transitional(pr.boolean),forcedJSONParsing:pr.transitional(pr.boolean),clarifyTimeoutError:pr.transitional(pr.boolean)},!1),null!=i&&(ti.isFunction(i)?t.paramsSerializer={serialize:i}:fr.assertOptions(i,{encode:pr.function,serialize:pr.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),fr.assertOptions(t,{baseUrl:pr.spelling("baseURL"),withXsrfToken:pr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=r&&ti.merge(r.common,r[t.method]);r&&ti.forEach(["delete","get","head","post","put","patch","common"],e=>{delete r[e]}),t.headers=Mi.concat(o,r);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,l=0;if(!a){const e=[ur.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,u=Promise.resolve(t);l{gr[t]=e});const yr=function e(t){const n=new vr(t),i=fn(vr.prototype.request,n);return ti.extend(i,vr.prototype,n,{allOwnKeys:!0}),ti.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(zi(t,n))},i}(Oi);yr.Axios=vr,yr.CanceledError=_i,yr.CancelToken=class e{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 n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const i=new Promise(e=>{n.subscribe(e),t=e}).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e(function(e,i,r){n.reason||(n.reason=new _i(e,i,r),t(n.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 t;return{token:new e(function(e){t=e}),cancel:t}}},yr.isCancel=ji,yr.VERSION=dr,yr.toFormData=ui,yr.AxiosError=ni,yr.Cancel=yr.CanceledError,yr.all=function(e){return Promise.all(e)},yr.spread=function(e){return function(t){return e.apply(null,t)}},yr.isAxiosError=function(e){return ti.isObject(e)&&!0===e.isAxiosError},yr.mergeConfig=zi,yr.AxiosHeaders=Mi,yr.formToJSON=e=>Ei(ti.isHTMLForm(e)?new FormData(e):e),yr.getAdapter=ar.getAdapter,yr.HttpStatusCode=gr,yr.default=yr;const{Axios:mr,AxiosError:br,CanceledError:wr,isCancel:Sr,CancelToken:Ar,VERSION:Ir,all:Er,Cancel:Or,isAxiosError:Cr,spread:Rr,toFormData:xr,AxiosHeaders:Tr,HttpStatusCode:Pr,formToJSON:Mr,getAdapter:kr,mergeConfig:jr}=yr;var _r=Object.getOwnPropertyDescriptor;let Br=class{constructor(){dn(this)}async get(e,t){const n=this.prepareAxiosRequestConfig(t),i=await yr.get(e,n);return{data:i.data,statusCode:i.status,headers:i.headers}}async post(e,t,n){const i=this.prepareAxiosRequestConfig(n),r=await yr.post(e,t,i);return{data:r.data,statusCode:r.status,headers:r.headers}}async put(e,t,n){const i=this.prepareAxiosRequestConfig(n),r=await yr.put(e,t,i);return{data:r.data,statusCode:r.status,headers:r.headers}}async patch(e,t,n){const i=this.prepareAxiosRequestConfig(n),r=await yr.patch(e,t,i);return{data:r.data,statusCode:r.status,headers:r.headers}}prepareAxiosRequestConfig(e){const t={};return e&&(e.firstInvalidStatusCode&&(t.validateStatus=t=>t{for(var r,o=i>1?void 0:i?_r(t,n):t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([an()],Br),sn.bindForce(hn).to(Br);const Nr=Symbol("HttpApiService"),Dr=Symbol("EnvironmentService");class Fr extends Error{constructor(e){super(`Environment variable is not provided: ${e}`)}}class qr extends Error{constructor(e,t,n){super(`Invalid type for environment variable: ${e}, expected: ${t}, got value: "${n}"`)}}class Ur extends Error{constructor(e,t){super(`\n\nUrl environment variable were provided with slash at the end:\n${e}=${t.slice(0,t.length-1)}/\n\nConsider removing slash for consistency\n`)}}const $r={string:(e,t)=>t,boolean:(e,t)=>{switch(t){case"true":return!0;case"false":return!1;default:throw new qr(e,"boolean",t)}},number:(e,t)=>{try{const n=parseFloat(t);if(isNaN(n))throw new qr(e,"number",t);return n}catch{throw new qr(e,"number",t)}}},Lr={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_API_DOMAIN_0:"api.x.rho.trading",VITE_BACKEND_API_NAME_0:"Production",VITE_BACKEND_API_REST_V1_URL_0:"https://api.x.rho.trading/api/v1",VITE_RHO_TARGET:"home-page"};var zr=Object.getOwnPropertyDescriptor;let Kr=class{_vars=null;get vars(){return this._vars||this.initializeVars(),this._vars}isDevelopment(){return"development"===this.vars.environment}isProduction(){return"production"===this.vars.environment}initializeVars(){this._vars={environment:this.getEnvironment(),backend:{apiCollections:this.parseBackendUrls()}}}parseBackendUrls(){const e=this.getEnvArray("VITE_BACKEND_API_NAME"),t=this.getEnvArray("VITE_BACKEND_API_DOMAIN"),n=this.getEnvArray("VITE_BACKEND_API_REST_V1_URL"),i=Math.min(e.length,t.length,n.length),r=[];for(let o=0;o{for(var r,o=i>1?void 0:i?zr(t,n):t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([an()],Kr),sn.bindForce(Dr).to(Kr);var Vr=Object.getOwnPropertyDescriptor,Hr=(e,t)=>(n,i)=>t(n,i,e);let Wr=class{constructor(e,t){this.environmentService=e,this.httpService=t,dn(this)}salt=null;async get(e,t){const n=this.getApiUrl(),i=await this.prepareHttpRequestConfig(t);return this.httpService.get(`${n}/${e}`,i)}async post(e,t,n){const i=this.getApiUrl(),r=await this.prepareHttpRequestConfig(n);return this.httpService.post(`${i}/${e}`,t,r)}async patch(e,t,n){const i=this.getApiUrl(),r=await this.prepareHttpRequestConfig(n);return this.httpService.post(`${i}/${e}`,t,r)}async put(e,t,n){const i=this.getApiUrl(),r=await this.prepareHttpRequestConfig(n);return this.httpService.post(`${i}/${e}`,t,r)}async prepareHttpRequestConfig(e){let t={};if(e){const{...n}=e;t=n}return t.headers={...t.headers},Promise.resolve(t)}getApiUrl(){const e=this.environmentService.vars.backend.apiCollections;if(0===e.length)throw new Error("No API collections configured");return e[0].rest.v1}};Wr=((e,t,n,i)=>{for(var r,o=i>1?void 0:i?Vr(t,n):t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([an(),Hr(0,cn(Dr)),Hr(1,cn(hn))],Wr),sn.bindForce(Nr).to(Wr);var Jr=Object.getOwnPropertyDescriptor,Gr=(e,t)=>(n,i)=>t(n,i,e);let Xr=class{constructor(e,t){this.httpService=e,this.httpApiService=t,dn(this)}async getAllTickers(){const{data:e}=await this.httpApiService.get("tickers");return e}async getWhitelistedSymbols(){const{data:e}=await this.httpService.get(window.rhoConfig?.whitelistUrl??"https://cdn.prod.website-files.com/66140477c9e704ff4f42b1d6/694448a1a7a5798d6db8c899_6a962419bbcf7801f6c791d8dc8e6977_whitelisted-symbols.txt");return e}};Xr=((e,t,n,i)=>{for(var r,o=i>1?void 0:i?Jr(t,n):t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([an(),Gr(0,cn(hn)),Gr(1,cn(Nr))],Xr),sn.bindForce(ln).to(Xr);var Qr=Object.getOwnPropertyDescriptor,Zr=(e,t)=>(n,i)=>t(n,i,e);let Yr=class{constructor(e,t){this.environmentService=e,this.tradingAssetRepository=t,dn(this)}MIN_TRADES_COUNT=500;async getAll(){return this.getTickers()}async getTickers(){const[{tickers:e},{symbols:t}]=await Promise.all([this.tradingAssetRepository.getAllTickers(),this.tradingAssetRepository.getWhitelistedSymbols()]),n=this.selectTradingAssets(e,t,new Date);return this.environmentService.isDevelopment()&&console.debug(`[rho] Selected ${n.length} markets`),n}selectTradingAssets(e,t,n){const i=this.buildWhitelistMap(t),r=new Map;for(const o of e){const e=this.parseTickerSymbol(o?.symbol);if(!e)continue;const t=i.get(e.market);if(!t)continue;if(!this.isValidTicker(o,e.expiry,n))continue;const s=this.mapToTradingAsset(o,t.symbol,e.expiry);r.set(s.id,{asset:s,whitelistIndex:t.whitelistIndex,expiryTimestamp:e.expiry.getTime()})}return Array.from(r.values()).sort(this.compareSelectedAssets).map(({asset:e})=>e)}buildWhitelistMap(e){const t=new Map;return e.forEach((e,n)=>{const i=e.market??`${e.exchangeCode.toUpperCase()}-${e.base}${e.counter}`;t.set(i,{symbol:e,whitelistIndex:n})}),t}parseTickerSymbol(e){if("string"!=typeof e)return null;const[t,n,i]=e.split(":");if(void 0===t||!n||void 0!==i)return null;const r=this.parseExpiry(n);return r?{market:t,expiry:r}:null}isValidTicker(e,t,n){if(t<=n)return!1;const i=Number(e.lastAccumulatedTradesCount);return!(!Number.isFinite(i)||i<=this.MIN_TRADES_COUNT)&&(!("string"!=typeof e.markPrice||!e.markPrice.trim())&&Number.isFinite(Number(e.markPrice)))}mapToTradingAsset(e,t,n){const i={...t,expiry:n,meta:{...t.meta}};return i.meta.name=this.interpolateTemplate(i.meta.name,i),{id:e.symbol,symbol:i,apy:this.calculateApy(e),tradingUrl:`https://x.rho.trading/${i.meta.type}/${encodeURIComponent(e.symbol)}`}}compareSelectedAssets(e,t){const n=e.whitelistIndex-t.whitelistIndex;if(0!==n)return n;const i=e.expiryTimestamp-t.expiryTimestamp;return 0!==i?i:e.asset.id.localeCompare(t.asset.id)}calculateApy(e){return Number((100*Number(e.markPrice)).toFixed(2))}interpolateTemplate(e,t){return e.replace(/\$\{([^}]+)\}/g,(e,n)=>{const i=this.getNestedValue(t,n);return"string"==typeof i||"number"==typeof i?String(i):e})}getNestedValue(e,t){let n=e;for(const i of t.split(".")){if("object"!=typeof n||null===n)return;n=n[i]}return n}parseExpiry(e){const t=/^(\d{2})([A-Z]{3})(\d{2})$/.exec(e);if(!t)return null;const n=Number(t[1]),i=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"].indexOf(t[2]),r=2e3+Number(t[3]);if(i<0)return null;const o=new Date(Date.UTC(r,i,n,8));return o.getUTCFullYear()===r&&o.getUTCMonth()===i&&o.getUTCDate()===n?o:null}};Yr=((e,t,n,i)=>{for(var r,o=i>1?void 0:i?Qr(t,n):t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([an(),Zr(0,cn(Dr)),Zr(1,cn(ln))],Yr),sn.bindForce(un).to(Yr);const eo=Symbol("AssetsMarqueeService");const to="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%3e%3ccircle%20cx='20'%20cy='20'%20r='19.5'%20fill='%2320242c'%20stroke='%233b414b'%20/%3e%3c!--%20Box%20glyph:%20Lucide,%20ISC%20license.%20--%3e%3csvg%20x='9.2'%20y='9.2'%20width='21.6'%20height='21.6'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23adb2bd'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20%3e%3cpath%20d='M21%208a2%202%200%200%200-1-1.73l-7-4a2%202%200%200%200-2%200l-7%204A2%202%200%200%200%203%208v8a2%202%200%200%200%201%201.73l7%204a2%202%200%200%200%202%200l7-4A2%202%200%200%200%2021%2016Z'%20/%3e%3cpath%20d='m3.3%207%208.7%205%208.7-5'%20/%3e%3cpath%20d='M12%2022V12'%20/%3e%3c/svg%3e%3c/svg%3e";var no=Object.getOwnPropertyDescriptor;const io=["name","apy","expiry","base-icon","exchange-icon"],ro=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});let oo=class{constructor(e){this.tradingAssetService=e,dn(this)}assetsPollingIntervalInMs=3e4;defaultScrollingSpeedInPixelsPerSecond=80;assetsMarqueeElement=null;assetsMarqueeTrack=null;assetCardTemplate=null;assetCardSequences=[];tradingAssetsById=new Map;assetIdsInDisplayOrder=[];assetCardGeometryById=new Map;pollingInterval=null;isPolling=!1;lifecycleVersion=0;resizeObserver=null;animationFrameId=0;previousAnimationTime=null;isPaused=!1;scrollOffsetInPixels=0;sequenceWidthInPixels=0;init(){this.assetsMarqueeElement||this.initElements()&&(this.initEventListeners(),this.initResizeObserver(),this.animationFrameId=requestAnimationFrame(this.animate),this.enablePolling())}enablePolling(){null===this.pollingInterval&&this.assetsMarqueeElement&&(this.assetsPollingTick(),this.pollingInterval=setInterval(this.assetsPollingTick,this.assetsPollingIntervalInMs))}disablePolling(){this.pollingInterval&&clearInterval(this.pollingInterval),this.pollingInterval=null}destroy(){this.lifecycleVersion+=1,this.disablePolling(),cancelAnimationFrame(this.animationFrameId),this.resizeObserver?.disconnect(),this.assetsMarqueeElement?.removeEventListener("pointerenter",this.pause),this.assetsMarqueeElement?.removeEventListener("pointerleave",this.resume),this.assetsMarqueeElement?.removeEventListener("load",this.remeasureKeepingVisibleCard,!0),this.assetsMarqueeElement?.removeEventListener("error",this.handleImageError,!0),document.removeEventListener("visibilitychange",this.resetAnimationClock),window.removeEventListener("resize",this.remeasureKeepingVisibleCard),this.assetsMarqueeTrack&&this.assetCardTemplate&&(this.assetsMarqueeTrack.querySelectorAll("[data-asset-id]").forEach(this.cancelCardAnimations),this.assetsMarqueeTrack.replaceChildren(this.assetCardTemplate.cloneNode(!0)),this.assetsMarqueeTrack.style.transform=""),this.assetsMarqueeElement=null,this.assetsMarqueeTrack=null,this.assetCardSequences=[],this.assetIdsInDisplayOrder=[],this.tradingAssetsById.clear(),this.assetCardGeometryById.clear(),this.isPolling=!1,this.isPaused=!1,this.scrollOffsetInPixels=0,this.sequenceWidthInPixels=0,this.previousAnimationTime=null}initElements(){const e=document.querySelector("[data-rho-marquee]");if(!e)return!1;const t=e.querySelector("[data-rho-marquee-track]"),n=t?.querySelector("[data-rho-asset-card]");if(!t||!n||!this.hasRequiredCardComponents(n))return console.error("[rho] Marquee template is missing required data hooks"),!1;this.assetsMarqueeElement=e,this.assetsMarqueeTrack=t,this.assetCardTemplate=n.cloneNode(!0);const i=this.createAssetCardSequence(!0);return i.append(n),this.assetCardSequences=[i],t.replaceChildren(i),t.style.animation="none",t.style.display="flex",t.style.width="max-content",!0}hasRequiredCardComponents(e){return io.every(t=>e.querySelector(`[data-rho-asset-field="${t}"]`))}initEventListeners(){const e=this.assetsMarqueeElement;e.addEventListener("pointerenter",this.pause),e.addEventListener("pointerleave",this.resume),e.addEventListener("load",this.remeasureKeepingVisibleCard,!0),e.addEventListener("error",this.handleImageError,!0),document.addEventListener("visibilitychange",this.resetAnimationClock),window.addEventListener("resize",this.remeasureKeepingVisibleCard)}initResizeObserver(){"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.remeasureKeepingVisibleCard),this.resizeObserver.observe(this.assetsMarqueeElement),this.resizeObserver.observe(this.assetCardSequences[0]))}async assetsPollingTick(){if(this.isPolling||!this.assetsMarqueeElement)return;this.isPolling=!0;const e=this.lifecycleVersion;try{const t=await this.tradingAssetService.getAll();this.assetsMarqueeElement&&e===this.lifecycleVersion&&this.renderAssets(t)}catch{}finally{e===this.lifecycleVersion&&(this.isPolling=!1)}}createAssetCardSequence(e=!1){const t=document.createElement("div");return t.className="rho-assets-sequence",Object.assign(t.style,{display:"flex",flexShrink:"0",gap:"inherit"}),e?t.setAttribute("data-rho-marquee-primary",""):t.setAttribute("aria-hidden","true"),t}renderAssets(e){if(!this.assetsMarqueeTrack||!this.assetsMarqueeElement)return;const t=new Map(e.map(e=>[e.id,e])),n=Array.from(this.assetsMarqueeTrack.querySelectorAll("[data-asset-id]")),i=this.findVisibleRetainedCard(n,t),r=new Map(n.map(e=>[e,e.getBoundingClientRect().left]));if(n.forEach(this.cancelCardAnimations),this.tradingAssetsById=t,this.assetIdsInDisplayOrder=function(e,t){const n=Array.from(new Set(t)),i=Array.from(new Set(e)),r=new Set(n),o=new Set(i),s=n.filter(e=>!o.has(e)),a=[];let c=0;for(const u of i){if(r.has(u)){a.push(u);continue}const e=s[c];c+=1,void 0!==e&&a.push(e)}return a.concat(s.slice(c))}(this.assetIdsInDisplayOrder,Array.from(t.keys())),this.assetCardSequences.forEach(this.renderAssetCardSequence),this.measureMarquee(),i?.isConnected){const e=r.get(i),t=i.getBoundingClientRect().left;this.scrollOffsetInPixels+=t-e,this.applyScrollPosition()}this.animateCardUpdates(r),this.assetsMarqueeTrack.dataset.rhoCount=String(this.assetIdsInDisplayOrder.length)}findVisibleRetainedCard(e,t){const n=this.assetsMarqueeElement.getBoundingClientRect();return e.find(e=>{const i=e.getBoundingClientRect(),r=t.has(e.dataset.assetId),o=i.right>n.left&&i.left{const t=e;return[t.dataset.assetId,t]}));this.assetIdsInDisplayOrder.forEach((n,i)=>{const r=t.get(n)??this.assetCardTemplate.cloneNode(!0);r.dataset.assetId=n,this.populateAssetCard(r,this.tradingAssetsById.get(n)),e.hasAttribute("aria-hidden")&&(r.setAttribute("tabindex","-1"),r.querySelectorAll("a, button, [tabindex]").forEach(e=>e.setAttribute("tabindex","-1"))),e.children[i]!==r&&e.insertBefore(r,e.children[i]??null)}),Array.from(e.children).forEach(e=>{const t=e;this.tradingAssetsById.has(t.dataset.assetId)||t.remove()})}animateCardUpdates(e){this.assetCardSequences.forEach(t=>{Array.from(t.children).forEach(t=>{const n=t,i=e.get(n),r=void 0===i?0:i-n.getBoundingClientRect().left;n.animate&&!this.isMotionReduced()&&(void 0===i?n.animate([{opacity:0},{opacity:1}],{duration:240}):Math.abs(r)>1&&n.animate([{transform:`translateX(${r}px)`},{transform:"translateX(0)"}],{duration:300,easing:"ease-out"}))})})}populateAssetCard(e,t){e.removeAttribute("id"),e.querySelectorAll("[id]").forEach(e=>e.removeAttribute("id")),e.classList.remove("skeleton"),e.querySelectorAll(".skeleton").forEach(e=>e.classList.remove("skeleton")),e.classList.toggle("is-highlighted",t.symbol.meta.highlighted),e.dataset.rhoExchange=t.symbol.exchangeCode.toLowerCase(),e.setAttribute("href",t.tradingUrl),e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer");const n=this.getCardComponents(e);n.name.textContent=t.symbol.meta.name,n.apy.textContent=`${t.apy}%`,n.expirationDate.textContent=t.symbol.expiry?`expires ${ro.format(t.symbol.expiry)}`:"",this.setCardImage(n.images.base,t.symbol.meta.images.base),this.setCardImage(n.images.exchange,t.symbol.meta.images.exchange),n.images.base.setAttribute("alt",""),n.images.exchange.setAttribute("alt","")}getCardComponents(e){const t=t=>e.querySelector(`[data-rho-asset-field="${t}"]`);return{name:t("name"),apy:t("apy"),expirationDate:t("expiry"),images:{base:t("base-icon"),exchange:t("exchange-icon")}}}setCardImage(e,t){const n=t?.trim()||to;e.dataset.rhoImageSource!==n&&(e.dataset.rhoImageSource=n,e.setAttribute("src",n))}handleImageError(e){const t=e.target;t instanceof HTMLImageElement&&t.matches('[data-rho-asset-field="base-icon"], [data-rho-asset-field="exchange-icon"]')&&t.getAttribute("src")!==to&&(t.src=to)}remeasureKeepingVisibleCard(){const e=Array.from(this.assetCardGeometryById),t=e.find(([,e])=>e.left+e.width>this.scrollOffsetInPixels)??e[0];let n=0;if(t){const e=t[1],i=e.left+e.width<=this.scrollOffsetInPixels;n=e.left-this.scrollOffsetInPixels,i&&(n+=this.sequenceWidthInPixels)}this.measureMarquee();const i=t&&this.assetCardGeometryById.get(t[0]);i&&(this.scrollOffsetInPixels=i.left-n,this.applyScrollPosition())}measureMarquee(){if(!this.assetsMarqueeElement||!this.assetsMarqueeTrack||!this.assetIdsInDisplayOrder.length)return this.sequenceWidthInPixels=0,void this.assetCardGeometryById.clear();const e=parseFloat(getComputedStyle(this.assetsMarqueeTrack).columnGap)||0,t=this.assetCardSequences[0],n=t.getBoundingClientRect().width+e;if(!(n>0))return;this.sequenceWidthInPixels=n;const i=this.assetsMarqueeElement.getBoundingClientRect().width,r=Math.max(2,Math.ceil(i/n)+1);for(;this.assetCardSequences.lengthr;)this.assetCardSequences.pop().remove();const o=t.firstElementChild.offsetLeft;this.assetCardGeometryById=new Map(Array.from(t.children).map(e=>{const t=e;return[t.dataset.assetId,{left:t.offsetLeft-o,width:t.getBoundingClientRect().width}]})),this.applyScrollPosition()}isMotionReduced(){return!!this.assetsMarqueeElement&&"1"===getComputedStyle(this.assetsMarqueeElement).getPropertyValue("--rho-marquee-reduced-motion").trim()}animate(e){if(!this.assetsMarqueeElement)return;const t=Number(this.assetsMarqueeElement.dataset.rhoMarqueeSpeed);if(null!==this.previousAnimationTime&&!this.isPaused&&!document.hidden&&!this.isMotionReduced()&&this.sequenceWidthInPixels>0){const n=Number.isFinite(t)&&t>0?t:this.defaultScrollingSpeedInPixelsPerSecond,i=Math.min((e-this.previousAnimationTime)/1e3,.1);this.scrollOffsetInPixels+=i*n,this.applyScrollPosition()}this.previousAnimationTime=e,this.animationFrameId=requestAnimationFrame(this.animate)}applyScrollPosition(){if(!this.assetsMarqueeTrack||!this.sequenceWidthInPixels)return;const e=this.sequenceWidthInPixels;this.scrollOffsetInPixels=(this.scrollOffsetInPixels%e+e)%e,this.assetsMarqueeTrack.style.transform=`translate3d(${-this.scrollOffsetInPixels}px, 0, 0)`}cancelCardAnimations(e){e.getAnimations?.().forEach(e=>e.cancel())}pause(){this.isPaused=!0,this.resetAnimationClock()}resume(){this.isPaused=!1,this.resetAnimationClock()}resetAnimationClock(){this.previousAnimationTime=null}};var so,ao;oo=((e,t,n,i)=>{for(var r,o=i>1?void 0:i?no(t,n):t,s=e.length-1;s>=0;s--)(r=e[s])&&(o=r(o)||o);return o})([an(),(so=0,ao=cn(un),(e,t)=>ao(e,t,so))],oo),sn.bindForce(eo).to(oo),window.rhoServices={tradingAssetService:sn.get(un),assetsMarqueeService:sn.get(eo)}});