Socket
Socket
Sign inDemoInstall

mana-syringe

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mana-syringe - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

14

dist/container.d.ts

@@ -1,12 +0,15 @@

import { Container as InversifyContainer } from 'inversify';
import type { interfaces } from 'inversify';
import type { InversifyContext } from './inversify/inversify-protocol';
import type { Syringe } from './core';
import type { Disposable, Syringe } from './core';
export declare class Container implements Syringe.Container, InversifyContext {
static setContainer(key: interfaces.Container, value: Syringe.Container): Map<number, Syringe.Container>;
static getContainer(key: interfaces.Container): Syringe.Container;
static config(option: Syringe.InjectOption<void>): void;
protected loadedModules: number[];
container: InversifyContainer;
container: interfaces.Container;
protected inversify: boolean;
parent?: Container;
constructor(inversifyContainer?: InversifyContainer);
load(module: Syringe.Module, force?: boolean): void;
constructor(inversifyContainer?: interfaces.Container);
load(module: Syringe.Module, force?: boolean): Disposable;
unload(module: Syringe.Module): void;
remove<T>(token: Syringe.Token<T>): void;

@@ -22,5 +25,4 @@ get<T>(token: Syringe.Token<T>): T;

register<T = any>(token: Syringe.Token<T>, options: Syringe.InjectOption<T>): void;
protected resolveContext(): Syringe.Context;
}
export declare const GlobalContainer: Container;
export declare const register: Syringe.Register;

@@ -10,2 +10,8 @@ import 'reflect-metadata';

};
export declare type Disposable = {
/**
* Dispose this object.
*/
dispose: () => void;
};
export declare namespace Syringe {

@@ -37,6 +43,5 @@ /**

};
type Registry = (register: Register, ctx: Context) => void;
type Registry = (register: Register) => void;
type Module = {
id: number;
registry: Registry;
};

@@ -48,3 +53,4 @@ function isModule(data: Record<any, any> | undefined): data is Module;

register: <T = any>(token: Syringe.Token<T> | Syringe.InjectOption<T>, options?: Syringe.InjectOption<T>) => void;
load: (module: Module, force?: boolean) => void;
load: (module: Module, force?: boolean) => Disposable;
unload: (module: Module) => void;
get: <T>(token: Syringe.Token<T>) => T;

@@ -98,3 +104,3 @@ getNamed: <T>(token: Syringe.Token<T>, named: Syringe.Named) => T;

export declare namespace Utils {
function maybeArrayToArray<T>(maybeArray: Syringe.MaybeArray<T> | undefined): T[];
function toArray<T>(maybeArray: Syringe.MaybeArray<T> | undefined): T[];
function isClass(data?: string | symbol | Record<string, any>): data is Syringe.Class<any>;

@@ -101,0 +107,0 @@ function isDefinedToken(data: Record<string, any> | undefined | symbol | string | number): data is Syringe.DefinedToken;

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).manaSyringe={})}(this,(function(t){"use strict";function n(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,i)}return e}function e(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(n){u(t,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(i,n))}))}return t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t,n){for(var e=0;n.length>e;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,n,e){return n&&o(t.prototype,n),e&&o(t,e),t}function u(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function s(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,n){if(!t)return;if("string"==typeof t)return c(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return c(t,n)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);n>e;e++)i[e]=t[e];return i}var f="named",h="name",l="unmanaged",p="optional",d="inject",y="multi_inject",g="inversify:tagged",v="inversify:tagged_props",b="inversify:paramtypes",m="post_construct";var w=[d,y,h,l,f,p],_="Request",T="Singleton",k="Transient",A="ConstantValue",S="Constructor",I="DynamicValue",C="Factory",j="Function",x="Instance",M="Invalid",E="Provider",O="ClassProperty",R="ConstructorArgument",N="Variable",P=0;function D(){return P++}var W=function(){function t(t,n){this.id=D(),this.activated=!1,this.serviceIdentifier=t,this.scope=n,this.type=M,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var n=new t(this.serviceIdentifier,this.scope);return n.activated=n.scope===T&&this.activated,n.implementationType=this.implementationType,n.dynamicValue=this.dynamicValue,n.scope=this.scope,n.type=this.type,n.factory=this.factory,n.provider=this.provider,n.constraint=this.constraint,n.onActivation=this.onActivation,n.cache=this.cache,n},t}(),q="NULL argument",F="Key Not Found",V="Ambiguous match found for serviceIdentifier:",B="No matching bindings found for serviceIdentifier:",U=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(b,t),userGeneratedMetadata:Reflect.getMetadata(g,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(v,t)||[]},t}(),L=0,K=1;function z(t){return t instanceof RangeError||"Maximum call stack size exceeded"===t.message}function G(t){return"function"==typeof t?t.name:"symbol"==typeof t?""+t:t}function H(t,n,e){var i="",r=e(t,n);return 0!==r.length&&(i="\nRegistered bindings:",r.forEach((function(t){var n="Object";null!==t.implementationType&&(n=J(t.implementationType)),i=i+"\n "+n,t.constraint.metaData&&(i=i+" - "+t.constraint.metaData)}))),i}function Y(t,n){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===n||Y(t.parentRequest,n))}function $(t){t.childRequests.forEach((function(t){if(Y(t,t.serviceIdentifier)){var n=function(t){return function t(n,e){void 0===e&&(e=[]);var i=G(n.serviceIdentifier);return e.push(i),null!==n.parentRequest?t(n.parentRequest,e):e}(t).reverse().join(" --\x3e ")}(t);throw Error("Circular dependency found: "+n)}$(t)}))}function J(t){if(t.name)return t.name;var n=""+t,e=n.match(/^function\s*([^\s(]+)/);return e?e[1]:"Anonymous function: "+n}var Q=function(){function t(t){this.id=D(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),X=function(){function t(t,n){this.key=t,this.value=n}return t.prototype.toString=function(){return this.key===f?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}(),Z=function(t,n){this.parentContext=t,this.rootRequest=n};function tt(t,n,e,i){et("inversify:tagged",t,n,i,e)}function nt(t,n,e){et("inversify:tagged_props",t.constructor,n,e)}function et(t,n,e,i,r){var o={},a="number"==typeof r,u=void 0!==r&&a?""+r:e;if(a&&void 0!==e)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,n)&&(o=Reflect.getMetadata(t,n));var s=o[u];if(Array.isArray(s))for(var c=0,f=s;f.length>c;c++){var h=f[c];if(h.key===i.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else s=[];s.push(i),o[u]=s,Reflect.defineMetadata(t,o,n)}function it(t,n){Reflect.decorate(t,n)}function rt(t,n){return function(e,i){n(e,i,t)}}var ot=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();var at=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var n,e=t.split("").reverse().join("");return n=this.str.split("").reverse().join(""),this.startsWith.call({str:n},e)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),ut=function(){function t(t,n,e,i){this.id=D(),this.type=t,this.serviceIdentifier=e,this.name=new at(n||""),this.metadata=[];var r=null;"string"==typeof i?r=new X(f,i):i instanceof X&&(r=i),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var n=0,e=this.metadata;e.length>n;n++){if(e[n].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(y)},t.prototype.matchesArray=function(t){return this.matchesTag(y)(t)},t.prototype.isNamed=function(){return this.hasTag(f)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return w.every((function(n){return t.key!==n}))}))},t.prototype.isOptional=function(){return this.matchesTag(p)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===f}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return w.every((function(n){return t.key!==n}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(f)(t)},t.prototype.matchesTag=function(t){var n=this;return function(e){for(var i=0,r=n.metadata;r.length>i;i++){var o=r[i];if(o.key===t&&o.value===e)return!0}return!1}},t}(),st=function(t,n){for(var e=0,i=n.length,r=t.length;i>e;e++,r++)t[r]=n[e];return t};function ct(t,n,e,i){var r=t.getConstructorMetadata(e),o=r.compilerGeneratedMetadata;if(void 0===o)throw Error("Missing required @injectable annotation in: "+n+".");var a=r.userGeneratedMetadata,u=Object.keys(a),s=function(t,n,e,i,r){for(var o=[],a=0;r>a;a++){var u=ft(a,t,n,e,i);null!==u&&o.push(u)}return o}(i,n,o,a,0===e.length&&u.length>0||u.length>e.length?u.length:e.length),c=ht(t,e);return st(st([],s),c)}function ft(t,n,e,i,r){var o=r[""+t]||[],a=pt(o),u=!0!==a.unmanaged,s=i[t],c=a.inject||a.multiInject;if((s=c||s)instanceof ot&&(s=s.unwrap()),u){if(!n&&(s===Object||s===Function||void 0===s))throw Error("Missing required @inject or @multiInject annotation in: argument "+t+" in class "+e+".");var f=new ut(R,a.targetName,s);return f.metadata=o,f}return null}function ht(t,n){for(var e=t.getPropertiesMetadata(n),i=[],r=0,o=Object.keys(e);o.length>r;r++){var a=o[r],u=e[a],s=pt(e[a]),c=new ut(O,s.targetName||a,s.inject||s.multiInject);c.metadata=u,i.push(c)}var f=Object.getPrototypeOf(n.prototype).constructor;if(f!==Object){var h=ht(t,f);i=st(st([],i),h)}return i}function lt(t,n){var e=Object.getPrototypeOf(n.prototype).constructor;if(e!==Object){var i=ct(t,J(e),e,!0),r=i.map((function(t){return t.metadata.filter((function(t){return t.key===l}))})),o=[].concat.apply([],r).length,a=i.length-o;return a>0?a:lt(t,e)}return 0}function pt(t){var n={};return t.forEach((function(t){n[""+t.key]=t.value})),{inject:n.inject,multiInject:n.multi_inject,targetName:n.name,unmanaged:n.unmanaged}}var dt=function(){function t(t,n,e,i,r){this.id=D(),this.serviceIdentifier=t,this.parentContext=n,this.parentRequest=e,this.target=r,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===e?new Map:null}return t.prototype.addChildRequest=function(n,e,i){var r=new t(n,this.parentContext,this,e,i);return this.childRequests.push(r),r},t}();function yt(t){return t._bindingDictionary}function gt(t,n,e,i,r){var o=bt(e.container,r.serviceIdentifier),a=[];return o.length===L&&e.container.options.autoBindInjectable&&"function"==typeof r.serviceIdentifier&&t.getConstructorMetadata(r.serviceIdentifier).compilerGeneratedMetadata&&(e.container.bind(r.serviceIdentifier).toSelf(),o=bt(e.container,r.serviceIdentifier)),a=n?o:o.filter((function(t){var n=new dt(t.serviceIdentifier,e,i,t,r);return t.constraint(n)})),function(t,n,e,i){switch(n.length){case L:if(e.isOptional())return n;var r=G(t),o=B;throw o+=function(t,n){if(n.isTagged()||n.isNamed()){var e="",i=n.getNamedTag(),r=n.getCustomTags();return null!==i&&(e+=i+"\n"),null!==r&&r.forEach((function(t){e+=t+"\n"}))," "+t+"\n "+t+" - "+e}return" "+t}(r,e),o+=H(i,r,bt),Error(o);case K:if(!e.isArray())return n;default:if(e.isArray())return n;r=G(t),o=V+" "+r;throw o+=H(i,r,bt),Error(o)}}(r.serviceIdentifier,a,r,e.container),a}function vt(t,n,e,i,r,o){var a,u;if(null===r){a=gt(t,n,i,null,o),u=new dt(e,i,null,a,o);var s=new Z(i,u);i.addPlan(s)}else a=gt(t,n,i,r,o),u=r.addChildRequest(o.serviceIdentifier,a,o);a.forEach((function(n){var e=null;if(o.isArray())e=u.addChildRequest(n.serviceIdentifier,n,o);else{if(n.cache)return;e=u}if(n.type===x&&null!==n.implementationType){var r=function(t,n){return ct(t,J(n),n,!1)}(t,n.implementationType);if(!i.container.options.skipBaseClassChecks)if(lt(t,n.implementationType)>r.length){var a=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."}(J(n.implementationType));throw Error(a)}r.forEach((function(n){vt(t,!1,n.serviceIdentifier,i,e,n)}))}}))}function bt(t,n){var e=[],i=yt(t);return i.hasKey(n)?e=i.get(n):null!==t.parent&&(e=bt(t.parent,n)),e}function mt(t,n,e,i,r,o,a,u){void 0===u&&(u=!1);var s=new Q(n),c=function(t,n,e,i,r,o){var a=new X(t?y:d,e),u=new ut(n,i,e,a);if(void 0!==r){var s=new X(r,o);u.metadata.push(s)}return u}(e,i,r,"",o,a);try{return vt(t,u,r,s,null,c),s}catch(t){throw z(t)&&s.plan&&$(s.plan.rootRequest),t}}var wt=function(t,n){for(var e=0,i=n.length,r=t.length;i>e;e++,r++)t[r]=n[e];return t};function _t(t,n,e){var i,r=null;if(n.length>0){var o=n.filter((function(t){return null!==t.target&&t.target.type===R})).map(e);r=function(t,n,e){var i=n.filter((function(t){return null!==t.target&&t.target.type===O})),r=i.map(e);return i.forEach((function(n,e){var i;i=n.target.name.value(),t[i]=r[e]})),t}(r=new((i=t).bind.apply(i,wt([void 0],o))),n,e)}else r=new t;return function(t,n){if(Reflect.hasMetadata(m,t)){var e=Reflect.getMetadata(m,t);try{n[e.value]()}catch(n){throw Error(function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return"@postConstruct error in class "+t[0]+": "+t[1]}(t.name,n.message))}}}(t,r),r}var Tt=function(t,n,e){try{return e()}catch(e){throw z(e)?Error(function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."}(t,""+n)):e}},kt=function(t){return function(n){n.parentContext.setCurrentRequest(n);var e=n.bindings,i=n.childRequests,r=n.target&&n.target.isArray(),o=!(n.parentRequest&&n.parentRequest.target&&n.target&&n.parentRequest.target.matchesArray(n.target.serviceIdentifier));if(r&&o)return i.map((function(n){return kt(t)(n)}));var a=null;if(!n.target.isOptional()||0!==e.length){var u=e[0],s=u.scope===T,c=u.scope===_;if(s&&u.activated)return u.cache;if(c&&null!==t&&t.has(u.id))return t.get(u.id);if(u.type===A)a=u.cache,u.activated=!0;else if(u.type===j)a=u.cache,u.activated=!0;else if(u.type===S)a=u.implementationType;else if(u.type===I&&null!==u.dynamicValue)a=Tt("toDynamicValue",u.serviceIdentifier,(function(){return u.dynamicValue(n.parentContext)}));else if(u.type===C&&null!==u.factory)a=Tt("toFactory",u.serviceIdentifier,(function(){return u.factory(n.parentContext)}));else if(u.type===E&&null!==u.provider)a=Tt("toProvider",u.serviceIdentifier,(function(){return u.provider(n.parentContext)}));else{if(u.type!==x||null===u.implementationType){var f=G(n.serviceIdentifier);throw Error("Invalid binding type: "+f)}a=_t(u.implementationType,i,kt(t))}return"function"==typeof u.onActivation&&(a=u.onActivation(n.parentContext,a)),s&&(u.cache=a,u.activated=!0),c&&null!==t&&!t.has(u.id)&&t.set(u.id,a),a}}};var At=function(t,n){var e=t.parentRequest;return null!==e&&(!!n(e)||At(e,n))},St=function(t){return function(n){var e=function(e){return null!==e&&null!==e.target&&e.target.matchesTag(t)(n)};return e.metaData=new X(t,n),e}},It=St(f),Ct=function(t){return function(n){return null!==n&&("string"==typeof t?n.bindings[0].serviceIdentifier===t:t===n.bindings[0].implementationType)}},jt=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new xt(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=It(t),new xt(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new xt(this._binding)},t.prototype.whenTargetTagged=function(t,n){return this._binding.constraint=St(t)(n),new xt(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(n){return Ct(t)(n.parentRequest)},new xt(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(n){return It(t)(n.parentRequest)},new xt(this._binding)},t.prototype.whenParentTagged=function(t,n){return this._binding.constraint=function(e){return St(t)(n)(e.parentRequest)},new xt(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(n){return At(n,Ct(t))},new xt(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(n){return!At(n,Ct(t))},new xt(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(n){return At(n,It(t))},new xt(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(n){return!At(n,It(t))},new xt(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,n){return this._binding.constraint=function(e){return At(e,St(t)(n))},new xt(this._binding)},t.prototype.whenNoAncestorTagged=function(t,n){return this._binding.constraint=function(e){return!At(e,St(t)(n))},new xt(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(n){return At(n,t)},new xt(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(n){return!At(n,t)},new xt(this._binding)},t}(),xt=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new jt(this._binding)},t}(),Mt=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new jt(this._binding),this._bindingOnSyntax=new xt(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,n){return this._bindingWhenSyntax.whenTargetTagged(t,n)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,n){return this._bindingWhenSyntax.whenParentTagged(t,n)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,n)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenNoAncestorTagged(t,n)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}(),Et=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=_,new Mt(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=T,new Mt(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=k,new Mt(this._binding)},t}(),Ot=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new jt(this._binding),this._bindingOnSyntax=new xt(this._binding),this._bindingInSyntax=new Et(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,n){return this._bindingWhenSyntax.whenTargetTagged(t,n)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,n){return this._bindingWhenSyntax.whenParentTagged(t,n)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,n)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenNoAncestorTagged(t,n)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}(),Rt=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=x,this._binding.implementationType=t,new Ot(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw Error("The toSelf function can only be applied when a constructor is used as service identifier");return this.to(this._binding.serviceIdentifier)},t.prototype.toConstantValue=function(t){return this._binding.type=A,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=T,new Mt(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=I,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Ot(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=S,this._binding.implementationType=t,this._binding.scope=T,new Mt(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=C,this._binding.factory=t,this._binding.scope=T,new Mt(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw Error("Value provided to function binding must be a function!");var n=this.toConstantValue(t);return this._binding.type=j,this._binding.scope=T,n},t.prototype.toAutoFactory=function(t){return this._binding.type=C,this._binding.factory=function(n){return function(){return n.container.get(t)}},this._binding.scope=T,new Mt(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=E,this._binding.provider=t,this._binding.scope=T,new Mt(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(n){return n.container.get(t)}))},t}(),Nt=function(){function t(){}return t.of=function(n,e){var i=new t;return i.bindings=n,i.middleware=e,i},t}(),Pt=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,n){if(null==t)throw Error(q);if(null==n)throw Error(q);var e=this._map.get(t);void 0!==e?(e.push(n),this._map.set(t,e)):this._map.set(t,[n])},t.prototype.get=function(t){if(null==t)throw Error(q);var n=this._map.get(t);if(void 0!==n)return n;throw Error(F)},t.prototype.remove=function(t){if(null==t)throw Error(q);if(!this._map.delete(t))throw Error(F)},t.prototype.removeByCondition=function(t){var n=this;this._map.forEach((function(e,i){var r=e.filter((function(n){return!t(n)}));r.length>0?n._map.set(i,r):n._map.delete(i)}))},t.prototype.hasKey=function(t){if(null==t)throw Error(q);return this._map.has(t)},t.prototype.clone=function(){var n=new t;return this._map.forEach((function(t,e){t.forEach((function(t){return n.add(e,t.clone())}))})),n},t.prototype.traverse=function(t){this._map.forEach((function(n,e){t(e,n)}))},t}(),Dt=function(t,n,e,i){return new(e||(e=Promise))((function(r,o){function a(t){try{s(i.next(t))}catch(t){o(t)}}function u(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(a,u)}s((i=i.apply(t,n||[])).next())}))},Wt=function(t,n){var e,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){a.label=o[1];break}if(6===o[0]&&r[1]>a.label){a.label=r[1],r=o;break}if(r&&r[2]>a.label){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=n.call(t,a)}catch(t){o=[6,t],i=0}finally{e=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},qt=function(t,n){for(var e=0,i=n.length,r=t.length;i>e;e++,r++)t[r]=n[e];return t},Ft=function(){function t(t){this._appliedMiddleware=[];var n=t||{};if("object"!=typeof n)throw Error("Invalid Container constructor argument. Container options must be an object.");if(void 0===n.defaultScope)n.defaultScope=k;else if(n.defaultScope!==T&&n.defaultScope!==k&&n.defaultScope!==_)throw Error("Invalid Container option. Default scope must be a string ('singleton' or 'transient').");if(void 0===n.autoBindInjectable)n.autoBindInjectable=!1;else if("boolean"!=typeof n.autoBindInjectable)throw Error("Invalid Container option. Auto bind injectable must be a boolean");if(void 0===n.skipBaseClassChecks)n.skipBaseClassChecks=!1;else if("boolean"!=typeof n.skipBaseClassChecks)throw Error("Invalid Container option. Skip base check must be a boolean");this.options={autoBindInjectable:n.autoBindInjectable,defaultScope:n.defaultScope,skipBaseClassChecks:n.skipBaseClassChecks},this.id=D(),this._bindingDictionary=new Pt,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new U}return t.merge=function(n,e){for(var i=[],r=2;arguments.length>r;r++)i[r-2]=arguments[r];var o=new t,a=qt([n,e],i).map((function(t){return yt(t)})),u=yt(o);function s(t,n){t.traverse((function(t,e){e.forEach((function(t){n.add(t.serviceIdentifier,t.clone())}))}))}return a.forEach((function(t){s(t,u)})),o},t.prototype.load=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];for(var e=this._getContainerModuleHelpersFactory(),i=0,r=t;r.length>i;i++){var o=r[i],a=e(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return Dt(this,void 0,void 0,(function(){var n,e,i,r,o;return Wt(this,(function(a){switch(a.label){case 0:n=this._getContainerModuleHelpersFactory(),e=0,i=t,a.label=1;case 1:return i.length>e?(o=n((r=i[e]).id),[4,r.registry(o.bindFunction,o.unbindFunction,o.isboundFunction,o.rebindFunction)]):[3,4];case 2:a.sent(),a.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,n=[],e=0;arguments.length>e;e++)n[e]=arguments[e];var i=function(t){return function(n){return n.moduleId===t}};n.forEach((function(n){var e=i(n.id);t._bindingDictionary.removeByCondition(e)}))},t.prototype.bind=function(t){var n=new W(t,this.options.defaultScope||k);return this._bindingDictionary.add(t,n),new Rt(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(n){throw Error("Could not unbind serviceIdentifier: "+G(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new Pt},t.prototype.isBound=function(t){var n=this._bindingDictionary.hasKey(t);return!n&&this.parent&&(n=this.parent.isBound(t)),n},t.prototype.isBoundNamed=function(t,n){return this.isBoundTagged(t,f,n)},t.prototype.isBoundTagged=function(t,n,e){var i=!1;if(this._bindingDictionary.hasKey(t)){var r=this._bindingDictionary.get(t),o=function(t,n,e,i){var r=new ut(N,"",n,new X(e,i)),o=new Q(t);return new dt(n,o,null,[],r)}(this,t,n,e);i=r.some((function(t){return t.constraint(o)}))}return!i&&this.parent&&(i=this.parent.isBoundTagged(t,n,e)),i},t.prototype.snapshot=function(){this._snapshots.push(Nt.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw Error("No snapshot available to restore.");this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(n){var e=new t(n||this.options);return e.parent=this,e},t.prototype.applyMiddleware=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];this._appliedMiddleware=this._appliedMiddleware.concat(t);var e=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,n){return n(t)}),e)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,N,t)},t.prototype.getTagged=function(t,n,e){return this._get(!1,!1,N,t,n,e)},t.prototype.getNamed=function(t,n){return this.getTagged(t,f,n)},t.prototype.getAll=function(t){return this._get(!0,!0,N,t)},t.prototype.getAllTagged=function(t,n,e){return this._get(!1,!0,N,t,n,e)},t.prototype.getAllNamed=function(t,n){return this.getAllTagged(t,f,n)},t.prototype.resolve=function(t){var n=this.createChild();return n.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){n.applyMiddleware(t)})),n.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,n=function(t,n){t._binding.moduleId=n},e=function(e){return function(i){var r=t.rebind.bind(t)(i);return n(r,e),r}};return function(i){return{bindFunction:(r=i,function(e){var i=t.bind.bind(t)(e);return n(i,r),i}),isboundFunction:function(n){return t.isBound.bind(t)(n)},rebindFunction:e(i),unbindFunction:function(n){t.unbind.bind(t)(n)}};var r}},t.prototype._get=function(t,n,e,i,r,o){var a=null,u={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:n,key:r,serviceIdentifier:i,targetType:e,value:o};if(this._middleware){if(null==(a=this._middleware(u)))throw Error("Invalid return type in middleware. Middleware must return!")}else a=this._planAndResolve()(u);return a},t.prototype._planAndResolve=function(){var t=this;return function(n){var e=mt(t._metadataReader,t,n.isMultiInject,n.targetType,n.serviceIdentifier,n.key,n.value,n.avoidConstraints);return function(t){return kt(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(e=n.contextInterceptor(e))}},t}();function Vt(){return function(t){if(Reflect.hasOwnMetadata(b,t))throw Error("Cannot apply @injectable decorator multiple times.");var n=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(b,n,t),t}}var Bt,Ut,Lt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).manaSyringe={})}(this,(function(t){"use strict";function n(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,i)}return e}function e(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(n){u(t,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(i,n))}))}return t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t,n){for(var e=0;n.length>e;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,n,e){return n&&o(t.prototype,n),e&&o(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function s(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,n){if(!t)return;if("string"==typeof t)return c(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return c(t,n)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,i=Array(n);n>e;e++)i[e]=t[e];return i}var f="named",h="name",l="unmanaged",p="optional",d="inject",y="multi_inject",g="inversify:tagged",v="inversify:tagged_props",b="inversify:paramtypes",m="post_construct";var w=[d,y,h,l,f,p],_="Request",T="Singleton",k="Transient",A="ConstantValue",S="Constructor",C="DynamicValue",I="Factory",M="Function",j="Instance",E="Invalid",O="Provider",x="ClassProperty",R="ConstructorArgument",N="Variable",P=0;function D(){return P++}var W=function(){function t(t,n){this.id=D(),this.activated=!1,this.serviceIdentifier=t,this.scope=n,this.type=E,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var n=new t(this.serviceIdentifier,this.scope);return n.activated=n.scope===T&&this.activated,n.implementationType=this.implementationType,n.dynamicValue=this.dynamicValue,n.scope=this.scope,n.type=this.type,n.factory=this.factory,n.provider=this.provider,n.constraint=this.constraint,n.onActivation=this.onActivation,n.cache=this.cache,n},t}(),q="NULL argument",F="Key Not Found",V="Ambiguous match found for serviceIdentifier:",B="No matching bindings found for serviceIdentifier:",U=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(b,t),userGeneratedMetadata:Reflect.getMetadata(g,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(v,t)||[]},t}(),L=0,K=1;function z(t){return t instanceof RangeError||"Maximum call stack size exceeded"===t.message}function G(t){return"function"==typeof t?t.name:"symbol"==typeof t?""+t:t}function H(t,n,e){var i="",r=e(t,n);return 0!==r.length&&(i="\nRegistered bindings:",r.forEach((function(t){var n="Object";null!==t.implementationType&&(n=J(t.implementationType)),i=i+"\n "+n,t.constraint.metaData&&(i=i+" - "+t.constraint.metaData)}))),i}function Y(t,n){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===n||Y(t.parentRequest,n))}function $(t){t.childRequests.forEach((function(t){if(Y(t,t.serviceIdentifier)){var n=function(t){return function t(n,e){void 0===e&&(e=[]);var i=G(n.serviceIdentifier);return e.push(i),null!==n.parentRequest?t(n.parentRequest,e):e}(t).reverse().join(" --\x3e ")}(t);throw Error("Circular dependency found: "+n)}$(t)}))}function J(t){if(t.name)return t.name;var n=""+t,e=n.match(/^function\s*([^\s(]+)/);return e?e[1]:"Anonymous function: "+n}var Q=function(){function t(t){this.id=D(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),X=function(){function t(t,n){this.key=t,this.value=n}return t.prototype.toString=function(){return this.key===f?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}(),Z=function(t,n){this.parentContext=t,this.rootRequest=n};function tt(t,n,e,i){et("inversify:tagged",t,n,i,e)}function nt(t,n,e){et("inversify:tagged_props",t.constructor,n,e)}function et(t,n,e,i,r){var o={},a="number"==typeof r,u=void 0!==r&&a?""+r:e;if(a&&void 0!==e)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,n)&&(o=Reflect.getMetadata(t,n));var s=o[u];if(Array.isArray(s))for(var c=0,f=s;f.length>c;c++){var h=f[c];if(h.key===i.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else s=[];s.push(i),o[u]=s,Reflect.defineMetadata(t,o,n)}function it(t,n){Reflect.decorate(t,n)}function rt(t,n){return function(e,i){n(e,i,t)}}var ot=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();var at=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var n,e=t.split("").reverse().join("");return n=this.str.split("").reverse().join(""),this.startsWith.call({str:n},e)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),ut=function(){function t(t,n,e,i){this.id=D(),this.type=t,this.serviceIdentifier=e,this.name=new at(n||""),this.metadata=[];var r=null;"string"==typeof i?r=new X(f,i):i instanceof X&&(r=i),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var n=0,e=this.metadata;e.length>n;n++){if(e[n].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(y)},t.prototype.matchesArray=function(t){return this.matchesTag(y)(t)},t.prototype.isNamed=function(){return this.hasTag(f)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return w.every((function(n){return t.key!==n}))}))},t.prototype.isOptional=function(){return this.matchesTag(p)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===f}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return w.every((function(n){return t.key!==n}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(f)(t)},t.prototype.matchesTag=function(t){var n=this;return function(e){for(var i=0,r=n.metadata;r.length>i;i++){var o=r[i];if(o.key===t&&o.value===e)return!0}return!1}},t}(),st=function(t,n){for(var e=0,i=n.length,r=t.length;i>e;e++,r++)t[r]=n[e];return t};function ct(t,n,e,i){var r=t.getConstructorMetadata(e),o=r.compilerGeneratedMetadata;if(void 0===o)throw Error("Missing required @injectable annotation in: "+n+".");var a=r.userGeneratedMetadata,u=Object.keys(a),s=function(t,n,e,i,r){for(var o=[],a=0;r>a;a++){var u=ft(a,t,n,e,i);null!==u&&o.push(u)}return o}(i,n,o,a,0===e.length&&u.length>0||u.length>e.length?u.length:e.length),c=ht(t,e);return st(st([],s),c)}function ft(t,n,e,i,r){var o=r[""+t]||[],a=pt(o),u=!0!==a.unmanaged,s=i[t],c=a.inject||a.multiInject;if((s=c||s)instanceof ot&&(s=s.unwrap()),u){if(!n&&(s===Object||s===Function||void 0===s))throw Error("Missing required @inject or @multiInject annotation in: argument "+t+" in class "+e+".");var f=new ut(R,a.targetName,s);return f.metadata=o,f}return null}function ht(t,n){for(var e=t.getPropertiesMetadata(n),i=[],r=0,o=Object.keys(e);o.length>r;r++){var a=o[r],u=e[a],s=pt(e[a]),c=new ut(x,s.targetName||a,s.inject||s.multiInject);c.metadata=u,i.push(c)}var f=Object.getPrototypeOf(n.prototype).constructor;if(f!==Object){var h=ht(t,f);i=st(st([],i),h)}return i}function lt(t,n){var e=Object.getPrototypeOf(n.prototype).constructor;if(e!==Object){var i=ct(t,J(e),e,!0),r=i.map((function(t){return t.metadata.filter((function(t){return t.key===l}))})),o=[].concat.apply([],r).length,a=i.length-o;return a>0?a:lt(t,e)}return 0}function pt(t){var n={};return t.forEach((function(t){n[""+t.key]=t.value})),{inject:n.inject,multiInject:n.multi_inject,targetName:n.name,unmanaged:n.unmanaged}}var dt=function(){function t(t,n,e,i,r){this.id=D(),this.serviceIdentifier=t,this.parentContext=n,this.parentRequest=e,this.target=r,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===e?new Map:null}return t.prototype.addChildRequest=function(n,e,i){var r=new t(n,this.parentContext,this,e,i);return this.childRequests.push(r),r},t}();function yt(t){return t._bindingDictionary}function gt(t,n,e,i,r){var o=bt(e.container,r.serviceIdentifier),a=[];return o.length===L&&e.container.options.autoBindInjectable&&"function"==typeof r.serviceIdentifier&&t.getConstructorMetadata(r.serviceIdentifier).compilerGeneratedMetadata&&(e.container.bind(r.serviceIdentifier).toSelf(),o=bt(e.container,r.serviceIdentifier)),a=n?o:o.filter((function(t){var n=new dt(t.serviceIdentifier,e,i,t,r);return t.constraint(n)})),function(t,n,e,i){switch(n.length){case L:if(e.isOptional())return n;var r=G(t),o=B;throw o+=function(t,n){if(n.isTagged()||n.isNamed()){var e="",i=n.getNamedTag(),r=n.getCustomTags();return null!==i&&(e+=i+"\n"),null!==r&&r.forEach((function(t){e+=t+"\n"}))," "+t+"\n "+t+" - "+e}return" "+t}(r,e),o+=H(i,r,bt),Error(o);case K:if(!e.isArray())return n;default:if(e.isArray())return n;r=G(t),o=V+" "+r;throw o+=H(i,r,bt),Error(o)}}(r.serviceIdentifier,a,r,e.container),a}function vt(t,n,e,i,r,o){var a,u;if(null===r){a=gt(t,n,i,null,o),u=new dt(e,i,null,a,o);var s=new Z(i,u);i.addPlan(s)}else a=gt(t,n,i,r,o),u=r.addChildRequest(o.serviceIdentifier,a,o);a.forEach((function(n){var e=null;if(o.isArray())e=u.addChildRequest(n.serviceIdentifier,n,o);else{if(n.cache)return;e=u}if(n.type===j&&null!==n.implementationType){var r=function(t,n){return ct(t,J(n),n,!1)}(t,n.implementationType);if(!i.container.options.skipBaseClassChecks)if(lt(t,n.implementationType)>r.length){var a=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."}(J(n.implementationType));throw Error(a)}r.forEach((function(n){vt(t,!1,n.serviceIdentifier,i,e,n)}))}}))}function bt(t,n){var e=[],i=yt(t);return i.hasKey(n)?e=i.get(n):null!==t.parent&&(e=bt(t.parent,n)),e}function mt(t,n,e,i,r,o,a,u){void 0===u&&(u=!1);var s=new Q(n),c=function(t,n,e,i,r,o){var a=new X(t?y:d,e),u=new ut(n,i,e,a);if(void 0!==r){var s=new X(r,o);u.metadata.push(s)}return u}(e,i,r,"",o,a);try{return vt(t,u,r,s,null,c),s}catch(t){throw z(t)&&s.plan&&$(s.plan.rootRequest),t}}var wt=function(t,n){for(var e=0,i=n.length,r=t.length;i>e;e++,r++)t[r]=n[e];return t};function _t(t,n,e){var i,r=null;if(n.length>0){var o=n.filter((function(t){return null!==t.target&&t.target.type===R})).map(e);r=function(t,n,e){var i=n.filter((function(t){return null!==t.target&&t.target.type===x})),r=i.map(e);return i.forEach((function(n,e){var i;i=n.target.name.value(),t[i]=r[e]})),t}(r=new((i=t).bind.apply(i,wt([void 0],o))),n,e)}else r=new t;return function(t,n){if(Reflect.hasMetadata(m,t)){var e=Reflect.getMetadata(m,t);try{n[e.value]()}catch(n){throw Error(function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return"@postConstruct error in class "+t[0]+": "+t[1]}(t.name,n.message))}}}(t,r),r}var Tt=function(t,n,e){try{return e()}catch(e){throw z(e)?Error(function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."}(t,""+n)):e}},kt=function(t){return function(n){n.parentContext.setCurrentRequest(n);var e=n.bindings,i=n.childRequests,r=n.target&&n.target.isArray(),o=!(n.parentRequest&&n.parentRequest.target&&n.target&&n.parentRequest.target.matchesArray(n.target.serviceIdentifier));if(r&&o)return i.map((function(n){return kt(t)(n)}));var a=null;if(!n.target.isOptional()||0!==e.length){var u=e[0],s=u.scope===T,c=u.scope===_;if(s&&u.activated)return u.cache;if(c&&null!==t&&t.has(u.id))return t.get(u.id);if(u.type===A)a=u.cache,u.activated=!0;else if(u.type===M)a=u.cache,u.activated=!0;else if(u.type===S)a=u.implementationType;else if(u.type===C&&null!==u.dynamicValue)a=Tt("toDynamicValue",u.serviceIdentifier,(function(){return u.dynamicValue(n.parentContext)}));else if(u.type===I&&null!==u.factory)a=Tt("toFactory",u.serviceIdentifier,(function(){return u.factory(n.parentContext)}));else if(u.type===O&&null!==u.provider)a=Tt("toProvider",u.serviceIdentifier,(function(){return u.provider(n.parentContext)}));else{if(u.type!==j||null===u.implementationType){var f=G(n.serviceIdentifier);throw Error("Invalid binding type: "+f)}a=_t(u.implementationType,i,kt(t))}return"function"==typeof u.onActivation&&(a=u.onActivation(n.parentContext,a)),s&&(u.cache=a,u.activated=!0),c&&null!==t&&!t.has(u.id)&&t.set(u.id,a),a}}};var At=function(t,n){var e=t.parentRequest;return null!==e&&(!!n(e)||At(e,n))},St=function(t){return function(n){var e=function(e){return null!==e&&null!==e.target&&e.target.matchesTag(t)(n)};return e.metaData=new X(t,n),e}},Ct=St(f),It=function(t){return function(n){return null!==n&&("string"==typeof t?n.bindings[0].serviceIdentifier===t:t===n.bindings[0].implementationType)}},Mt=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new jt(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=Ct(t),new jt(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new jt(this._binding)},t.prototype.whenTargetTagged=function(t,n){return this._binding.constraint=St(t)(n),new jt(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(n){return It(t)(n.parentRequest)},new jt(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(n){return Ct(t)(n.parentRequest)},new jt(this._binding)},t.prototype.whenParentTagged=function(t,n){return this._binding.constraint=function(e){return St(t)(n)(e.parentRequest)},new jt(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(n){return At(n,It(t))},new jt(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(n){return!At(n,It(t))},new jt(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(n){return At(n,Ct(t))},new jt(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(n){return!At(n,Ct(t))},new jt(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,n){return this._binding.constraint=function(e){return At(e,St(t)(n))},new jt(this._binding)},t.prototype.whenNoAncestorTagged=function(t,n){return this._binding.constraint=function(e){return!At(e,St(t)(n))},new jt(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(n){return At(n,t)},new jt(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(n){return!At(n,t)},new jt(this._binding)},t}(),jt=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new Mt(this._binding)},t}(),Et=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Mt(this._binding),this._bindingOnSyntax=new jt(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,n){return this._bindingWhenSyntax.whenTargetTagged(t,n)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,n){return this._bindingWhenSyntax.whenParentTagged(t,n)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,n)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenNoAncestorTagged(t,n)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}(),Ot=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=_,new Et(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=T,new Et(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=k,new Et(this._binding)},t}(),xt=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Mt(this._binding),this._bindingOnSyntax=new jt(this._binding),this._bindingInSyntax=new Ot(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,n){return this._bindingWhenSyntax.whenTargetTagged(t,n)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,n){return this._bindingWhenSyntax.whenParentTagged(t,n)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,n)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,n){return this._bindingWhenSyntax.whenNoAncestorTagged(t,n)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}(),Rt=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=j,this._binding.implementationType=t,new xt(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw Error("The toSelf function can only be applied when a constructor is used as service identifier");return this.to(this._binding.serviceIdentifier)},t.prototype.toConstantValue=function(t){return this._binding.type=A,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=T,new Et(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=C,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new xt(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=S,this._binding.implementationType=t,this._binding.scope=T,new Et(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=I,this._binding.factory=t,this._binding.scope=T,new Et(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw Error("Value provided to function binding must be a function!");var n=this.toConstantValue(t);return this._binding.type=M,this._binding.scope=T,n},t.prototype.toAutoFactory=function(t){return this._binding.type=I,this._binding.factory=function(n){return function(){return n.container.get(t)}},this._binding.scope=T,new Et(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=O,this._binding.provider=t,this._binding.scope=T,new Et(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(n){return n.container.get(t)}))},t}(),Nt=function(){function t(){}return t.of=function(n,e){var i=new t;return i.bindings=n,i.middleware=e,i},t}(),Pt=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,n){if(null==t)throw Error(q);if(null==n)throw Error(q);var e=this._map.get(t);void 0!==e?(e.push(n),this._map.set(t,e)):this._map.set(t,[n])},t.prototype.get=function(t){if(null==t)throw Error(q);var n=this._map.get(t);if(void 0!==n)return n;throw Error(F)},t.prototype.remove=function(t){if(null==t)throw Error(q);if(!this._map.delete(t))throw Error(F)},t.prototype.removeByCondition=function(t){var n=this;this._map.forEach((function(e,i){var r=e.filter((function(n){return!t(n)}));r.length>0?n._map.set(i,r):n._map.delete(i)}))},t.prototype.hasKey=function(t){if(null==t)throw Error(q);return this._map.has(t)},t.prototype.clone=function(){var n=new t;return this._map.forEach((function(t,e){t.forEach((function(t){return n.add(e,t.clone())}))})),n},t.prototype.traverse=function(t){this._map.forEach((function(n,e){t(e,n)}))},t}(),Dt=function(t,n,e,i){return new(e||(e=Promise))((function(r,o){function a(t){try{s(i.next(t))}catch(t){o(t)}}function u(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(a,u)}s((i=i.apply(t,n||[])).next())}))},Wt=function(t,n){var e,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){a.label=o[1];break}if(6===o[0]&&r[1]>a.label){a.label=r[1],r=o;break}if(r&&r[2]>a.label){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=n.call(t,a)}catch(t){o=[6,t],i=0}finally{e=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},qt=function(t,n){for(var e=0,i=n.length,r=t.length;i>e;e++,r++)t[r]=n[e];return t},Ft=function(){function t(t){this._appliedMiddleware=[];var n=t||{};if("object"!=typeof n)throw Error("Invalid Container constructor argument. Container options must be an object.");if(void 0===n.defaultScope)n.defaultScope=k;else if(n.defaultScope!==T&&n.defaultScope!==k&&n.defaultScope!==_)throw Error("Invalid Container option. Default scope must be a string ('singleton' or 'transient').");if(void 0===n.autoBindInjectable)n.autoBindInjectable=!1;else if("boolean"!=typeof n.autoBindInjectable)throw Error("Invalid Container option. Auto bind injectable must be a boolean");if(void 0===n.skipBaseClassChecks)n.skipBaseClassChecks=!1;else if("boolean"!=typeof n.skipBaseClassChecks)throw Error("Invalid Container option. Skip base check must be a boolean");this.options={autoBindInjectable:n.autoBindInjectable,defaultScope:n.defaultScope,skipBaseClassChecks:n.skipBaseClassChecks},this.id=D(),this._bindingDictionary=new Pt,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new U}return t.merge=function(n,e){for(var i=[],r=2;arguments.length>r;r++)i[r-2]=arguments[r];var o=new t,a=qt([n,e],i).map((function(t){return yt(t)})),u=yt(o);function s(t,n){t.traverse((function(t,e){e.forEach((function(t){n.add(t.serviceIdentifier,t.clone())}))}))}return a.forEach((function(t){s(t,u)})),o},t.prototype.load=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];for(var e=this._getContainerModuleHelpersFactory(),i=0,r=t;r.length>i;i++){var o=r[i],a=e(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return Dt(this,void 0,void 0,(function(){var n,e,i,r,o;return Wt(this,(function(a){switch(a.label){case 0:n=this._getContainerModuleHelpersFactory(),e=0,i=t,a.label=1;case 1:return i.length>e?(o=n((r=i[e]).id),[4,r.registry(o.bindFunction,o.unbindFunction,o.isboundFunction,o.rebindFunction)]):[3,4];case 2:a.sent(),a.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,n=[],e=0;arguments.length>e;e++)n[e]=arguments[e];var i=function(t){return function(n){return n.moduleId===t}};n.forEach((function(n){var e=i(n.id);t._bindingDictionary.removeByCondition(e)}))},t.prototype.bind=function(t){var n=new W(t,this.options.defaultScope||k);return this._bindingDictionary.add(t,n),new Rt(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(n){throw Error("Could not unbind serviceIdentifier: "+G(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new Pt},t.prototype.isBound=function(t){var n=this._bindingDictionary.hasKey(t);return!n&&this.parent&&(n=this.parent.isBound(t)),n},t.prototype.isBoundNamed=function(t,n){return this.isBoundTagged(t,f,n)},t.prototype.isBoundTagged=function(t,n,e){var i=!1;if(this._bindingDictionary.hasKey(t)){var r=this._bindingDictionary.get(t),o=function(t,n,e,i){var r=new ut(N,"",n,new X(e,i)),o=new Q(t);return new dt(n,o,null,[],r)}(this,t,n,e);i=r.some((function(t){return t.constraint(o)}))}return!i&&this.parent&&(i=this.parent.isBoundTagged(t,n,e)),i},t.prototype.snapshot=function(){this._snapshots.push(Nt.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw Error("No snapshot available to restore.");this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(n){var e=new t(n||this.options);return e.parent=this,e},t.prototype.applyMiddleware=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];this._appliedMiddleware=this._appliedMiddleware.concat(t);var e=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,n){return n(t)}),e)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,N,t)},t.prototype.getTagged=function(t,n,e){return this._get(!1,!1,N,t,n,e)},t.prototype.getNamed=function(t,n){return this.getTagged(t,f,n)},t.prototype.getAll=function(t){return this._get(!0,!0,N,t)},t.prototype.getAllTagged=function(t,n,e){return this._get(!1,!0,N,t,n,e)},t.prototype.getAllNamed=function(t,n){return this.getAllTagged(t,f,n)},t.prototype.resolve=function(t){var n=this.createChild();return n.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){n.applyMiddleware(t)})),n.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,n=function(t,n){t._binding.moduleId=n},e=function(e){return function(i){var r=t.rebind.bind(t)(i);return n(r,e),r}};return function(i){return{bindFunction:(r=i,function(e){var i=t.bind.bind(t)(e);return n(i,r),i}),isboundFunction:function(n){return t.isBound.bind(t)(n)},rebindFunction:e(i),unbindFunction:function(n){t.unbind.bind(t)(n)}};var r}},t.prototype._get=function(t,n,e,i,r,o){var a=null,u={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:n,key:r,serviceIdentifier:i,targetType:e,value:o};if(this._middleware){if(null==(a=this._middleware(u)))throw Error("Invalid return type in middleware. Middleware must return!")}else a=this._planAndResolve()(u);return a},t.prototype._planAndResolve=function(){var t=this;return function(n){var e=mt(t._metadataReader,t,n.isMultiInject,n.targetType,n.serviceIdentifier,n.key,n.value,n.avoidConstraints);return function(t){return kt(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(e=n.contextInterceptor(e))}},t}(),Vt=function(t){this.id=D(),this.registry=t};function Bt(){return function(t){if(Reflect.hasOwnMetadata(b,t))throw Error("Cannot apply @injectable decorator multiple times.");var n=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(b,n,t),t}}var Ut,Lt,Kt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
/*! *****************************************************************************

@@ -15,3 +15,3 @@ Copyright (C) Microsoft. All rights reserved.

and limitations under the License.
***************************************************************************** */function Kt(n,e){return e.lifecycle===t.Syringe.Lifecycle.singleton?function(t){return t.inSingletonScope()}(n):function(t){return t.inTransientScope()}(n)}function zt(t,n){t.whenTargetNamed(Yt(n))}function Gt(t,n){return n.container.bind($t(t))}function Ht(t,n){var e=n.container.parent,i=e&&e.isBound($t(t));return n.container.isBound($t(t))&&!i?n.container.rebind($t(t)):n.container.bind($t(t))}function Yt(n){return t.Utils.isDefinedToken(n)?n.symbol:n}function $t(n){return t.Utils.isDefinedToken(n)?n.symbol:n}!function(t){!function(n){var e="object"==typeof Lt?Lt:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=r(t);function r(t,n){return function(e,i){"function"!=typeof t[e]&&Object.defineProperty(t,e,{configurable:!0,writable:!0,value:i}),n&&n(e,i)}}void 0===e.Reflect?e.Reflect=t:i=r(e.Reflect,i),function(t){var n=Object.prototype.hasOwnProperty,e="function"==typeof Symbol,i=e&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",r=e&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,a={__proto__:[]}instanceof Array,u=!o&&!a,s={create:o?function(){return it(Object.create(null))}:a?function(){return it({__proto__:null})}:function(){return it({})},has:u?function(t,e){return n.call(t,e)}:function(t,n){return n in t},get:u?function(t,e){return n.call(t,e)?t[e]:void 0}:function(t,n){return t[n]}},c=Object.getPrototypeOf(Function),f="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,h=f||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,l=f||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?nt():Set,p=new(f||"function"!=typeof WeakMap?et():WeakMap);function d(t,n,e,i){if(P(e)){if(!K(t))throw new TypeError;if(!G(n))throw new TypeError;return A(t,n)}if(!K(t))throw new TypeError;if(!q(n))throw new TypeError;if(!q(i)&&!P(i)&&!D(i))throw new TypeError;return D(i)&&(i=void 0),S(t,n,e=L(e),i)}function y(t,n){function e(e,i){if(!q(e))throw new TypeError;if(!P(i)&&!H(i))throw new TypeError;E(t,n,e,i)}return e}function g(t,n,e,i){if(!q(e))throw new TypeError;return P(i)||(i=L(i)),E(t,n,e,i)}function v(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),C(t,n,e)}function b(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),j(t,n,e)}function m(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),x(t,n,e)}function w(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),M(t,n,e)}function _(t,n){if(!q(t))throw new TypeError;return P(n)||(n=L(n)),O(t,n)}function T(t,n){if(!q(t))throw new TypeError;return P(n)||(n=L(n)),R(t,n)}function k(t,n,e){if(!q(n))throw new TypeError;P(e)||(e=L(e));var i=I(n,e,!1);if(P(i))return!1;if(!i.delete(t))return!1;if(i.size>0)return!0;var r=p.get(n);return r.delete(e),r.size>0||p.delete(n),!0}function A(t,n){for(var e=t.length-1;e>=0;--e){var i=(0,t[e])(n);if(!P(i)&&!D(i)){if(!G(i))throw new TypeError;n=i}}return n}function S(t,n,e,i){for(var r=t.length-1;r>=0;--r){var o=(0,t[r])(n,e,i);if(!P(o)&&!D(o)){if(!q(o))throw new TypeError;i=o}}return i}function I(t,n,e){var i=p.get(t);if(P(i)){if(!e)return;i=new h,p.set(t,i)}var r=i.get(n);if(P(r)){if(!e)return;r=new h,i.set(n,r)}return r}function C(t,n,e){if(j(t,n,e))return!0;var i=Z(n);return!D(i)&&C(t,i,e)}function j(t,n,e){var i=I(n,e,!1);return!P(i)&&B(i.has(t))}function x(t,n,e){if(j(t,n,e))return M(t,n,e);var i=Z(n);return D(i)?void 0:x(t,i,e)}function M(t,n,e){var i=I(n,e,!1);if(!P(i))return i.get(t)}function E(t,n,e,i){I(e,i,!0).set(t,n)}function O(t,n){var e=R(t,n),i=Z(t);if(null===i)return e;var r=O(i,n);if(0>=r.length)return e;if(0>=e.length)return r;for(var o=new l,a=[],u=0,s=e;s.length>u;u++){o.has(h=s[u])||(o.add(h),a.push(h))}for(var c=0,f=r;f.length>c;c++){var h;o.has(h=f[c])||(o.add(h),a.push(h))}return a}function R(t,n){var e=[],i=I(t,n,!1);if(P(i))return e;for(var r=$(i.keys()),o=0;;){var a=Q(r);if(!a)return e.length=o,e;var u=J(a);try{e[o]=u}catch(t){try{X(r)}finally{throw t}}o++}}function N(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function P(t){return void 0===t}function D(t){return null===t}function W(t){return"symbol"==typeof t}function q(t){return"object"==typeof t?null!==t:"function"==typeof t}function F(t,n){switch(N(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var e=3===n?"string":5===n?"number":"default",r=Y(t,i);if(void 0!==r){var o=r.call(t,e);if(q(o))throw new TypeError;return o}return V(t,"default"===e?"number":e)}function V(t,n){if("string"===n){var e=t.toString;if(z(e))if(!q(r=e.call(t)))return r;if(z(i=t.valueOf))if(!q(r=i.call(t)))return r}else{var i;if(z(i=t.valueOf))if(!q(r=i.call(t)))return r;var r,o=t.toString;if(z(o))if(!q(r=o.call(t)))return r}throw new TypeError}function B(t){return!!t}function U(t){return""+t}function L(t){var n=F(t,3);return W(n)?n:U(n)}function K(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function G(t){return"function"==typeof t}function H(t){switch(N(t)){case 3:case 4:return!0;default:return!1}}function Y(t,n){var e=t[n];if(null!=e){if(!z(e))throw new TypeError;return e}}function $(t){var n=Y(t,r);if(!z(n))throw new TypeError;var e=n.call(t);if(!q(e))throw new TypeError;return e}function J(t){return t.value}function Q(t){var n=t.next();return!n.done&&n}function X(t){var n=t.return;n&&n.call(t)}function Z(t){var n=Object.getPrototypeOf(t);if("function"!=typeof t||t===c)return n;if(n!==c)return n;var e=t.prototype,i=e&&Object.getPrototypeOf(e);if(null==i||i===Object.prototype)return n;var r=i.constructor;return"function"!=typeof r||r===t?n:r}function tt(){var t={},n=[],e=function(){function t(t,n,e){this._index=0,this._keys=t,this._values=n,this._selector=e}return t.prototype["@@iterator"]=function(){return this},t.prototype[r]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&this._keys.length>t){var e=this._selector(this._keys[t],this._values[t]);return this._keys.length>t+1?this._index++:(this._index=-1,this._keys=n,this._values=n),{value:e,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw 0>this._index||(this._index=-1,this._keys=n,this._values=n),t},t.prototype.return=function(t){return 0>this._index||(this._index=-1,this._keys=n,this._values=n),{value:t,done:!0}},t}();return function(){function n(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(n.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),n.prototype.has=function(t){return this._find(t,!1)>=0},n.prototype.get=function(t){var n=this._find(t,!1);return 0>n?void 0:this._values[n]},n.prototype.set=function(t,n){var e=this._find(t,!0);return this._values[e]=n,this},n.prototype.delete=function(n){var e=this._find(n,!1);if(e>=0){for(var i=this._keys.length,r=e+1;i>r;r++)this._keys[r-1]=this._keys[r],this._values[r-1]=this._values[r];return this._keys.length--,this._values.length--,n===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},n.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},n.prototype.keys=function(){return new e(this._keys,this._values,i)},n.prototype.values=function(){return new e(this._keys,this._values,o)},n.prototype.entries=function(){return new e(this._keys,this._values,a)},n.prototype["@@iterator"]=function(){return this.entries()},n.prototype[r]=function(){return this.entries()},n.prototype._find=function(t,n){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),0>this._cacheIndex&&n&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},n}();function i(t,n){return t}function o(t,n){return n}function a(t,n){return[t,n]}}function nt(){return function(){function t(){this._map=new h}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[r]=function(){return this.keys()},t}()}function et(){var t=16,e=s.create(),i=r();return function(){function t(){this._key=r()}return t.prototype.has=function(t){var n=o(t,!1);return void 0!==n&&s.has(n,this._key)},t.prototype.get=function(t){var n=o(t,!1);return void 0!==n?s.get(n,this._key):void 0},t.prototype.set=function(t,n){return o(t,!0)[this._key]=n,this},t.prototype.delete=function(t){var n=o(t,!1);return void 0!==n&&delete n[this._key]},t.prototype.clear=function(){this._key=r()},t}();function r(){var t;do{t="@@WeakMap@@"+c()}while(s.has(e,t));return e[t]=!0,t}function o(t,e){if(!n.call(t,i)){if(!e)return;Object.defineProperty(t,i,{value:s.create()})}return t[i]}function a(t,n){for(var e=0;n>e;++e)t[e]=255*Math.random()|0;return t}function u(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):a(new Uint8Array(t),t):a(Array(t),t)}function c(){var n=u(t);n[6]=79&n[6]|64,n[8]=191&n[8]|128;for(var e="",i=0;t>i;++i){var r=n[i];4!==i&&6!==i&&8!==i||(e+="-"),16>r&&(e+="0"),e+=r.toString(16).toLowerCase()}return e}}function it(t){return t.__=void 0,delete t.__,t}t("decorate",d),t("metadata",y),t("defineMetadata",g),t("hasMetadata",v),t("hasOwnMetadata",b),t("getMetadata",m),t("getOwnMetadata",w),t("getMetadataKeys",_),t("getOwnMetadataKeys",T),t("deleteMetadata",k)}(i)}()}(Bt||(Bt={})),function(t){t.defineToken=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{multiple:!0};return new t.DefinedToken(n,e)};var n;t.DefinedToken=function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,t),this.prototype={},this.name=void 0,this.multiple=void 0,this.symbol=void 0;var i=e.multiple,o=void 0!==i&&i;this.name=n,this.symbol=Symbol(this.name),this.multiple=o},t.isModule=function(t){return!!t&&"object"===i(t)&&"id"in t&&"registry"in t},function(t){t.singleton="singleton",t.transient="transient"}(n=t.Lifecycle||(t.Lifecycle={})),t.ClassOptionSymbol=Symbol("SyringeClassOptionSymbol"),t.DefaultOption={lifecycle:n.transient}}(t.Syringe||(t.Syringe={})),(Ut=t.Utils||(t.Utils={})).maybeArrayToArray=function(t){return t instanceof Array?t:void 0!==t?[t]:[]},Ut.isClass=function(t){return!(!t||"function"!=typeof t||!("prototype"in t))},Ut.isDefinedToken=function(t){return!!(t&&"object"===i(t)&&"symbol"in t&&"multiple"in t)},Ut.isInjectOption=function(t){return!(!t||"object"!==i(t)||!("token"in t))},Ut.isNamedToken=function(t){return!!(t&&"object"===i(t)&&"token"in t&&"named"in t)},Ut.isMultipleEnabled=function(t){return Ut.isDefinedToken(t)&&t.multiple};var Jt=new Ft;function Qt(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Vt();return function(r){Reflect.defineMetadata(t.Syringe.ClassOptionSymbol,e(e({},n),{},{target:r}),r),i(r)}}function Xt(t){return n=$t(t),function(t,e,i){if(void 0===n)throw Error("@inject called with undefined this could mean that the class "+t.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var r=new X(d,n);"number"==typeof i?tt(t,e,i,r):nt(t,e,r)};var n}function Zt(t){return function(t){return function(n,e,i){var r=new X(f,t);"number"==typeof i?tt(n,e,i,r):nt(n,e,r)}}(Yt(t))}var tn=Symbol("SyringeOptionSymbol");var nn=function(){function n(e,i,o){r(this,n),this.token=void 0,this.rawToken=void 0,this.named=void 0,this.generalToken=void 0,this.option=void 0,this.context=void 0,this.mutiple=void 0,this.context=e,this.token=i,this.option=o,this.rawToken=t.Utils.isNamedToken(i)?i.token:i,this.named=t.Utils.isNamedToken(i)?i.named:void 0,this.mutiple=!!this.named||t.Utils.isMultipleEnabled(this.rawToken),this.generalToken=this.rawToken}return a(n,[{key:"resolve",value:function(){var n,e=this,r=this.context;(n=r)&&"object"===i(n)&&"container"in n&&"inversify"in n&&(this.mutiple?this.resolveMutilple(r):(this.resolveMono(r),!this.named&&this.option.contrib.length>0&&this.option.contrib.forEach((function(n){t.Utils.isMultipleEnabled(n)?Gt(n,r).toService(e.generalToken):Ht(n,r).toService(e.generalToken)}))))}},{key:"resolveMono",value:function(t){var n=this;if("useValue"in this.option)return Ht(this.generalToken,t).toConstantValue(this.option.useValue);if(this.option.useDynamic.length>0){var e=this.option.useDynamic[this.option.useDynamic.length-1];return Kt(Ht(this.generalToken,t).toDynamicValue((function(){return e({container:n.context})})),this.option)}if(this.option.useFactory.length>0){var i=this.option.useFactory[this.option.useFactory.length-1];return Ht(this.generalToken,t).toFactory((function(){return i({container:n.context})}))}if(this.option.useClass.length>0){var r=this.option.useClass[this.option.useClass.length-1];return Kt(Ht(this.generalToken,t).to(r),this.option)}}},{key:"resolveMutilple",value:function(t){var n=this,e=this.option.useClass.map((function(e){return Kt(Gt(n.generalToken,t).to(e),n.option)})),i=this.option.useDynamic.map((function(e){return Kt(Gt(n.generalToken,t).toDynamicValue((function(){return e({container:n.context})})),n.option)})),r=this.option.useFactory.map((function(e){return Gt(n.generalToken,t).toFactory((function(){return e({container:n.context})}))})),o="useValue"in this.option?Gt(this.generalToken,t).toConstantValue(this.option.useValue):void 0;this.named&&(e.forEach((function(t){return n.named&&zt(t,n.named)})),i.forEach((function(t){return n.named&&zt(t,n.named)})),r.forEach((function(t){return n.named&&zt(t,n.named)})),o&&zt(o,this.named))}}],[{key:"resolveTarget",value:function(i,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{try{var a=Reflect.getMetadata(tn,r);a&&n.resolveOption(i,a)}catch(t){}if(t.Utils.isClass(r))if(o.useClass){var u=t.Utils.maybeArrayToArray(o.useClass);u.unshift(r),o.useClass=u}else o.useClass=[r];var s;try{s=Reflect.getMetadata(t.Syringe.ClassOptionSymbol,r)}catch(t){}if((s=e(e({},s||{}),o)).token){var c=t.Utils.maybeArrayToArray(s.token);c.unshift(r),s.token=c}else s.token=[r];n.resolveOption(i,s)}catch(t){}}},{key:"resolveOption",value:function(i,r){var o=function(n){var e=t.Utils.maybeArrayToArray(n.token),i=t.Utils.maybeArrayToArray(n.useClass),r=t.Utils.maybeArrayToArray(n.useDynamic),o=t.Utils.maybeArrayToArray(n.useFactory),a=t.Utils.maybeArrayToArray(n.contrib),u={token:e,useClass:i,lifecycle:a.length>0?t.Syringe.Lifecycle.singleton:n.lifecycle||t.Syringe.Lifecycle.transient,contrib:a,useDynamic:r,useFactory:o};return"useValue"in n&&(u.useValue=n.useValue),u}(e(e({},n.globalConfig),r));(0!==o.useClass.length||0!==o.useDynamic.length||0!==o.useFactory.length||"useValue"in o)&&o.token.forEach((function(t){new n(i,t,e({},o)).resolve()}))}}]),n}();nn.globalConfig=t.Syringe.DefaultOption;var en=function(){function n(t){r(this,n),this.loadedModules=[],this.container=void 0,this.inversify=!0,this.parent=void 0,this.container=t||new Ft}return a(n,[{key:"load",value:function(t,n){!n&&this.loadedModules.includes(t.id)||(t.registry(this.register.bind(this),this.resolveContext()),this.loadedModules.push(t.id))}},{key:"remove",value:function(t){return this.container.unbind($t(t))}},{key:"get",value:function(t){return this.container.get($t(t))}},{key:"getNamed",value:function(t,n){return this.container.getNamed($t(t),Yt(n))}},{key:"getAll",value:function(t){return this.container.getAll($t(t))}},{key:"getAllNamed",value:function(t,n){return this.container.getAllNamed($t(t),Yt(n))}},{key:"isBound",value:function(t){return this.container.isBound($t(t))}},{key:"isBoundNamed",value:function(t,n){return this.container.isBoundNamed($t(t),Yt(n))}},{key:"createChild",value:function(){var t=new n(this.container.createChild());return t.parent=this,t}},{key:"register",value:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.Utils.isInjectOption(n)?nn.resolveOption(this,n):nn.resolveTarget(this,n,e)}},{key:"resolveContext",value:function(){return{container:this}}}],[{key:"config",value:function(t){nn.globalConfig=t}}]),n}(),rn=new en(Jt),on=rn.register.bind(rn),an=t.Syringe.defineToken("ContributionProvider"),un=function(){function t(n,i,o){r(this,t),this.option={recursive:!1,cache:!0},this.services=void 0,this.serviceIdentifier=void 0,this.container=void 0,this.container=i,this.serviceIdentifier=n,o&&(this.option=e(e({},this.option),o))}return a(t,[{key:"setServices",value:function(t){for(var n=[],e=this.container;e;){if(e.isBound(this.serviceIdentifier)){var i=e.getAll(this.serviceIdentifier);n.push.apply(n,s(i))}e=t?e.parent:void 0}return n}},{key:"getContributions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(e({},this.option),t),i=n.cache,r=n.recursive;return i&&void 0!==this.services||(this.services=this.setServices(!!r)),this.services}}]),t}();function sn(n,e){return{token:{token:an,named:n},useDynamic:function(t){return new un(n,t.container,e)},lifecycle:t.Syringe.Lifecycle.singleton}}function cn(n,e,i){n({token:{token:an,named:e},useDynamic:function(t){return new un(e,t.container,i)},lifecycle:t.Syringe.Lifecycle.singleton})}var fn=function(){function t(n){r(this,t),this.id=void 0,this.baseRegistry=void 0,this.optionCollection=void 0,this.id=t.moduleId+=1,this.baseRegistry=n}return a(t,[{key:"registry",get:function(){var t=this;return function(n,e){t.baseRegistry&&t.baseRegistry(n,e),t.optionCollection&&t.optionCollection.forEach((function(t){return n(t)}))}}},{key:"options",get:function(){return this.optionCollection||(this.optionCollection=[]),this.optionCollection}},{key:"register",value:function(){for(var t=this,n=arguments.length,e=Array(n),i=0;n>i;i++)e[i]=arguments[i];return e.forEach((function(n){return t.options.push(n)})),this}},{key:"contribution",value:function(){for(var t=this,n=arguments.length,e=Array(n),i=0;n>i;i++)e[i]=arguments[i];return e.forEach((function(n){return t.options.push(sn(n))})),this}}]),t}();fn.moduleId=0;var hn;(hn=t.Contribution||(t.Contribution={})).Provider=an,hn.register=cn,t.Container=en,t.DefaultContributionProvider=un,t.GlobalContainer=rn,t.Module=function(t){return new fn(t)},t.OptionSymbol=tn,t.Provider=an,t.SyringeModule=fn,t.contrib=function(t){return function(n,e,i){Zt(t)(n,e,i),Xt(an)(n,e,i)}},t.decorate=function(t,n,e){"number"==typeof e?it([rt(e,t)],n):"string"==typeof e?Reflect.decorate([t],n,e):it([t],n)},t.inject=Xt,t.injectable=Qt,t.named=Zt,t.optional=function(){return function(t,n,e){var i=new X(p,!0);"number"==typeof e?tt(t,n,e,i):nt(t,n,i)}},t.postConstruct=function(){return function(t,n,e){var i=new X(m,n);if(Reflect.hasOwnMetadata(m,t.constructor))throw Error("Cannot apply @postConstruct decorator multiple times in the same class");Reflect.defineMetadata(m,i,t.constructor)}},t.register=on,t.registerSideOption=function(t,n){Reflect.defineMetadata(tn,t,n)},t.singleton=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Qt(e(e({},n),{},{lifecycle:t.Syringe.Lifecycle.singleton}))},t.transient=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Qt(e(e({},n),{},{lifecycle:t.Syringe.Lifecycle.transient}))},t.unmanaged=function(){return function(t,n,e){tt(t,n,e,new X(l,!0))}},Object.defineProperty(t,"__esModule",{value:!0})}));
***************************************************************************** */function zt(n,e){return e.lifecycle===t.Syringe.Lifecycle.singleton?function(t){return t.inSingletonScope()}(n):function(t){return t.inTransientScope()}(n)}function Gt(t,n){t.whenTargetNamed($t(n))}function Ht(t,n){return n.bind(Jt(t))}function Yt(t,n){if(n.isBound(Jt(t)))try{return n.rebind(Jt(t))}catch(e){return n.bind(Jt(t))}return n.bind(Jt(t))}function $t(n){return t.Utils.isDefinedToken(n)?n.symbol:n}function Jt(n){return t.Utils.isDefinedToken(n)?n.symbol:n}!function(t){!function(n){var e="object"==typeof Kt?Kt:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),i=r(t);function r(t,n){return function(e,i){"function"!=typeof t[e]&&Object.defineProperty(t,e,{configurable:!0,writable:!0,value:i}),n&&n(e,i)}}void 0===e.Reflect?e.Reflect=t:i=r(e.Reflect,i),function(t){var n=Object.prototype.hasOwnProperty,e="function"==typeof Symbol,i=e&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",r=e&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,a={__proto__:[]}instanceof Array,u=!o&&!a,s={create:o?function(){return it(Object.create(null))}:a?function(){return it({__proto__:null})}:function(){return it({})},has:u?function(t,e){return n.call(t,e)}:function(t,n){return n in t},get:u?function(t,e){return n.call(t,e)?t[e]:void 0}:function(t,n){return t[n]}},c=Object.getPrototypeOf(Function),f="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,h=f||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,l=f||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?nt():Set,p=new(f||"function"!=typeof WeakMap?et():WeakMap);function d(t,n,e,i){if(P(e)){if(!K(t))throw new TypeError;if(!G(n))throw new TypeError;return A(t,n)}if(!K(t))throw new TypeError;if(!q(n))throw new TypeError;if(!q(i)&&!P(i)&&!D(i))throw new TypeError;return D(i)&&(i=void 0),S(t,n,e=L(e),i)}function y(t,n){function e(e,i){if(!q(e))throw new TypeError;if(!P(i)&&!H(i))throw new TypeError;O(t,n,e,i)}return e}function g(t,n,e,i){if(!q(e))throw new TypeError;return P(i)||(i=L(i)),O(t,n,e,i)}function v(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),I(t,n,e)}function b(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),M(t,n,e)}function m(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),j(t,n,e)}function w(t,n,e){if(!q(n))throw new TypeError;return P(e)||(e=L(e)),E(t,n,e)}function _(t,n){if(!q(t))throw new TypeError;return P(n)||(n=L(n)),x(t,n)}function T(t,n){if(!q(t))throw new TypeError;return P(n)||(n=L(n)),R(t,n)}function k(t,n,e){if(!q(n))throw new TypeError;P(e)||(e=L(e));var i=C(n,e,!1);if(P(i))return!1;if(!i.delete(t))return!1;if(i.size>0)return!0;var r=p.get(n);return r.delete(e),r.size>0||p.delete(n),!0}function A(t,n){for(var e=t.length-1;e>=0;--e){var i=(0,t[e])(n);if(!P(i)&&!D(i)){if(!G(i))throw new TypeError;n=i}}return n}function S(t,n,e,i){for(var r=t.length-1;r>=0;--r){var o=(0,t[r])(n,e,i);if(!P(o)&&!D(o)){if(!q(o))throw new TypeError;i=o}}return i}function C(t,n,e){var i=p.get(t);if(P(i)){if(!e)return;i=new h,p.set(t,i)}var r=i.get(n);if(P(r)){if(!e)return;r=new h,i.set(n,r)}return r}function I(t,n,e){if(M(t,n,e))return!0;var i=Z(n);return!D(i)&&I(t,i,e)}function M(t,n,e){var i=C(n,e,!1);return!P(i)&&B(i.has(t))}function j(t,n,e){if(M(t,n,e))return E(t,n,e);var i=Z(n);return D(i)?void 0:j(t,i,e)}function E(t,n,e){var i=C(n,e,!1);if(!P(i))return i.get(t)}function O(t,n,e,i){C(e,i,!0).set(t,n)}function x(t,n){var e=R(t,n),i=Z(t);if(null===i)return e;var r=x(i,n);if(0>=r.length)return e;if(0>=e.length)return r;for(var o=new l,a=[],u=0,s=e;s.length>u;u++){o.has(h=s[u])||(o.add(h),a.push(h))}for(var c=0,f=r;f.length>c;c++){var h;o.has(h=f[c])||(o.add(h),a.push(h))}return a}function R(t,n){var e=[],i=C(t,n,!1);if(P(i))return e;for(var r=$(i.keys()),o=0;;){var a=Q(r);if(!a)return e.length=o,e;var u=J(a);try{e[o]=u}catch(t){try{X(r)}finally{throw t}}o++}}function N(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function P(t){return void 0===t}function D(t){return null===t}function W(t){return"symbol"==typeof t}function q(t){return"object"==typeof t?null!==t:"function"==typeof t}function F(t,n){switch(N(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var e=3===n?"string":5===n?"number":"default",r=Y(t,i);if(void 0!==r){var o=r.call(t,e);if(q(o))throw new TypeError;return o}return V(t,"default"===e?"number":e)}function V(t,n){if("string"===n){var e=t.toString;if(z(e))if(!q(r=e.call(t)))return r;if(z(i=t.valueOf))if(!q(r=i.call(t)))return r}else{var i;if(z(i=t.valueOf))if(!q(r=i.call(t)))return r;var r,o=t.toString;if(z(o))if(!q(r=o.call(t)))return r}throw new TypeError}function B(t){return!!t}function U(t){return""+t}function L(t){var n=F(t,3);return W(n)?n:U(n)}function K(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function G(t){return"function"==typeof t}function H(t){switch(N(t)){case 3:case 4:return!0;default:return!1}}function Y(t,n){var e=t[n];if(null!=e){if(!z(e))throw new TypeError;return e}}function $(t){var n=Y(t,r);if(!z(n))throw new TypeError;var e=n.call(t);if(!q(e))throw new TypeError;return e}function J(t){return t.value}function Q(t){var n=t.next();return!n.done&&n}function X(t){var n=t.return;n&&n.call(t)}function Z(t){var n=Object.getPrototypeOf(t);if("function"!=typeof t||t===c)return n;if(n!==c)return n;var e=t.prototype,i=e&&Object.getPrototypeOf(e);if(null==i||i===Object.prototype)return n;var r=i.constructor;return"function"!=typeof r||r===t?n:r}function tt(){var t={},n=[],e=function(){function t(t,n,e){this._index=0,this._keys=t,this._values=n,this._selector=e}return t.prototype["@@iterator"]=function(){return this},t.prototype[r]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&this._keys.length>t){var e=this._selector(this._keys[t],this._values[t]);return this._keys.length>t+1?this._index++:(this._index=-1,this._keys=n,this._values=n),{value:e,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw 0>this._index||(this._index=-1,this._keys=n,this._values=n),t},t.prototype.return=function(t){return 0>this._index||(this._index=-1,this._keys=n,this._values=n),{value:t,done:!0}},t}();return function(){function n(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(n.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),n.prototype.has=function(t){return this._find(t,!1)>=0},n.prototype.get=function(t){var n=this._find(t,!1);return 0>n?void 0:this._values[n]},n.prototype.set=function(t,n){var e=this._find(t,!0);return this._values[e]=n,this},n.prototype.delete=function(n){var e=this._find(n,!1);if(e>=0){for(var i=this._keys.length,r=e+1;i>r;r++)this._keys[r-1]=this._keys[r],this._values[r-1]=this._values[r];return this._keys.length--,this._values.length--,n===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},n.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},n.prototype.keys=function(){return new e(this._keys,this._values,i)},n.prototype.values=function(){return new e(this._keys,this._values,o)},n.prototype.entries=function(){return new e(this._keys,this._values,a)},n.prototype["@@iterator"]=function(){return this.entries()},n.prototype[r]=function(){return this.entries()},n.prototype._find=function(t,n){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),0>this._cacheIndex&&n&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},n}();function i(t,n){return t}function o(t,n){return n}function a(t,n){return[t,n]}}function nt(){return function(){function t(){this._map=new h}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[r]=function(){return this.keys()},t}()}function et(){var t=16,e=s.create(),i=r();return function(){function t(){this._key=r()}return t.prototype.has=function(t){var n=o(t,!1);return void 0!==n&&s.has(n,this._key)},t.prototype.get=function(t){var n=o(t,!1);return void 0!==n?s.get(n,this._key):void 0},t.prototype.set=function(t,n){return o(t,!0)[this._key]=n,this},t.prototype.delete=function(t){var n=o(t,!1);return void 0!==n&&delete n[this._key]},t.prototype.clear=function(){this._key=r()},t}();function r(){var t;do{t="@@WeakMap@@"+c()}while(s.has(e,t));return e[t]=!0,t}function o(t,e){if(!n.call(t,i)){if(!e)return;Object.defineProperty(t,i,{value:s.create()})}return t[i]}function a(t,n){for(var e=0;n>e;++e)t[e]=255*Math.random()|0;return t}function u(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):a(new Uint8Array(t),t):a(Array(t),t)}function c(){var n=u(t);n[6]=79&n[6]|64,n[8]=191&n[8]|128;for(var e="",i=0;t>i;++i){var r=n[i];4!==i&&6!==i&&8!==i||(e+="-"),16>r&&(e+="0"),e+=r.toString(16).toLowerCase()}return e}}function it(t){return t.__=void 0,delete t.__,t}t("decorate",d),t("metadata",y),t("defineMetadata",g),t("hasMetadata",v),t("hasOwnMetadata",b),t("getMetadata",m),t("getOwnMetadata",w),t("getMetadataKeys",_),t("getOwnMetadataKeys",T),t("deleteMetadata",k)}(i)}()}(Ut||(Ut={})),function(t){t.defineToken=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{multiple:!0};return new t.DefinedToken(n,e)};var n,e=a((function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,t),this.prototype={},this.name=void 0,this.multiple=void 0,this.symbol=void 0;var i=e.multiple,o=void 0!==i&&i;this.name=n,this.symbol=Symbol(this.name),this.multiple=o}));t.DefinedToken=e,t.isModule=function(t){return!!t&&"object"===i(t)&&"id"in t},function(t){t.singleton="singleton",t.transient="transient"}(n=t.Lifecycle||(t.Lifecycle={})),t.ClassOptionSymbol=Symbol("SyringeClassOptionSymbol"),t.DefaultOption={lifecycle:n.transient}}(t.Syringe||(t.Syringe={})),(Lt=t.Utils||(t.Utils={})).toArray=function(t){return Array.isArray(t)?t:void 0===t?[]:[t]},Lt.isClass=function(t){return!(!t||"function"!=typeof t||!("prototype"in t))},Lt.isDefinedToken=function(t){return!!(t&&"object"===i(t)&&"symbol"in t&&"multiple"in t)},Lt.isInjectOption=function(t){return!(!t||"object"!==i(t)||!("token"in t))},Lt.isNamedToken=function(t){return!!(t&&"object"===i(t)&&"token"in t&&"named"in t)},Lt.isMultipleEnabled=function(t){return Lt.isDefinedToken(t)&&t.multiple};var Qt=new Ft;function Xt(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Bt();return function(r){Reflect.defineMetadata(t.Syringe.ClassOptionSymbol,e(e({},n),{},{target:r}),r),i(r)}}function Zt(t){return n=Jt(t),function(t,e,i){if(void 0===n)throw Error("@inject called with undefined this could mean that the class "+t.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var r=new X(d,n);"number"==typeof i?tt(t,e,i,r):nt(t,e,r)};var n}function tn(t){return function(t){return function(n,e,i){var r=new X(f,t);"number"==typeof i?tt(n,e,i,r):nt(n,e,r)}}($t(t))}var nn=Symbol("SyringeOptionSymbol");var en=function(){function n(e,i,o){r(this,n),this.token=void 0,this.rawToken=void 0,this.named=void 0,this.generalToken=void 0,this.option=void 0,this.register=void 0,this.mutiple=void 0,this.register=e,this.token=i,this.option=o,this.rawToken=t.Utils.isNamedToken(i)?i.token:i,this.named=t.Utils.isNamedToken(i)?i.named:void 0,this.mutiple=!!this.named||t.Utils.isMultipleEnabled(this.rawToken),this.generalToken=this.rawToken}return a(n,[{key:"resolve",value:function(){var n,e=this,r=this.register;(n=r)&&"object"===i(n)&&"bind"in n&&"unbind"in n&&"rebind"in n&&"isBound"in n&&(this.mutiple?this.resolveMutilple(r):(this.resolveMono(r),!this.named&&this.option.contrib.length>0&&this.option.contrib.forEach((function(n){t.Utils.isMultipleEnabled(n)?Ht(n,r).toService(e.generalToken):Yt(n,r).toService(e.generalToken)}))))}},{key:"resolveMono",value:function(t){if("useValue"in this.option)return Yt(this.generalToken,t).toConstantValue(this.option.useValue);if(this.option.useDynamic.length>0){var n=this.option.useDynamic[this.option.useDynamic.length-1];return zt(Yt(this.generalToken,t).toDynamicValue((function(t){var e=ln.getContainer(t.container);return n({container:e})})),this.option)}if(this.option.useFactory.length>0){var e=this.option.useFactory[this.option.useFactory.length-1];return Yt(this.generalToken,t).toFactory((function(t){var n=ln.getContainer(t.container);return e({container:n})}))}if(this.option.useClass.length>0){var i=this.option.useClass[this.option.useClass.length-1];return zt(Yt(this.generalToken,t).to(i),this.option)}}},{key:"resolveMutilple",value:function(t){var n=this,e=this.option.useClass.map((function(e){return zt(Ht(n.generalToken,t).to(e),n.option)})),i=this.option.useDynamic.map((function(e){return zt(Ht(n.generalToken,t).toDynamicValue((function(t){var n=ln.getContainer(t.container);return e({container:n})})),n.option)})),r=this.option.useFactory.map((function(e){return Ht(n.generalToken,t).toFactory((function(t){var n=ln.getContainer(t.container);return e({container:n})}))})),o="useValue"in this.option?Ht(this.generalToken,t).toConstantValue(this.option.useValue):void 0;this.named&&(e.forEach((function(t){return n.named&&Gt(t,n.named)})),i.forEach((function(t){return n.named&&Gt(t,n.named)})),r.forEach((function(t){return n.named&&Gt(t,n.named)})),o&&Gt(o,this.named))}}],[{key:"resolveTarget",value:function(i,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{try{var a=Reflect.getMetadata(nn,r);a&&n.resolveOption(i,a)}catch(t){}if(t.Utils.isClass(r))if(o.useClass){var u=t.Utils.toArray(o.useClass);u.unshift(r),o.useClass=u}else o.useClass=[r];var s;try{s=Reflect.getMetadata(t.Syringe.ClassOptionSymbol,r)}catch(t){}if((s=e(e({},s||{}),o)).token){var c=t.Utils.toArray(s.token);c.unshift(r),s.token=c}else s.token=[r];n.resolveOption(i,s)}catch(t){}}},{key:"resolveOption",value:function(i,r){var o=function(n){var e=t.Utils.toArray(n.token),i=t.Utils.toArray(n.useClass),r=t.Utils.toArray(n.useDynamic),o=t.Utils.toArray(n.useFactory),a=t.Utils.toArray(n.contrib),u={token:e,useClass:i,lifecycle:a.length>0?t.Syringe.Lifecycle.singleton:n.lifecycle||t.Syringe.Lifecycle.transient,contrib:a,useDynamic:r,useFactory:o};return"useValue"in n&&(u.useValue=n.useValue),u}(e(e({},n.globalConfig),r));(0!==o.useClass.length||0!==o.useDynamic.length||0!==o.useFactory.length||"useValue"in o)&&o.token.forEach((function(t){new n(i,t,e({},o)).resolve()}))}}]),n}();en.globalConfig=t.Syringe.DefaultOption;var rn=t.Syringe.defineToken("ContributionProvider"),on=function(){function t(n,i,o){r(this,t),this.option={recursive:!1,cache:!0},this.services=void 0,this.serviceIdentifier=void 0,this.container=void 0,this.container=i,this.serviceIdentifier=n,o&&(this.option=e(e({},this.option),o))}return a(t,[{key:"setServices",value:function(t){for(var n=[],e=this.container;e;){if(e.isBound(this.serviceIdentifier)){var i=e.getAll(this.serviceIdentifier);n.push.apply(n,s(i))}e=t?e.parent:void 0}return n}},{key:"getContributions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(e({},this.option),t),i=n.cache,r=n.recursive;return i&&void 0!==this.services||(this.services=this.setServices(!!r)),this.services}}]),t}();function an(n,e){return{token:{token:rn,named:n},useDynamic:function(t){return new on(n,t.container,e)},lifecycle:t.Syringe.Lifecycle.singleton}}function un(n,e,i){n({token:{token:rn,named:e},useDynamic:function(t){return new on(e,t.container,i)},lifecycle:t.Syringe.Lifecycle.singleton})}var sn=function(){function n(e){var i=this;r(this,n),this.id=void 0,this.inversifyModule=void 0,this.baseRegistry=void 0,this.optionCollection=void 0,this.inversifyRegister=function(n,e,r,o){var a={bind:n,unbind:e,isBound:r,rebind:o},u=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.Utils.isInjectOption(n)?en.resolveOption(a,n):en.resolveTarget(a,n,e)};i.baseRegistry&&i.baseRegistry(u),i.optionCollection&&i.optionCollection.forEach((function(t){return u(t)}))},this.baseRegistry=e,this.inversifyModule=new Vt(this.inversifyRegister),this.id=this.inversifyModule.id}return a(n,[{key:"options",get:function(){return this.optionCollection||(this.optionCollection=[]),this.optionCollection}},{key:"register",value:function(){for(var t=this,n=arguments.length,e=Array(n),i=0;n>i;i++)e[i]=arguments[i];return e.forEach((function(n){return t.options.push(n)})),this}},{key:"contribution",value:function(){for(var t=this,n=arguments.length,e=Array(n),i=0;n>i;i++)e[i]=arguments[i];return e.forEach((function(n){return t.options.push(an(n))})),this}}]),n}();function cn(t){return t&&"inversifyModule"in t}var fn,hn=new Map,ln=function(){function n(t){r(this,n),this.loadedModules=[],this.container=void 0,this.inversify=!0,this.parent=void 0,this.container=t||new Ft,n.setContainer(this.container,this)}return a(n,[{key:"load",value:function(t,n){var e=this;return n||!this.loadedModules.includes(t.id)?(cn(t)&&this.container.load(t.inversifyModule),this.loadedModules.push(t.id),{dispose:function(){e.unload(t)}}):(console.warn("Unsupported module."),{dispose:function(){}})}},{key:"unload",value:function(t){cn(t)&&(this.container.unload(t.inversifyModule),this.loadedModules=this.loadedModules.filter((function(n){return n!==t.id})))}},{key:"remove",value:function(t){return this.container.unbind(Jt(t))}},{key:"get",value:function(t){return this.container.get(Jt(t))}},{key:"getNamed",value:function(t,n){return this.container.getNamed(Jt(t),$t(n))}},{key:"getAll",value:function(t){return this.container.getAll(Jt(t))}},{key:"getAllNamed",value:function(t,n){return this.container.getAllNamed(Jt(t),$t(n))}},{key:"isBound",value:function(t){return this.container.isBound(Jt(t))}},{key:"isBoundNamed",value:function(t,n){return this.container.isBoundNamed(Jt(t),$t(n))}},{key:"createChild",value:function(){var t=new n(this.container.createChild());return t.parent=this,t}},{key:"register",value:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.Utils.isInjectOption(n)?en.resolveOption(this.container,n):en.resolveTarget(this.container,n,e)}}],[{key:"setContainer",value:function(t,n){return hn.set(t.id,n)}},{key:"getContainer",value:function(t){var e=hn.get(t.id);if(!e){var i=new n(t);return n.setContainer(t,i),i}return e}},{key:"config",value:function(t){en.globalConfig=t}}]),n}(),pn=new ln(Qt),dn=pn.register.bind(pn);(fn=t.Contribution||(t.Contribution={})).Provider=rn,fn.register=un,t.Container=ln,t.DefaultContributionProvider=on,t.GlobalContainer=pn,t.Module=function(t){return new sn(t)},t.OptionSymbol=nn,t.Provider=rn,t.SyringeModule=sn,t.contrib=function(t){return function(n,e,i){tn(t)(n,e,i),Zt(rn)(n,e,i)}},t.decorate=function(t,n,e){"number"==typeof e?it([rt(e,t)],n):"string"==typeof e?Reflect.decorate([t],n,e):it([t],n)},t.inject=Zt,t.injectable=Xt,t.isSyringeModule=cn,t.named=tn,t.optional=function(){return function(t,n,e){var i=new X(p,!0);"number"==typeof e?tt(t,n,e,i):nt(t,n,i)}},t.postConstruct=function(){return function(t,n,e){var i=new X(m,n);if(Reflect.hasOwnMetadata(m,t.constructor))throw Error("Cannot apply @postConstruct decorator multiple times in the same class");Reflect.defineMetadata(m,i,t.constructor)}},t.register=dn,t.registerSideOption=function(t,n){Reflect.defineMetadata(nn,t,n)},t.singleton=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Xt(e(e({},n),{},{lifecycle:t.Syringe.Lifecycle.singleton}))},t.transient=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Xt(e(e({},n),{},{lifecycle:t.Syringe.Lifecycle.transient}))},t.unmanaged=function(){return function(t,n,e){tt(t,n,e,new X(l,!0))}},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
import type { interfaces } from 'inversify';
import { Container } from 'inversify';
import { Syringe } from '../core';
import type { InversifyContext } from './inversify-protocol';
import type { InversifyRegister } from './inversify-protocol';
export declare function bindSingleton<T>(toBind: interfaces.BindingInSyntax<T>): interfaces.BindingWhenOnSyntax<T>;

@@ -9,7 +9,7 @@ export declare function bindTransient<T>(toBind: interfaces.BindingInSyntax<T>): interfaces.BindingWhenOnSyntax<T>;

export declare function bindNamed<T>(toBind: interfaces.BindingWhenOnSyntax<T>, named: Syringe.Named): void;
export declare function bindGeneralToken<T>(token: interfaces.ServiceIdentifier<T>, context: InversifyContext): interfaces.BindingToSyntax<T>;
export declare function bindMonoToken<T>(token: interfaces.ServiceIdentifier<T>, context: InversifyContext): interfaces.BindingToSyntax<T>;
export declare function isInversifyContext(data: Record<any, any>): data is InversifyContext;
export declare function bindGeneralToken<T>(token: interfaces.ServiceIdentifier<T>, register: InversifyRegister): interfaces.BindingToSyntax<T>;
export declare function bindMonoToken<T>(token: interfaces.ServiceIdentifier<T>, register: InversifyRegister): interfaces.BindingToSyntax<T>;
export declare function namedToIdentifier(named: Syringe.Named): string | symbol;
export declare function tokenToIdentifier<T = any>(token: Syringe.Token<T>): interfaces.ServiceIdentifier<T>;
export declare const GlobalContainer: Container;
export * from './inversify-protocol';

@@ -1,4 +0,12 @@

import type { Container } from 'inversify';
import type { interfaces } from 'inversify';
export declare type InversifyContext = {
container: Container;
container: interfaces.Container;
};
export declare function isInversifyContext(data: Record<any, any>): data is InversifyContext;
export declare type InversifyRegister = {
bind: interfaces.Bind;
unbind: interfaces.Unbind;
isBound: interfaces.IsBound;
rebind: interfaces.Rebind;
};
export declare function isInversifyRegister(data: Record<any, any>): data is InversifyRegister;
import type { Syringe } from '../core';
import type { interfaces } from 'inversify';
import { ContainerModule } from 'inversify';
declare type TokenOrOption<T> = Syringe.Token<T> | Syringe.InjectOption<T>;
export declare class SyringeModule implements Syringe.Module {
static moduleId: number;
/**

@@ -10,9 +11,7 @@ * @readonly

readonly id: number;
readonly inversifyModule: ContainerModule;
protected baseRegistry?: Syringe.Registry;
protected optionCollection?: (Syringe.Token<any> | Syringe.InjectOption<any>)[];
/**
* Exposed registration function
*/
get registry(): Syringe.Registry;
constructor(registry?: Syringe.Registry);
protected inversifyRegister: (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => void;
protected get options(): (Syringe.Token<any> | Syringe.InjectOption<any>)[];

@@ -22,2 +21,3 @@ register(...options: TokenOrOption<any>[]): this;

}
export declare function isSyringeModule(data: Syringe.Module): data is SyringeModule;
export {};
import type { interfaces } from 'inversify';
import type { InversifyContext } from './inversify/inversify-protocol';
import type { InversifyRegister } from './inversify';
import { Syringe } from './core';

@@ -10,7 +10,7 @@ export declare function toRegistryOption<P>(options: Syringe.InjectOption<P>): Syringe.FormattedInjectOption<P>;

*/
static resolveTarget<R>(context: Syringe.Container, target: Syringe.Token<R>, option?: Syringe.TargetOption<R>): void;
static resolveTarget<R>(register: InversifyRegister, target: Syringe.Token<R>, option?: Syringe.TargetOption<R>): void;
/**
* 基于配置注册
*/
static resolveOption<R>(context: Syringe.Container, baseOption: Syringe.InjectOption<R>): void;
static resolveOption<R>(iRegister: InversifyRegister, baseOption: Syringe.InjectOption<R>): void;
protected token: Syringe.UnionToken<T>;

@@ -24,5 +24,5 @@ protected rawToken: Syringe.Token<T>;

protected option: Syringe.FormattedInjectOption<T>;
protected context: Syringe.Container;
protected register: InversifyRegister;
protected mutiple: boolean;
constructor(context: Syringe.Container, token: Syringe.UnionToken<T>, option: Syringe.FormattedInjectOption<T>);
constructor(register: InversifyRegister, token: Syringe.UnionToken<T>, option: Syringe.FormattedInjectOption<T>);
/**

@@ -33,4 +33,4 @@ * multi or mono register

resolve(): void;
protected resolveMono(context: InversifyContext): interfaces.BindingWhenOnSyntax<T> | undefined;
protected resolveMutilple(context: InversifyContext): void;
protected resolveMono(register: InversifyRegister): interfaces.BindingWhenOnSyntax<T> | undefined;
protected resolveMutilple(register: InversifyRegister): void;
}
{
"name": "mana-syringe",
"keywords": [],
"version": "0.2.2",
"keywords": [
"mana",
"syringe",
"inversify"
],
"description": "IoC library for mana, easily to use.",
"version": "0.3.0",
"typings": "dist/index.d.ts",

@@ -25,3 +30,3 @@ "main": "dist/index.js",

},
"gitHead": "49568bfb1e00a0c1e6d74d6adcaa38da1a17891f"
"gitHead": "b57985192b7ff475d7ace7423519cf096d12174a"
}
# mana-syringe
IoC library for mana, easily to use.
[![NPM version](https://img.shields.io/npm/v/mana-syringe.svg?style=flat)](https://npmjs.org/package/mana-syringe) [![NPM downloads](https://img.shields.io/npm/dm/mana-syringe.svg?style=flat)](https://npmjs.org/package/mana-syringe)

@@ -4,0 +6,0 @@

@@ -6,2 +6,3 @@ import assert from 'assert';

import { contrib, Contribution } from './contribution';
import { Container as InversifyContainer } from 'inversify';
import { Module } from './module';

@@ -229,12 +230,10 @@

}
// const fooModule = Module().contribution(FooSymbol).register(Foo, FooContribution);
const baseModule = Module().register(Foo).contribution(FooSymbol);
const fooModule = Module(reg => {
Contribution.register(reg, FooSymbol, { cache: false });
reg(Foo);
reg(FooContribution);
});
const barModule = Module((reg, ctx) => {
ctx.container.remove(FooSymbol);
const barModule = Module(reg => {
reg(BarContribution);
});
GlobalContainer.load(baseModule);
GlobalContainer.load(fooModule);

@@ -245,6 +244,10 @@ const foo = GlobalContainer.get(Foo);

assert(contribs[0] instanceof FooContribution);
GlobalContainer.load(barModule);
GlobalContainer.unload(fooModule);
const toDispose = GlobalContainer.load(barModule);
const newContribs = foo.provider.getContributions({ cache: false });
assert(newContribs.length === 1);
assert(newContribs[0] instanceof BarContribution);
toDispose.dispose();
const emptyContribs = foo.provider.getContributions({ cache: false });
assert(emptyContribs.length === 0);
});

@@ -255,7 +258,12 @@ });

@injectable()
class NewContainer {}
const container = new Container();
container.register(NewContainer);
const foo = container.get(NewContainer);
assert(foo instanceof NewContainer);
class NewFoo {}
const ctn = new InversifyContainer();
const container = Container.getContainer(ctn);
const cachedContainer = Container.getContainer(ctn);
const fooContainer = new Container();
assert(cachedContainer === container);
assert(cachedContainer !== fooContainer);
container.register(NewFoo);
const foo = container.get(NewFoo);
assert(foo instanceof NewFoo);
});

@@ -262,0 +270,0 @@ it('#global config', () => {

@@ -0,1 +1,2 @@

import type { interfaces } from 'inversify';
import { Container as InversifyContainer } from 'inversify';

@@ -8,16 +9,32 @@ import type { InversifyContext } from './inversify/inversify-protocol';

} from './inversify';
import type { Syringe } from './core';
import type { Disposable, Syringe } from './core';
import { Utils } from './core';
import { Register } from './register';
import { isSyringeModule } from './module';
const ContainerMap = new Map<number, Syringe.Container>();
/* eslint-disable @typescript-eslint/no-explicit-any */
export class Container implements Syringe.Container, InversifyContext {
static setContainer(key: interfaces.Container, value: Syringe.Container) {
return ContainerMap.set(key.id, value);
}
static getContainer(key: interfaces.Container) {
const exist = ContainerMap.get(key.id);
if (!exist) {
const container = new Container(key);
Container.setContainer(key, container);
return container;
}
return exist;
}
static config(option: Syringe.InjectOption<void>): void {
Register.globalConfig = option;
}
protected loadedModules: number[] = [];
container: InversifyContainer;
container: interfaces.Container;
protected inversify: boolean = true;
parent?: Container;
constructor(inversifyContainer?: InversifyContainer) {
constructor(inversifyContainer?: interfaces.Container) {
if (inversifyContainer) {

@@ -28,9 +45,25 @@ this.container = inversifyContainer;

}
Container.setContainer(this.container, this);
}
load(module: Syringe.Module, force?: boolean): void {
load(module: Syringe.Module, force?: boolean): Disposable {
if (force || !this.loadedModules.includes(module.id)) {
module.registry(this.register.bind(this), this.resolveContext());
if (isSyringeModule(module)) {
this.container.load(module.inversifyModule);
}
this.loadedModules.push(module.id);
return {
dispose: () => {
this.unload(module);
},
};
}
console.warn('Unsupported module.');
return { dispose: () => {} };
}
unload(module: Syringe.Module): void {
if (isSyringeModule(module)) {
this.container.unload(module.inversifyModule);
this.loadedModules = this.loadedModules.filter(id => id !== module.id);
}
}
remove<T>(token: Syringe.Token<T>): void {

@@ -73,11 +106,7 @@ return this.container.unbind(tokenToIdentifier(token));

if (Utils.isInjectOption(token)) {
Register.resolveOption(this, token);
Register.resolveOption(this.container, token);
} else {
Register.resolveTarget(this, token, options);
Register.resolveTarget(this.container, token, options);
}
}
protected resolveContext(): Syringe.Context {
return { container: this };
}
}

@@ -84,0 +113,0 @@

@@ -11,4 +11,4 @@ import * as Protocol from './contribution-protocol';

export type Provider<T extends Record<string, any>> = Protocol.Provider<T>;
export const { Provider } = Protocol;
export const Provider = Protocol.Provider;
export const register = contributionRegister;
}

@@ -17,2 +17,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

export type Disposable = {
/**
* Dispose this object.
*/
dispose: () => void;
};
export namespace Syringe {

@@ -56,10 +62,9 @@ /**

export type Registry = (register: Register, ctx: Context) => void;
export type Registry = (register: Register) => void;
export type Module = {
id: number;
registry: Registry;
};
export function isModule(data: Record<any, any> | undefined): data is Module {
return !!data && typeof data === 'object' && 'id' in data && 'registry' in data;
return !!data && typeof data === 'object' && 'id' in data;
}

@@ -74,3 +79,4 @@

) => void;
load: (module: Module, force?: boolean) => void;
load: (module: Module, force?: boolean) => Disposable;
unload: (module: Module) => void;
get: <T>(token: Syringe.Token<T>) => T;

@@ -136,10 +142,10 @@ getNamed: <T>(token: Syringe.Token<T>, named: Syringe.Named) => T;

export namespace Utils {
export function maybeArrayToArray<T>(maybeArray: Syringe.MaybeArray<T> | undefined): T[] {
if (!(maybeArray instanceof Array)) {
if (maybeArray !== undefined) {
return [maybeArray];
}
export function toArray<T>(maybeArray: Syringe.MaybeArray<T> | undefined): T[] {
if (Array.isArray(maybeArray)) {
return maybeArray;
}
if (maybeArray === undefined) {
return [];
}
return maybeArray;
return [maybeArray];
}

@@ -146,0 +152,0 @@ export function isClass(

@@ -6,3 +6,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

import { injectable } from 'inversify';
import { bindSingleton, bindTransient, bindLifecycle } from '.';
import { bindSingleton, bindTransient, bindLifecycle, isInversifyContext } from '.';
import { Syringe } from '../core';

@@ -15,3 +15,6 @@ import { GlobalContainer } from '../container';

remove: () => {},
load: () => {},
load: () => ({
dispose: () => {},
}),
unload: () => {},
get: () => ({} as any),

@@ -37,2 +40,3 @@ getNamed: () => ({} as any),

assert(GlobalContainer);
assert(isInversifyContext(GlobalContainer));
});

@@ -72,3 +76,3 @@ it('#bind singleton', () => {

class Foo {}
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -88,3 +92,3 @@ token: [FooFactory],

const foo = {};
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -95,3 +99,3 @@ token: [Foo],

});
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -112,3 +116,3 @@ token: [Bar],

const foo = {};
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -128,3 +132,3 @@ token: [{ token: Foo, named }],

class Foo {}
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -143,3 +147,3 @@ token: [{ token: FooFactory, named }],

class Foo {}
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -158,3 +162,3 @@ token: [FooDynamic],

class Foo {}
Register.resolveOption(GlobalContainer, {
Register.resolveOption(GlobalContainer.container, {
...emptyOptions,

@@ -171,3 +175,3 @@ token: [{ token: FooDynamic, named }],

class Foo {}
Register.resolveOption<Foo>(GlobalContainer, {
Register.resolveOption<Foo>(GlobalContainer.container, {
...emptyOptions,

@@ -185,3 +189,3 @@ token: [{ token: Foo, named: 'named' }],

class Foo {}
Register.resolveOption<Foo>(GlobalContainer, {
Register.resolveOption<Foo>(GlobalContainer.container, {
...emptyOptions,

@@ -201,3 +205,3 @@ lifecycle: Syringe.Lifecycle.singleton,

try {
Register.resolveOption<Foo>(fakeContainer, {
Register.resolveOption<Foo>(fakeContainer as any, {
...emptyOptions,

@@ -208,3 +212,3 @@ lifecycle: Syringe.Lifecycle.singleton,

});
Register.resolveOption<Foo>(fakeContainer, {
Register.resolveOption<Foo>(fakeContainer as any, {
...emptyOptions,

@@ -211,0 +215,0 @@ lifecycle: Syringe.Lifecycle.singleton,

import type { interfaces } from 'inversify';
import { Container } from 'inversify';
import { Syringe, Utils } from '../core';
import type { InversifyContext } from './inversify-protocol';
import type { InversifyRegister } from './inversify-protocol';

@@ -36,22 +36,21 @@ export function bindSingleton<T>(

token: interfaces.ServiceIdentifier<T>,
context: InversifyContext,
register: InversifyRegister,
): interfaces.BindingToSyntax<T> {
return context.container.bind(tokenToIdentifier(token));
return register.bind(tokenToIdentifier(token));
}
export function bindMonoToken<T>(
token: interfaces.ServiceIdentifier<T>,
context: InversifyContext,
register: InversifyRegister,
): interfaces.BindingToSyntax<T> {
const { parent } = context.container;
const bindFromParent = parent && parent.isBound(tokenToIdentifier(token));
if (context.container.isBound(tokenToIdentifier(token)) && !bindFromParent) {
return context.container.rebind(tokenToIdentifier(token));
if (register.isBound(tokenToIdentifier(token))) {
try {
return register.rebind(tokenToIdentifier(token));
} catch (ex) {
// not bind in crrent container
return register.bind(tokenToIdentifier(token));
}
}
return context.container.bind(tokenToIdentifier(token));
return register.bind(tokenToIdentifier(token));
}
export function isInversifyContext(data: Record<any, any>): data is InversifyContext {
return data && typeof data === 'object' && 'container' in data && 'inversify' in data;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -74,1 +73,3 @@ export function namedToIdentifier(named: Syringe.Named): string | symbol {

export const GlobalContainer = new Container();
export * from './inversify-protocol';

@@ -1,4 +0,25 @@

import type { Container } from 'inversify';
import type { interfaces } from 'inversify';
export type InversifyContext = {
container: Container;
container: interfaces.Container;
};
export function isInversifyContext(data: Record<any, any>): data is InversifyContext {
return data && typeof data === 'object' && 'container' in data && 'inversify' in data;
}
export type InversifyRegister = {
bind: interfaces.Bind;
unbind: interfaces.Unbind;
isBound: interfaces.IsBound;
rebind: interfaces.Rebind;
};
export function isInversifyRegister(data: Record<any, any>): data is InversifyRegister {
return (
data &&
typeof data === 'object' &&
'bind' in data &&
'unbind' in data &&
'rebind' in data &&
'isBound' in data
);
}
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Syringe } from '../core';
import { Utils } from '../core';
import { contributionInjectOption } from '../contribution/contribution-register';
import type { interfaces } from 'inversify';
import { ContainerModule } from 'inversify';
import type { InversifyRegister } from '../inversify';
import { Register } from '../register';

@@ -8,3 +13,2 @@ type TokenOrOption<T> = Syringe.Token<T> | Syringe.InjectOption<T>;

export class SyringeModule implements Syringe.Module {
static moduleId: number = 0;
/**

@@ -15,24 +19,41 @@ * @readonly

readonly id: number;
readonly inversifyModule: ContainerModule;
protected baseRegistry?: Syringe.Registry;
protected optionCollection?: (Syringe.Token<any> | Syringe.InjectOption<any>)[];
/**
* Exposed registration function
*/
get registry(): Syringe.Registry {
return (register: Syringe.Register, ctx: Syringe.Context) => {
if (this.baseRegistry) {
this.baseRegistry(register, ctx);
}
if (this.optionCollection) {
this.optionCollection.forEach(option => register(option));
}
};
}
constructor(registry?: Syringe.Registry) {
SyringeModule.moduleId += 1;
this.id = SyringeModule.moduleId;
this.baseRegistry = registry;
this.inversifyModule = new ContainerModule(this.inversifyRegister);
this.id = this.inversifyModule.id;
}
protected inversifyRegister = (
bind: interfaces.Bind,
unbind: interfaces.Unbind,
isBound: interfaces.IsBound,
rebind: interfaces.Rebind,
) => {
const inversifyRegister: InversifyRegister = {
bind,
unbind,
isBound,
rebind,
};
const register = <T = any>(
token: Syringe.Token<T> | Syringe.InjectOption<T>,
options: Syringe.InjectOption<T> = {},
): void => {
if (Utils.isInjectOption(token)) {
Register.resolveOption(inversifyRegister, token);
} else {
Register.resolveTarget(inversifyRegister, token, options);
}
};
if (this.baseRegistry) {
this.baseRegistry(register);
}
if (this.optionCollection) {
this.optionCollection.forEach(option => register(option));
}
};

@@ -55,1 +76,5 @@ protected get options() {

}
export function isSyringeModule(data: Syringe.Module): data is SyringeModule {
return data && 'inversifyModule' in data;
}
import type { interfaces } from 'inversify';
import type { InversifyContext } from './inversify/inversify-protocol';
import {
bindNamed,
bindGeneralToken,
bindMonoToken,
bindLifecycle,
isInversifyContext,
} from './inversify';
import type { InversifyRegister } from './inversify';
import { isInversifyRegister } from './inversify';
import { bindNamed, bindGeneralToken, bindMonoToken, bindLifecycle } from './inversify';
import { Utils, Syringe } from './core';
import { OptionSymbol } from './side-option';
import { Container } from './container';

@@ -16,7 +12,7 @@ export function toRegistryOption<P>(

): Syringe.FormattedInjectOption<P> {
const token = Utils.maybeArrayToArray(options.token);
const useClass = Utils.maybeArrayToArray(options.useClass);
const useDynamic = Utils.maybeArrayToArray(options.useDynamic);
const useFactory = Utils.maybeArrayToArray(options.useFactory);
const contrib = Utils.maybeArrayToArray(options.contrib);
const token = Utils.toArray(options.token);
const useClass = Utils.toArray(options.useClass);
const useDynamic = Utils.toArray(options.useDynamic);
const useFactory = Utils.toArray(options.useFactory);
const contrib = Utils.toArray(options.contrib);
const lifecycle = options.lifecycle || Syringe.Lifecycle.transient;

@@ -44,3 +40,3 @@

static resolveTarget<R>(
context: Syringe.Container,
register: InversifyRegister,
target: Syringe.Token<R>,

@@ -53,3 +49,3 @@ option: Syringe.TargetOption<R> = {},

if (sideOption) {
Register.resolveOption(context, sideOption);
Register.resolveOption(register, sideOption);
}

@@ -64,3 +60,3 @@ } catch (ex) {

} else {
const classes = Utils.maybeArrayToArray(option.useClass);
const classes = Utils.toArray(option.useClass);
classes.unshift(target);

@@ -83,7 +79,7 @@ option.useClass = classes;

} else {
const tokens = Utils.maybeArrayToArray(mixedOption.token);
const tokens = Utils.toArray(mixedOption.token);
tokens.unshift(target);
mixedOption.token = tokens;
}
Register.resolveOption(context, mixedOption);
Register.resolveOption(register, mixedOption);
} catch (ex) {

@@ -96,3 +92,3 @@ // noop

*/
static resolveOption<R>(context: Syringe.Container, baseOption: Syringe.InjectOption<R>): void {
static resolveOption<R>(iRegister: InversifyRegister, baseOption: Syringe.InjectOption<R>): void {
const parsedOption = toRegistryOption({

@@ -112,3 +108,3 @@ ...Register.globalConfig,

parsedOption.token.forEach(token => {
const register = new Register(context, token, { ...parsedOption });
const register = new Register(iRegister, token, { ...parsedOption });
register.resolve();

@@ -126,10 +122,10 @@ });

protected option: Syringe.FormattedInjectOption<T>;
protected context: Syringe.Container;
protected register: InversifyRegister;
protected mutiple: boolean;
constructor(
context: Syringe.Container,
register: InversifyRegister,
token: Syringe.UnionToken<T>,
option: Syringe.FormattedInjectOption<T>,
) {
this.context = context;
this.register = register;
this.token = token;

@@ -147,16 +143,16 @@ this.option = option;

resolve(): void {
const { context } = this;
if (!isInversifyContext(context)) {
const { register } = this;
if (!isInversifyRegister(register)) {
return;
}
if (this.mutiple) {
this.resolveMutilple(context);
this.resolveMutilple(register);
} else {
this.resolveMono(context);
this.resolveMono(register);
if (!this.named && this.option.contrib.length > 0) {
this.option.contrib.forEach(contribution => {
if (Utils.isMultipleEnabled(contribution)) {
bindGeneralToken(contribution, context).toService(this.generalToken);
bindGeneralToken(contribution, register).toService(this.generalToken);
} else {
bindMonoToken(contribution, context).toService(this.generalToken);
bindMonoToken(contribution, register).toService(this.generalToken);
}

@@ -168,5 +164,7 @@ });

// eslint-disable-next-line consistent-return
protected resolveMono(context: InversifyContext): interfaces.BindingWhenOnSyntax<T> | undefined {
protected resolveMono(
register: InversifyRegister,
): interfaces.BindingWhenOnSyntax<T> | undefined {
if ('useValue' in this.option) {
return bindMonoToken(this.generalToken, context).toConstantValue(this.option.useValue!);
return bindMonoToken(this.generalToken, register).toConstantValue(this.option.useValue!);
}

@@ -176,5 +174,6 @@ if (this.option.useDynamic.length > 0) {

return bindLifecycle(
bindMonoToken(this.generalToken, context).toDynamicValue(() =>
dynamic({ container: this.context }),
),
bindMonoToken(this.generalToken, register).toDynamicValue(ctx => {
const container = Container.getContainer(ctx.container)!;
return dynamic({ container });
}),
this.option,

@@ -185,20 +184,22 @@ );

const factrory = this.option.useFactory[this.option.useFactory.length - 1];
return bindMonoToken(this.generalToken, context).toFactory(() =>
factrory({ container: this.context }),
);
return bindMonoToken(this.generalToken, register).toFactory(ctx => {
const container = Container.getContainer(ctx.container)!;
return factrory({ container });
});
}
if (this.option.useClass.length > 0) {
const newable = this.option.useClass[this.option.useClass.length - 1];
return bindLifecycle(bindMonoToken(this.generalToken, context).to(newable), this.option);
return bindLifecycle(bindMonoToken(this.generalToken, register).to(newable), this.option);
}
}
protected resolveMutilple(context: InversifyContext): void {
protected resolveMutilple(register: InversifyRegister): void {
const classesList = this.option.useClass.map(newable =>
bindLifecycle(bindGeneralToken(this.generalToken, context).to(newable), this.option),
bindLifecycle(bindGeneralToken(this.generalToken, register).to(newable), this.option),
);
const dynamicList = this.option.useDynamic.map(dynamic =>
bindLifecycle(
bindGeneralToken(this.generalToken, context).toDynamicValue(() =>
dynamic({ container: this.context }),
),
bindGeneralToken(this.generalToken, register).toDynamicValue(ctx => {
const container = Container.getContainer(ctx.container)!;
return dynamic({ container });
}),
this.option,

@@ -208,9 +209,10 @@ ),

const factoryList = this.option.useFactory.map(factrory =>
bindGeneralToken(this.generalToken, context).toFactory(() =>
factrory({ container: this.context }),
),
bindGeneralToken(this.generalToken, register).toFactory(ctx => {
const container = Container.getContainer(ctx.container)!;
return factrory({ container });
}),
);
const valueToBind =
'useValue' in this.option
? bindGeneralToken(this.generalToken, context).toConstantValue(this.option.useValue!)
? bindGeneralToken(this.generalToken, register).toConstantValue(this.option.useValue!)
: undefined;

@@ -217,0 +219,0 @@ if (this.named) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc