mana-syringe
Version:
IoC library for mana, easily to use.
15 lines (13 loc) • 52.4 kB
JavaScript
!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:{};
/*! *****************************************************************************
Copyright (C) Microsoft. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */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):console.warn("Unsupported module.",t),this.loadedModules.push(t.id),{dispose:function(){e.unload(t)}}):{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:fun